I'm using curve length transform to detect QRS complex.I used below code for that.The output LT is having two peaks instead of one. I'm not getting where it went wrong
3 views (last 30 days)
Show older comments
Bharathi Surisetti
on 14 Oct 2015
Commented: Star Strider
on 16 Oct 2015
clear all
close all
load 'C:\cygwin\home\kuma\new16265.txt'; % record 16265
s=(new16265(:,2))';
fs=128;
N=length(s);
x=s;
[b,a] = butter(3,[5 15]/(fs/2));
y = filtfilt(b,a,x);
y=y/max(abs(y));
w=128;
c=5;
for i=2+w:N
for k=i-w:i
d=y(k)-y(k-1);
l(k)=sqrt(c+d^2);
end
L(w,i)=sum(l(k));
end
0 Comments
Accepted Answer
Star Strider
on 14 Oct 2015
Even when I looked up the paper that seems to describe what you’re doing, it’s difficult to figure out your code. The only problem that I see is:
L(w,i)=sum(l(k));
since it is after the ‘k’ loop, so it is summing only the last element of that vector, essentially being sum(l(end)). I would (1) either put it inside the ‘k’ loop, or (2) leave it where it is and change it to:
L(w,i)=sum(l);
I don’t know if this will solve your problem (because I can’t run your code to test it) but either change will result in the correct values for ‘L’.
10 Comments
Star Strider
on 16 Oct 2015
They’re preprocessing the EKG to window the QRS complex before they do the line integral on it. That seems to me to defeat the purpose of doing the line integral.
You can threshold the peaks my code provides to identify the QRS occurrences and duration. If that doesn’t produce appropriate results, you may have to tweak my code. I would adjust ‘w’ within the range I mentioned earlier, and perhaps introduce the scaling parameter ‘C’ in place of ‘Ts’ in the ‘l’ calculation, to narrow the peaks my code produces. That may produce narrow enough peaks to allow you to identify both the QRS complex occurrences and widths with reasonable accuracy.
More Answers (0)
See Also
Categories
Find more on Measurements and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!