用MATLAB画一曲线,怎么找到最大最小值,然后标出(x,y)的值

比如

x=-10:0.1:10

y=x^2

plot(x,y)

找到最小值,然后在图像上标出来

x=-10:0.1:10;
y=x.^2;
plot(x,y)
hold on
plot(x(find(y==min(y))),min(y),'r*')
text(x(find(y==min(y)))-1,min(y)+5,'最小值')
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-01-19
t = 0:10;
y=@(t)heaviside(t-5);
ezplot(y,[0 10]) ;

title('方法一')

x=0:.1:10;
y=(x>5).*ones(1,length(x));
figure;
plot(x,y);
axis([0 10 -0.5 1.5]);
title('方法二');

附图本回答被提问者采纳