MATLAB Answers

Automatic ECG peak detection with FFT

19 views (last 30 days)
Charles Morgan
Charles Morgan on 9 Jan 2020
Commented: Cris LaPierre on 9 Jan 2020
Hi everyone,
I am trying to do an automatiuc detection of Hearth Rate with ECG sample.
I try to use FFT and IFFT, and a FIR filtered to eliminate low frequencies (50Hz) but after, I can't detect peaks of the signal.
I need to find locals maxima of my set of data but I don't know how to do that.
I will be grateful if you can help me with this problem.
load ECG109;
ECG = ECG109;
fresult(1 : round(length(fresult)*5/Fe))=0;
fresult(end - round(length(fresult)*5/Fe) : end)=0;
corrected = real(ifft(fresult)); % IFFT
% Low frequencies filter (50Hz)
Fn = Fe/2;
FIR = fir1(48,[49.7 50.3]/Fn,'stop');
ECG_filtered = filter(FIR,1,corrected);
peaks = findpeaks(ECG_filtered,'DoubleSided')

  1 Comment

Cris LaPierre
Cris LaPierre on 9 Jan 2020
There's somethign wrong with you mat file. I get the following error when I try to load it.
Error using load
Unable to read MAT-file C:\Users\...\ECG109.mat. Not a binary MAT-file. Try load -ASCII to read as text.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 9 Jan 2020
Do you have the Signal Processing Toolbox? If so, look into the findpeaks function.


Sign in to comment.

Sign in to answer this question.

Translated by