How to work out BPM from ECG data

10 ビュー (過去 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 Center および File ExchangeSignal Generation and Preprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by