matlab surf用法xgrid=linspace(0,100,10000);ygrid=linspace(0,100,10000);[x,y]=meshgrid(xgrid,ygrid);z=(3236*x.^2*y+1109*x.^2+5416*x*y.^2+6616*x*y+1445*x+2199*y.^2+1990*y+318)./[1000*(2*x+1)*(2*y+1)*(x+y+1)];surf(x,y,z);
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 21:59:56
matlab surf用法xgrid=linspace(0,100,10000);ygrid=linspace(0,100,10000);[x,y]=meshgrid(xgrid,ygrid);z=(3236*x.^2*y+1109*x.^2+5416*x*y.^2+6616*x*y+1445*x+2199*y.^2+1990*y+318)./[1000*(2*x+1)*(2*y+1)*(x+y+1)];surf(x,y,z);
matlab surf用法
xgrid=linspace(0,100,10000);
ygrid=linspace(0,100,10000);
[x,y]=meshgrid(xgrid,ygrid);
z=(3236*x.^2*y+1109*x.^2+5416*x*y.^2+6616*x*y+1445*x+2199*y.^2+1990*y+318)./[1000*(2*x+1)*(2*y+1)*(x+y+1)];
surf(x,y,z);
matlab surf用法xgrid=linspace(0,100,10000);ygrid=linspace(0,100,10000);[x,y]=meshgrid(xgrid,ygrid);z=(3236*x.^2*y+1109*x.^2+5416*x*y.^2+6616*x*y+1445*x+2199*y.^2+1990*y+318)./[1000*(2*x+1)*(2*y+1)*(x+y+1)];surf(x,y,z);
三维曲面(色)图
surf 和 surfc 是通过矩形区域来观测数学函数的函数.surf和surfc能够产生由X、Y、Z指定的有色参数化曲面,即三维有色图.
当x = 1:n、y = 1:m,并且[m,n]=size(Z)时,surf(Z)会产生一个矩阵Z的z部分的三维遮罩层,这里Z是一个定义在几何矩形网格内的单值函数.
surf(X,Y,Z)同样产生矩阵Z的有色遮罩层,XY可以是有xy定义的向量或矩阵
surf(X,Y,Z,C)是产生一个由C定义颜色的矩阵Z的有色遮罩层
例子
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
figure(1)
surf(z);
figure(2)
surf(x,y,z);
axis equal
figure(3)
surf(x,y,z,c);
colormap([1 1 0; 0 1 1])
axis equal