How do I find the heart rate variability if I have ECG data that's been cutoff at a specific threshold.
24 views (last 30 days)
Show older comments
I have a set of raw ECG data that needs analysis. The problem is that when acquiring the data the person in charge made a mistake and set a cutoff threshold cutting of the peaks of the R wave.
I've tried using common heart rate scripts but they tended not to work. I'v also tried implementing a variation of findpeaks but i'v ended up with very wrong results. So what i'v basically tried till now is take the first peak(seeing as the cutoff resulted in forming 2 peaks) and comparing it with the next "first peak". The results are still off though.
Does anyone have a suggestion with regards to how to approach this problem?
Code:
if true
function [ pkLoc, pkAmp, pkDistance, hr ] = peakFinder( input, amplitude, sampRate )
minimumDistance = sampRate*0.2; %Distance is related to sampling rate.
minimumHeight = amplitude*10^-4; %Amplitude in scale.
pkDistance = [];
[ pkAmp, pkLoc] = findpeaks(input, 'minpeakheight', minimumHeight);
for i = 2: length(pkLoc)
if (input(1,pkLoc(1,i)-1) == -inf)
pkLoc(i) = 0;
pkAmp(i) = 0;
end
end
pkLoc(pkLoc == 0) = [];
pkAmp(pkAmp == 0) = [];
for i = 2: length(pkLoc)
pkDistance(i-1) = pkLoc(i-1)- sum(pkDistance);
end
hr = (60*sampRate./pkDistance);
hr = int8(hr);
end
end
1 Comment
Nina Kupper
on 20 Sep 2019
You can use the s point in the ecg throughout to replace the r's. Renders same hr and hrv
Answers (1)
Image Analyst
on 25 Nov 2013
You can't find the variability of all your data if all you have is data above some threshold value (so that data are missing). You can find the variability of what you do have, if you want that. But you have to define what you call variability - is it var() or std()???? Also, I don't know why the peak finder code is there because it doesn't seem to have anything to do with your question "How do I find the heart rate variability...." Is the variability in the signal values themselves? Or in the spacing between heartbeats? Please clarify.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!