how to find max and min value within a certain range of a plot

Hi, I'm using plot function to identify second wave and measure it's frequency, so is there any way for me to get timeseries of the max and min value within the second wave range directly without have to search them in csv files. Thank you.

2 commentaires

Do you havethe mat file?
This is the plot file and want to know how to find the timeseries of first upper peak and second lower peak.

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 12 Avr 2023
Use the bounds function on the specific plot argument.

3 commentaires

EDIT — (13 Apr 2023 at 17:34)
I am not certain what you want. This provides the peak values, locations, and frequencies of each peak, valley, and complete wave. (The frequencies are not printed on the plot because there is not room enough for them.)
I = openfig('tek0000ALL.fig');
grid
Lines = findobj(I, 'Type','line');
xv = Lines.XData;
yv = Lines.YData;
Tss = [mean(diff(xv)) std(diff(xv)) median(yv)];
Fs = 1/Tss(1);
[pks,plocs] = findpeaks(yv, 'MinPeakProminence',max(yv)/4);
[vys,vlocs] = findpeaks(-yv, 'MinPeakProminence',max(-yv)/4);
zxix = find(diff(sign(yv-median(yv))));
rtbl = find(zxix>max(vlocs),1,'first');
zxix = zxix(1:rtbl);
periodv = diff(xv(zxix));
pervbfr = buffer(periodv,2);
freqv = 1./sum(pervbfr) % Frequency Of Each Complete Wave
freqv = 1×4
1.0e+06 * 0.8039 2.8090 1.2136 0.5869
figure
plot(xv, yv)
hold on
hold off
grid
yline(median(yv))
text(xv(plocs), pks, compose(['(%.2fx10^{-5}, %.3f)'],[xv(plocs)*1E5; pks].') )
text(xv(vlocs), -vys, compose(['(%.2fx10^{-5}, %.3f)'],[xv(vlocs)*1E5; -vys].') )
.
Thank you!
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by