用Matlab画图时,除了借助图上图来对比查看,还可以借助多子图来对比查看。
绘制多字图的关键命令:subplot
subplot(m, n, p) divides the current figure into an m-by-n grid and creates axes in the position specified by p.
1、纵向对比多子图
Matlab代码如下:
程序运行结果:
2、横向对比多子图
Matlab代码如下:
程序运行结果:
3、交叉对比多子图
Matlab代码如下:
程序运行结果:
需要注意的是,用subplot将当前figure分成 m x n 个坐标轴时,坐标轴的计数是以行优先的。
The first subplot is the first column of the first row, the second subplot is the second column of the first row, and so on.
相关阅读