Marking the peak of a plot automatically without having to click on it
Show older comments
Hi,
Is it possible to mark the peak of a plot automatically with a command without having to to mark on each plot.
Accepted Answer
More Answers (3)
Wayne King
on 29 Aug 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 Comments
Lisa Justin
on 29 Aug 2012
Edited: Lisa Justin
on 29 Aug 2012
Tom
on 29 Aug 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
on 29 Aug 2012
Tom
on 29 Aug 2012
Then Wayne's code above should work fine.
Lisa Justin
on 29 Aug 2012
Tom
on 29 Aug 2012
It should be; can you provide some sample data?
Ilham Hardy
on 29 Aug 2012
Below link is the 'how-to' display tooltip syntactically..
Happy reading,
Ilham Hardy
on 29 Aug 2012
0 votes
4 Comments
Lisa Justin
on 29 Aug 2012
Edited: Lisa Justin
on 29 Aug 2012
Jan
on 29 Aug 2012
Then use the output of the peakfinder and a simple TEXT command.
Lisa Justin
on 29 Aug 2012
Jan
on 29 Aug 2012
See "help text" and "doc text".
Sergio Yanez-Pagans
on 28 Mar 2021
0 votes
You could use my MATLAB File Exchange function:
Hope you find this useful!
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!