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?
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t);
[highestPeak, indexOfHighestPeak] = max(PkAmp);
[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);
plot(PkTime, PkAmp, '^r', 'MarkerFaceColor','r')
xlim([0 0.0006]);ylim([-inf inf])