Skip to main content

A Simple Example ECG Signal in Matlab

Before attempting any signal processing of the electrocardiogram it is important to first understand the physiological basis of the ECG, to review measurement conventions of the standard ECG, and to review how a clinician uses the ECG for patient care.

The Physical Basis of Electrocardiography
As a result of the electrical activity of the cells, current flows within the body and potential differences are established on the surface of the skin, which can be measured using suitable equipment. The graphical recording of these body surface potentials as a function of time produces the electrocardiogram. The simplest mathematical model for relating the cardiac generator to the body surface potentials is the single dipole model.
ECG Signal

A Simple Example

clear all, clc
sig = load('ecg.txt'); % load the ECG signal
plot(sig); % plot 
xlabel('Samples'); 
ylabel('Electrical Activity');
title('ECG Singnal Sampled at 100Hz');

Output

ECG Signal

Zoom in the figure to see ECG signal
Zoom in ECG Signal



hold on
plot(sig,'ro');
Signed ECG Signal

Zoom in Signed ECG Signal

Comments

Popular posts from this blog

Using PCA on Three Dimensional Dataset

In this work, We use PCA three dimensional data.  Matlab Code % PCA Model clear all, clc , close all hold on axis equal axis([-2 2 -2 2 -2 2]) % Step 1: Get some data X = [1 2 -1 -2 0; 0.2 0 0.1 0.2 -0.4; 1.2 0.3 -1 -0.1 -0.4]'; % Step 2: Substract the mean plot3(X(:,1),X(:,2),X(:,3),'ko'); XAdjust = X-repmat(mean(X),size(X,1),1); plot3(XAdjust(:,1),XAdjust(:,2),XAdjust(:,3),'ro'); % Step 3: Calculate the covariance matrix CM = cov(X); % Step 4: Eigenvalue and Eigenvector [V D]= eig(CM); % Step 5: Choosing component f1 = V(:,1)'; f2 = V(:,2)'; f3 = V(:,3)'; F=[f1; f2; f3];

Use PCA in Machine Learning

Matlab Code % Source % http://www.dcs.gla.ac.uk/~srogers/firstcourseml/matlab/chapter7/pcaexample.html#2 clear all;close all; % Generate the data Y = [randn(20,2);randn(20,2)+5;randn(20,2)-5]; % Add 5 random dimensions N = size(Y,1); Y = [Y randn(N,5)];