作业帮 > 综合 > 作业

请问matlab中如何将两个figure放在一起

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/09 14:39:04
请问matlab中如何将两个figure放在一起
figure(1);
x=-4:0.5:4;
y=x
[X,Y]=meshgrid(x,y);
Z=X.^2+Y.^2;
subplot(211)
mesh(Z)
h=mesh(Z)
figure(2);
m=-4:0.5:4;
n=m
[M,N]=meshgrid(m,n);
A=M.^2+N.^2;
subplot(211)
mesh(A)
h=mesh(A)
set(h,'facecolor','m','edgecolor',[1 1 1],'marker','o','markeredgecolor','b')
hold on;
每次加载后都是两个figure没有办法把他们平起来
还有如何插入文字》
我希望能在第一个figure中插入三维网格图
第二个figure中插入三维曲线图
figure(1);
x=-4:0.5:4;
y=x
[X,Y]=meshgrid(x,y);
Z=X.^2+Y.^2;
subplot(211)
mesh(Z)
h=mesh(Z)
% figure(2);
m=-4:0.5:4;
n=m
[M,N]=meshgrid(m,n);
A=M.^2+N.^2;
subplot(212)
mesh(A)
h=mesh(A)
set(h,'facecolor','m','edgecolor',[1 1 1],'marker','o','markeredgecolor','b')
hold on;
再问: 如果是希望它是两个横着的而不是竖着的怎么办?
再答: subplot换下就好了 subplot(121) subplot(122)