%功能:子图函数subplot使用实例
clf;
t=(pi*(0:1000)/1000)';
y1=sin(t);
y2=sin(10*t);
y12=sin(t).*sin(10*t);
subplot(2,2,1),
plot(t,y1);
axis([0,pi, -1,1])
subplot(2,2,2),
plot(t,y2);
axis([0,pi,-1,1])
subplot('position',[0.2,0.05,0.6,0.45])
plot(t,y12,'b-',t,[y1,-y1],'r:');
axis([0,pi,-1,1])
开发工具:MATLAB 2022b
微信Alt+A截屏工具
本程序摘自《MATLAB 2008图形与动画实例教程》