How do I find Peaks in Plotted data?
21 views (last 30 days)
Show older comments
I have plotted some data for a simply damped object which has been displaced and is allowed to oscillate freely. The data plotted shows a sinusoidal behaviour.
I would like to find the peaks and have tried all of the recommended codes on Mathworks.
I have used [pks,locs]=findpeaks[Time, Displacement] I have also tried this in various different ways but have had no joy.
Hope you can help !
filename='Test_Results_19.xls'
ColumnA= xlsread(filename,'A2:A2088')
ColumnB= xlsread(filename,'B2:B2088')
B=ColumnB
A=ColumnA
%%Logarithmic Decrement Method
Time=ColumnA
Displacement=ColumnB
plot(Time,Displacement,'g'),grid on
findpeaks(Time,Displacement)
<</matlabcentral/answers/uploaded_files/93569/peaks.JPG>>
0 Comments
Answers (1)
Star Strider
on 6 Nov 2017
Using findpeaks is the correct approach. You need to reverse the arguments to get the result you want.
Try this:
[PkAmp, PkTime] = findpeaks(Displacement,Time);
The peak amplitudes are in the ‘PkAmp’ vector, and the corresponding times in the ‘PkTime’ vector.
4 Comments
Star Strider
on 7 Nov 2017
As always, my pleasure!
If my Answer helped you solve your problem, please Accept it!
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!