Vous êtes sur la page 1sur 5

Heart Rate Analysis Heart rate (HR) was recorded continuously, using a pulse oximeter (Nonin 8600FO, Nonin

Medical, Plymouth, MN, USA), with the pulse probe attached to the ring finger of the participants right hand. Interbeat intervals were transformed off-line in second-by- second beats per minute (bpm), using locally developed software. Mean HR responses (HRR) to heat stimuli were computed by aver- aging the bpm values in the 6-s window following stimulus onset. The interval between successive measurement windows was 37 s. In addition, the average of bpm values in the 1-s interval preceding stimulus onset was calculated as a measure of pain anticipation. All HRR were square-root transformed prior to statistical analyses to achieve statistical normality. I am trying to better understand MATLab, as I am a new user. I've been working on a ECG waveform and I have been trying to add noise to it and repeat it over 10 sec. What I hope to do is then to filter it and try to analyze the signal to determine the heart rate. I hope to do this by locating the peak in each heartbeat, and dividing over time. The problem I have encountered is when using 'findpeaks'. Instead of finding the max peaks in each heartbeat, it is giving me many more peaks within the waveform. Does anyone know how to find only the max peaks in my waveform? The code I am using is below: x1 = ecg(512); x = repmat(x1,1,10); x = x + 0.1.*randn(1,length(x)); frame = 15; degree = 0; x3 = sgolayfilt(x, degree, frame); n = 1:512; del = round(512*rand(1)) ECGW = x3(n+del); t = 1/512:1/512:10 plot(t,x3); axis([0 10 -1 1]); grid; xlabel('Time[sec]'); ylabel('Voltage'); title('Normal ECG Waveform Over Ten Seconds'); [pks,locs] = findpeaks(x3);

Any thoughts? You could threshold to suppress lower peaks: signal(signal < thresholdValue) = 0; Then it will find only peaks greater than the threshold. If you want to avoid having to write your own peak detection function, then findpeaks is the way to go. You need to set a threshold however, to ensure only R peaks are detected. > What you could do is: maxValue = max(ecg); threshold = 0.5 *maxValue; % arbitrary, but most p and q peaks should lie below this > > %After you set your threshold then [pks,locs] = findpeaks(ecgSignal,'minpeakheight',threshold);

Before a threshold detector can be applied, it is necessary to compute the absolute value of each sample of the filtered signal so that every sample of the ripple becomes positive. The absolute value can be replaced by a square operation, which will magnify the segments with higher amplitude. To do detect QRS complexes in EEG , the first thing you should do is to identify the most prominent complex of ECG. And thats " R -peak". Once you have identified the R peak , the rest would be easy , because Q and S do have some relation with R. If you have read the basic stuff regarding ECG then you would find it easy. For eg. the voltage measurements of Q and S is less than R by some factor. Say Q is 1/4th of R something like that ( not actual, but you can figure it ). So the first thing is to identify R. Since ECG is periodic, you can specify a window of a specific size ( depending on the sampling rate of the signal) to move between certain intervals and find the maximum value of voltage in a particular frame, which would be your R peak. The other way would be using wavelets. You should have got an idea by now , I think so.

1) BPM OF ECG SIGNAL: This program calculates the beats per minute of of an ECG signal. The data file should be in 'csv' format. The output will be an averaged value, since normal ecg of a person is not always constant. There maybe drifts and variations. The percentage error for six seconds of the ecg will be 60/sampling frequency. 2) HR COMPUTED: ECG data file of sufficient length to be loaded(Here ECG29.dat is used) ,Sampling frequency of the data required to specify. Program displays Electrocardigram data ,its first differentiation,second differeention and cumulayive of first and second derivative. To find qrs peak, thresholding is used to lacate max and is converted to beat.Number of beats in 12 seconds calculated in one epoch(if require change to severalminutes ), thereby Heart rate is computed. 3) Here we uses matlab inbuilt functions. But our task is to remove all inbuilt functions write our own functions using wavelet concepts to implement in Embedded systems. This code is developed using the following reference paper.

%% Waveform Suite Example: Remove a Calibration Pulse % This example shows how to load data into a waveform, filter it, do a few % manipulations, and then plot the results. % % Created by Celso Reyes % for use with the Waveform Suite % April, 2009 %% Load the data % For this example, I'll load some data that I'm sure contains a % calibration pulse. While the example data is stored as a <../waveform.html waveform> in a % .mat file, declaring a different <../datasource.html datasource> will let you grab it from % just about anywhere else. ds = datasource('file','J:/DATA/example.mat'); % My predefined winston_datasource was loaded at startup. ds = winston_datasource; scnl = scnlobject('LSSE','SHZ','AV','--'); w = waveform(ds,scnl,'3/31/2009 09:00:00','3/31/2009 09:15:00');

%% Here is what the original data look like plot(w,'xunit','minutes'); legend('Orig. Waveform'); %% Tease out the calibration pulse % Here are the characteristics/assumptions used to detect a calibration % pulse: % % * A calibration pulse exists in the data % * First section of pulse has a 21 Hz dominant signal % * At 21 hz, the dominant signal *is* the calibration pulse % * Calibration pulse is 60 seconds long %% % Here's the <../filterobject.html filter> we'll use: bandpass 20-22 Hz butterworth, 5 poles calibFilter = filterobject('b',[20,22],5); % get the envelope of the filtered data h = hilbert(filtfilt(calibFilter,w)); % use the raw numbers for comparison d = double(h); % The calibration start is marked by the first big spike in the filtered % data that reaches at least 3/4 the maximum amplitude calibStartIndex = find(d> (max(h).* 0.75),1,'first'); % Then, determine the end by knowing the pulse lasts one minute calibEndIndex = calibStartIndex + get(w,'freq') * 60; dv = get(w,'timevector'); %Extract the calibration pulse for later use (if desired) calibWaveform = extract(w,'time',dv(calibStartIndex),dv(calibEndIndex)); %% plot waveform along with the detected calibration pulse plot([w,calibWaveform],'xunit','date'); legend('Orig. Wave','Calib'); %% plot the two individual peices, showing the gap between % Now, grab the segments of the data to either side of the pulse.

noCalib = extract(w,'time',dv([1,calibEndIndex]),dv([calibStartIndex15,end])); plot(noCalib,'xunit','date'); legend('First Part','Second Part'); %% now, make a grand-unified waveform w = combine(noCalib) plot(w,'xunit','date'); legend('1-wave, no calib');

Vous aimerez peut-être aussi