Help to build the logic to plot peak vs time
Show older comments
t = 0:0.1:10;
y = 15*sin(pi*t);
[a,b]=peakdetection(y,0.5);
if y(i) == a;
y(i) = y(i);
else
y(i)= 0;
end
In this i want to detect peak and valley from any type of signal. After detecting i want to plot only peak against time. All other value of y (except peak) should be zero as per my requirement.
I will appreciate if anybody help me to build this logic. I tried to use if loop but it is given error
??? Subscript indices must either be real positive integers or logicals.
Error in ==> Untitled at 7
if y(i) == a;
Regards
Jeevan Patil
Accepted Answer
More Answers (1)
Jeevan Patil
on 21 Jan 2012
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!