How can i plot peaks?
显示 更早的评论
Hi, first off all i want to excuse me if a post wrong. I'm new on mathworks and i've got a big problem.I want to make a GUI in matlab with axes and i don't know how to put on graphic the values of the maximum and minimum peaks. A bit of program look like this:
S=0.275
t=0:0.1:6;
n=10/64;
omega=(2*pi*n)
d=S*(1-cos(omega*t))/2
plot(handles.axes1,omega*t,d)
What i want is to show me on the axes the maximum and minimum values for "d" whatever values i've got to put on S,t,omega etc. Hope you can help me. Thx alot and excuse me for english issues.
采纳的回答
更多回答(3 个)
Mahdi
2013-4-24
MaxValue=max(d);
IndexMaxValue=find(d==MaxValue)
% Creates a red circle where the max is.
plot(handles.axes1, omega.*t(IndexMaxValue), MaxValue, 'ro')
You can follow the same logic for the min value, just use min(d) instead.
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!