MATLAB为什么不显示子图title

问题描述:

MATLAB为什么不显示子图title
源代码如下:
求更改建议及不显示原因
t=0:0.1:10;
x=sin(t);
subplot(2,2,1);
N=1;
title('N=1')
y=sin(N*t+3);
plot(x,y,'--r','LineWidth',2)
grid on
%加网格
subplot(2,2,2);
N=2;
title('N=2')
y=sin(N*t+3);
plot(x,y,'-.b','LineWidth',2.5)
grid on
%加网格
subplot(2,2,3);
N=3;
title('N=3')
y=sin(N*t+3);
plot(x,y,':y','LineWidth',3)
grid on
%加网格
subplot(2,2,4);
N=4;
title('N=4')
y=sin(N*t+3);
plot(x,y,'--r','LineWidth',2)
grid on
%加网格
1个回答 分类:综合 2014-12-14

问题解答:

我来补答
两种更改意见:
1、将每个title语句放到grid on后边
2、在每个title后加hold on
原因个人认为是title语句起作用后由于没有hold on后边的plot语句有将hold命令的图像覆盖了,所以要么加hold on,要么后移title语句
 
 
展开全文阅读
剩余:2000