How to work out BPM from ECG data

조회 수: 35 (최근 30일)
Anon
Anon 2020년 1월 9일
답변: Kashish Raheja 2021년 6월 2일
Hi,
I have managed to find the beatsperminute of my data using the findpeaks function, however I want to confirm this using the fourier transform with spectral analysis however I am not sure how to do this.

채택된 답변

Star Strider
Star Strider 2020년 1월 9일
편집: Star Strider 2020년 1월 9일
The R-wave frequency peak should be the largest peak in the absolute value of the Fourier transform (after removing any d-c offset that may be present). Use the max function (with two outputs) to detect it and its index (into the frequency vector).
Use the second (index) output of max to get the associated frequency index of the R-wave peak.
The frequency vector of the Fourier transform will be in units of cycles/(time unit).
To convert this to (time units)/cycle, simply invert it.
That should produce the average heart rate, based on R-wave frequency.
EDIT — (9 Jan 2020 at 22:48)
Using the data you posted to your other Question:
EKG = readmatrix('Anonymous ECG.csv');
L = numel(EKG);
Fs = 350/2; % Units: Hz
Ts = 1/Fs; % Units: Sec
tv = linspace(0,L,L)*Ts; % Units: Sec
Fn = Fs/2;
FTEKG = fft(EKG)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(tv , EKG)
grid
[Pks,Locs] = findpeaks(EKG,tv, 'MinPeakHeight',200);
MeanHr1 = 60/mean(diff(Locs)); % Units: 1/Min
figure
plot(Fv, abs(FTEKG(Iv))*2)
grid
[MaxFTEKG,Idx] = max(abs(FTEKG(Iv))*2);
MeanHR2 = 60/Fv(Idx); % Units: 1/Min
Note that ‘MeanHR1’ and ‘MeanHr2’ are not the same because the broadband noise present in the Fourier-transformed data (that cannot be removed witha frequency-selective filter) may obscure the actual R-wave peak in the Fourier-transformed data. They are close, however, although I suspect that ‘Fs’ is wrong (probably should be 350), because the heart rates are about half of what they should be.
  댓글 수: 2
Anon
Anon 2020년 1월 10일
Thank you but I have actually done this method with findpeaks. What I now want do is use the fft function to plot the ECG against BPM to confirm the BPM that I have found using the findpeaks method, which is where I am quite confused on.
Star Strider
Star Strider 2020년 1월 10일
Please describe what you intend by: ‘... plot the ECG against BPM ...’
It is not at all obvious what that means.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Kashish Raheja
Kashish Raheja 2021년 6월 2일
how do i display bpm using my ecg data in matlab command window? what functions and code to write? pls helpp

카테고리

Help CenterFile Exchange에서 Signal Generation and Preprocessing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by