matlab 中用subplot画图,为什么会丢失子图啊?有5个分量,用subplot画在一个图里面,为什么第三分量会丢失?如果把循环数改为4,只画4个,就没有问题了.求高手指点.程序如下:clc;clear all;close all;t = 0:0
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/27 14:04:43
![matlab 中用subplot画图,为什么会丢失子图啊?有5个分量,用subplot画在一个图里面,为什么第三分量会丢失?如果把循环数改为4,只画4个,就没有问题了.求高手指点.程序如下:clc;clear all;close all;t = 0:0](/uploads/image/z/7444824-24-4.jpg?t=matlab+%E4%B8%AD%E7%94%A8subplot%E7%94%BB%E5%9B%BE%2C%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BC%9A%E4%B8%A2%E5%A4%B1%E5%AD%90%E5%9B%BE%E5%95%8A%3F%E6%9C%895%E4%B8%AA%E5%88%86%E9%87%8F%2C%E7%94%A8subplot%E7%94%BB%E5%9C%A8%E4%B8%80%E4%B8%AA%E5%9B%BE%E9%87%8C%E9%9D%A2%2C%E4%B8%BA%E4%BB%80%E4%B9%88%E7%AC%AC%E4%B8%89%E5%88%86%E9%87%8F%E4%BC%9A%E4%B8%A2%E5%A4%B1%3F%E5%A6%82%E6%9E%9C%E6%8A%8A%E5%BE%AA%E7%8E%AF%E6%95%B0%E6%94%B9%E4%B8%BA4%2C%E5%8F%AA%E7%94%BB4%E4%B8%AA%2C%E5%B0%B1%E6%B2%A1%E6%9C%89%E9%97%AE%E9%A2%98%E4%BA%86.%E6%B1%82%E9%AB%98%E6%89%8B%E6%8C%87%E7%82%B9.%E7%A8%8B%E5%BA%8F%E5%A6%82%E4%B8%8B%EF%BC%9Aclc%3Bclear+all%3Bclose+all%3Bt+%3D+0%3A0)
matlab 中用subplot画图,为什么会丢失子图啊?有5个分量,用subplot画在一个图里面,为什么第三分量会丢失?如果把循环数改为4,只画4个,就没有问题了.求高手指点.程序如下:clc;clear all;close all;t = 0:0
matlab 中用subplot画图,为什么会丢失子图啊?
有5个分量,用subplot画在一个图里面,为什么第三分量会丢失?
如果把循环数改为4,只画4个,就没有问题了.求高手指点.
程序如下:
clc;
clear all;
close all;
t = 0:0.001:1;
s1 = sin(t);s2 = sin(2*t);s3 = sin(3*t);s4 = sin(4*t);s5 = sin(5*t);
s = [s1;s2;s3;s4;s5;];
i =5;
for j=1:i
if j==1; subplot(i/2+1,2,j,'Position',[0.05,0.7,0.42,0.2]);end
if j==2; subplot(i/2+1,2,j,'Position',[0.55,0.7,0.42,0.2]);end
if j==3; subplot(i/2+1,2,j,'Position',[0.05,0.4,0.42,0.2]);end
if j==4; subplot(i/2+1,2,j,'Position',[0.55,0.4,0.42,0.2]);end
if j==5; subplot(i/2+1,2,j,'Position',[0.05,0.1,0.42,0.2]);end
%subplot(i/2+1,2,j);
plot(t,s(j,:),'k'); xlabel(strcat('s',num2str(j)));
grid on;
end
matlab 中用subplot画图,为什么会丢失子图啊?有5个分量,用subplot画在一个图里面,为什么第三分量会丢失?如果把循环数改为4,只画4个,就没有问题了.求高手指点.程序如下:clc;clear all;close all;t = 0:0
你没搞清楚subplot里参数的意义,所以出错
建议自己help subplot
简单修改即可运行,程序如下:
clc;
clear all;
close all;
t = 0:0.001:1;
s1 = sin(t);s2 = sin(2*t);s3 = sin(3*t);s4 = sin(4*t);s5 = sin(5*t);
s = [s1;s2;s3;s4;s5;];
i =5;
for j=1:i
if j==1; subplot(3,2,j,'Position',[0.05,0.7,0.42,0.2]);end
if j==2; subplot(3,2,j,'Position',[0.55,0.7,0.42,0.2]);end
if j==3; subplot(3,2,j,'Position',[0.05,0.4,0.42,0.2]);end
if j==4; subplot(3,2,j,'Position',[0.55,0.4,0.42,0.2]);end
if j==5; subplot(3,2,j,'Position',[0.05,0.1,0.42,0.2]);end
%subplot(i/2+1,2,j);
plot(t,s(j,:),'k'); xlabel(strcat('s',num2str(j)));
grid on;
end