作业帮 > 综合 > 作业

matlab中怎么对下面的程序进行二维插值并画出三维视图呢?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/22 08:50:17
matlab中怎么对下面的程序进行二维插值并画出三维视图呢?
[x,y]=meshgrid(-2:1:2);
t=2;
Z=[(sin(t))^3 t^2 sin(t) cos(t) (sin(t))^2;t^2 sin(t) (cos(t))^4 cos(t) (sin(t))^2;t sin(t) cos(t) t^2 (sin(t))^2;sin(t) (cos(t))^3 t^2 (sin(t))^2 cos(t);(cos(t))^3 sin(t) t^2 (sin(t))^2 cos(t)];
surf(x,y,Z);
接着你的代码往下写:

[x1,y1]=meshgrid(-2:0.1:2);
z1 = interp2(x,y,Z,x1,y1);
figure; 
surf(x1,y1,z1);