@Star Strider Based on what you taught me in another post, I was able to find most of the QRS complex, but still, there are some that I cannot detect them. Here is the script
L = numel(ECG);
t = linspace(0, L-1, L)/1024;
[pks,locs] = findpeaks(ECG,'MinPeakDistance',2, 'MinPeakHeight',max(ECG)*0.6846);
figure
plot(t, ECG, '.-')
hold on
plot(t(locs), pks, '^k')
idxrng = locs(2) + [-6:6];
plot(t(idxrng), ECG(idxrng), '-g', 'LineWidth', 2)
hold off
grid
xlim([0 6])
ylim([-0.2 0.8])
Then I find and eliminate all identified unwanted spikes
ECGnew = ECG;
for k = 2:3:numel(locs)
idxrng = locs(k) + [-6:6];
ECGnew(idxrng) = NaN;
ECGnew = fillmissing(ECGnew, 'makima');
end
figure;
plot(t, ECGnew, '.-')
hold on
plot(t(locs), pks, '^r')
hold off
grid
It works almost great, but miss 5 QRS complexes, shown by their data tips bellow
Any idea how I can improve the code to do that? Many thanks in advance.