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)
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

Answers (1)

Image Analyst
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.
  1 Comment
Talal
Talal on 26 Nov 2013
So what I'm looking for isn't var() or std(). The variability part was just so that I could put you into context of the problem. All I want to do is to identify the first peaks-created after the original peak was cutoff and convert it into bpm by identifying the difference in samples or time to the beat before it. The output from the code will be a matrix with the different bpm levels that happened in the ECG.
I'm using findpeaks to get the both first and second peaks that were created after the cutoff and then deleting the seconding peak. But for some reason i can't identify, the data is still buggy.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!