Marking the peak of a plot automatically without having to click on it
Mostra commenti meno recenti
Hi,
Is it possible to mark the peak of a plot automatically with a command without having to to mark on each plot.
Risposta accettata
Più risposte (3)
Wayne King
il 29 Ago 2012
Do you know the value of the peak?, then yes, it's easy.
x = randn(100,1);
[val,I] = max(x);
plot(x); hold on;
plot(I,val,'r^','markerfacecolor',[1 0 0])
7 Commenti
Lisa Justin
il 29 Ago 2012
Modificato: Lisa Justin
il 29 Ago 2012
Tom
il 29 Ago 2012
are you looking for one single maximum value, or are you looking for local peaks (i.e. the peaks of a sine wave where there can be several per plot)?
Lisa Justin
il 29 Ago 2012
Tom
il 29 Ago 2012
Then Wayne's code above should work fine.
Lisa Justin
il 29 Ago 2012
Tom
il 29 Ago 2012
It should be; can you provide some sample data?
Ilham Hardy
il 29 Ago 2012
Below link is the 'how-to' display tooltip syntactically..
Happy reading,
Ilham Hardy
il 29 Ago 2012
0 voti
4 Commenti
Lisa Justin
il 29 Ago 2012
Modificato: Lisa Justin
il 29 Ago 2012
Jan
il 29 Ago 2012
Then use the output of the peakfinder and a simple TEXT command.
Lisa Justin
il 29 Ago 2012
Jan
il 29 Ago 2012
See "help text" and "doc text".
Sergio Yanez-Pagans
il 28 Mar 2021
0 voti
You could use my MATLAB File Exchange function:
Hope you find this useful!
Categorie
Scopri di più su Descriptive Statistics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!