![](https://csdnimg.cn/release/download_crawler_static/87321840/bga.jpg)
【*例 7.2.3.1-1】观察各种轴控制指令的影响。演示采用长轴为 3.25,短轴为 1.15
的椭圆。注意:采用多子图表现时,图形形状不仅受“控制指令”影响,而且受整个
图面“宽高比”及“子图数目”的影响。本书这样处理,是出于篇幅考虑。读者欲想准
确体会控制指令的影响,请在全图状态下进行观察。
t=0:2*pi/99:2*pi;
x=1.15*cos(t);y=3.25*sin(t); %y 为长轴,x 为短轴
subplot(2,3,1),plot(x,y),axis normal,grid on,
title('Normal and Grid on')
subplot(2,3,2),plot(x,y),axis equal,grid on,title('Equal')
subplot(2,3,3),plot(x,y),axis square,grid on,title('Square')
subplot(2,3,4),plot(x,y),axis image,box off,title('Image and Box off')
subplot(2,3,5),plot(x,y),axis image fill,box off
title('Image and Fill')
subplot(2,3,6),plot(x,y),axis tight,box off,title('Tight')
图 7.2.3.1-1 各种轴控制指令的不同影响
7.2.3.2 刻度、分格线和坐标框
【*例 7.2.3.2-1】通过绘制二阶系统阶跃响应,演示 MATLAB 新旧版指令在标识
图形上的差别。本例比较综合,涉及的指令知识较广。假如读者能耐心读一下指
令、实践操作一遍、再看一下例后的说明,定会有匪浅的收益。
clf;t=6*pi*(0:100)/100;y=1-exp(-0.3*t).*cos(0.7*t);
tt=t(find(abs(y-1)>0.05));ts=max(tt);
%<2>
subplot(1,2,1),plot(t,y,'r-','LineWidth',3),grid on
%<3>
axis([0,6*pi,0.6,max(y)])
%<4>
title('y=1–exp(-alpha*t)*cos(omega*t)')
%<5>
text(11,1.25,'alpha=0.3');text(11,1.15,'omega=0.7')
hold on;plot(ts,0.95,'bo','MarkerSize',10);hold off
%<7>
text(ts+1.5,0.95,['ts=' num2str(ts)])
xlabel('t -->'),ylabel('y -->')
%<9>
-2 0 2
-4
-2
0
2
4
Normal and Grid on
-2 0 2
-2
0
2
Equal
-2 0 2
-4
-2
0
2
4
Square
-1 0 1
-2
0
2
Image and Box off
-1 0 1
-1
-0.5
0
0.5
1
Image and Fill
-1 0 1
-2
0
2
Tight