天天看点

MATLAB设置多个坐标轴的坐标轴范围

创建带有两个子图的图窗。在每个子图上绘制正弦波。然后,将子图的坐标轴范围设置为相同值。

x1 = linspace(0,10,100);
y1 = sin(x1);
ax1 = subplot(2,1,1);
plot(ax1,x1,y1)

x2 = linspace(0,5,100);
y2 = sin(x2);
ax2 = subplot(2,1,2);
plot(ax2,x2,y2)

axis([ax1 ax2],[0 10 -1 1])
           

继续阅读