How do I find the values of local maximas between certain points on a graph using the "findpeaks" function?
Show older comments
Say I used the "findpeaks" function to find the local maximas in my data as follows which produces the following graph:
t = 0:0.05:25; % values for time
y = cos(3*t);
[pks,locs] = findpeaks(y);
plot(t,y,t(locs),pks,'rv','MarkerFaceColor','r');
grid on; title('Position -vs- Time'); xlabel('Time'); ylabel('Position');

Obviously in this instance, all the local maximas would have the same values for position. However, for the sake of argument, say I only wanted to find the values for the position of the local maximas between time = 10 and time = 25, how would I go about doing this without changing the values for 't' which I initially used to plot the graph?
Any help appreciated!
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!