Marking the peak of a plot automatically without having to click on it
显示 更早的评论
Hi,
Is it possible to mark the peak of a plot automatically with a command without having to to mark on each plot.
采纳的回答
更多回答(3 个)
Wayne King
2012-8-29
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 个评论
Lisa Justin
2012-8-29
编辑:Lisa Justin
2012-8-29
Tom
2012-8-29
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
2012-8-29
Tom
2012-8-29
Then Wayne's code above should work fine.
Lisa Justin
2012-8-29
Tom
2012-8-29
It should be; can you provide some sample data?
Ilham Hardy
2012-8-29
Below link is the 'how-to' display tooltip syntactically..
Happy reading,
Ilham Hardy
2012-8-29
0 个投票
4 个评论
Lisa Justin
2012-8-29
编辑:Lisa Justin
2012-8-29
Jan
2012-8-29
Then use the output of the peakfinder and a simple TEXT command.
Lisa Justin
2012-8-29
Jan
2012-8-29
See "help text" and "doc text".
Sergio Yanez-Pagans
2021-3-28
0 个投票
You could use my MATLAB File Exchange function:
Hope you find this useful!
类别
在 帮助中心 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!