怎么把MATLAB生成的两个图合并在一起啊

第一个图的源代码
x=[100 200 300 400];
y=[400 500 600 700];
z2=[-400 -400 -380 -405];
z3=[-400 -400 -380 -405];
[x1,y1]=meshgrid(linspace(min(x),max(x),30),linspace(min(y),max(y),30));
z1=griddata(x,y,z,x1,y1,'V4');
figure
surf(x1,y1,z1)
hold on
contour(x1,y1,z1)

第二个图的源代码

x=[100 200 300 400];
y=[400 500 600 700];
z=[-475 -510 -440 -425];
[x1,y1]=meshgrid(linspace(min(x),max(x),30),linspace(min(y),max(y),30));
z1=griddata(x,y,z,x1,y1,'V4');
figure
surf(x1,y1,z1)
hold on
能不能详细点呢

第1个回答  推荐于2016-08-13
可以使用subplot()函数完成。
使用方法:subplot(m,n,p)或者subplot(m n p)。
subplot是将多个图画到一个平面上的工具。其中,m表示是图排成m行,n表示图排成n列,也就是整个figure中有n个图是排成一行的,一共m行,如果m=2就是表示2行图。p表示图所在的位置,p=1表示从左到右从上到下的第一个位置。
在matlab的命令窗口中输入doc subplot或者help subplot即可获得该函数的帮助信息。
示例:
在MATLAB的命令窗口依次输入以下命令:(>>不用输入)
>> t=0:0.001:1;
>> y1=sin(10*t);
>> y2=sin(15*t);
>> subplot(211)
>> plot(t,y1)
>> subplot(212)
>> plot(t,y2)
第2个回答  2010-07-07
用subplot命令,例如:subplot(1,2,1),surf(x1,y1,z1),....;
subplot(1,2,2),surf(x1,y1,z1),.....本回答被网友采纳
相似回答