finding specific distance on a plot

I am trying to find the time it takes on the plot to go from its peak to 40 percent (or any other distance) of the way(downward). the y-axis is the data and x-axis is the time. the picture is just a sample and a random plot and it is not the real one because I have not got it yet. I know I should use findpeaks first to get the location and value of the peak but to find the minima, I only want the one which is after the peak not before as it is shown in the picture

回答(1 个)

If x-axis values id t and y-axis values is y then you can find the required time using
[maxVal maxIndex] = max(y);
index = y < 0.4*maxVal;
fortyPercentIndex = find(index(maxIndex:end), 1);
Time = t(maxIndex+fortyPercentIndex-1) - t(maxIndex)
This approach the values of the signal occurring before the peak value and find the 40% point which occurs after the peak.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by