Question #45221

,I am trying to find peaks of whole Curve or graph or ECG .... but i dont know why in my code show peaks in y vector, while i need it in whole of ecg

If someone could point me in the right direction it would be greatly appriciated.

x = load ('C:\ekg\example_ecg.txt'); y= x ( : , 2); [pks,locs] = findpeaks(y); plot (y); hold on ; plot(pks,y(locs),'rv','MarkerFaceColor','r' ); grid on
1

Expert's answer

2014-08-21T13:39:09-0400

Here is the processed text with the code fragment restored and formatted:

Problem.

I am trying to find peaks of whole Curve or graph or ECG ... but i dont know why in my code show peaks in y vector, while i need it in whole of ecg

If someone could point me in the right direction it would be greatly appreciated.


x = load ('C:\ekg\example_ecg.txt');
y = x ( :, 2);
[pks,locs] = findpeaks(y);
plot (y);
hold on ;
plot(pks,y(locs),'rv','MarkerFaceColor','r');
grid on

Solution.

You should replace plot(pks, y(locs), 'rv', 'MarkerFaceColor', 'r') with replace plot(locs, pks, 'rv', 'MarkerFaceColor', 'r'), as first argument of plot is x-coordinate and second argument is y-coordinate.

www.AssignmentExpert.com

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS