second largest peak value
45 次查看(过去 30 天)
显示 更早的评论
I'm getting the amp of second largest peak as correct but the time is wrong ?
How to obtain the second highest value X,Y from this and plot as already Y is correct ,X seems to be in wrong region?
s=load ('30827.mat');
signal(1,1:length(s.ans))=s.ans;
load t.mat;
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t);
[highestPeak, indexOfHighestPeak] = max(PkAmp);
[a(1),b2]=max(abs(hilbert(signal(1,:))));
[a2(1),b6]=max(PkAmp(PkAmp<max(PkAmp))); % to get second largest peak value
% error is the time value calcluate and plotted wrong??
Highesttime(1,:) = t(b2);
Highest2time(1,:) = t(b6);
figure;
plot(t,(signal(1,:)),t,abs(hilbert(signal(1,:))),t(b2),a(1),'ro')
hold on
plot(PkTime, PkAmp, '^r', 'MarkerFaceColor','r')
xlim([0 0.0006]);ylim([-inf inf])
grid on
hold on,plot(t(b6),a2(1),'ko')
hold off
0 个评论
采纳的回答
Alex Mcaulley
2019-6-12
To obtain the coordinates of the second peak you just need:
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t);
[~,idx] = sort(PkAmp,'descend');
PkAmp(idx(2)) %Amplitude of the second peak
PkTime(idx(2)) %Time of the second peak
更多回答(1 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!