画函数图像并标出最高点的坐标相关程序
t=6*pi*(0:100)/100;
y=1-exp(-0.3*t).*cos(0.7*t);
tt=y(find(abs(y)>0.05));
[ts,n]=max(tt);
t1=t(n);
plot(t,y,'r-');
grid on;
axis([0,6*pi,0.6,max(y)]);
hold on;
plot(t1,ts,'bo');
hold off;
set(gca,'xtick',[2*pi,4*pi,6*pi],'ytick',[0.95,1,1.05,max(y)]);
grid on;