matlab使用插值进行着色处理Z must be a matrix,not a scalar or vectorz应该怎么改?>> [x,y]=meshgrid(-5:0.1:5);>> z=5;>> surf(x,y,z);shading interp;Error using surf (line 75)Z must be a matrix,not a scalar or vector
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/12 06:28:57
matlab使用插值进行着色处理Z must be a matrix,not a scalar or vectorz应该怎么改?>> [x,y]=meshgrid(-5:0.1:5);>> z=5;>> surf(x,y,z);shading interp;Error using surf (line 75)Z must be a matrix,not a scalar or vector
matlab使用插值进行着色处理Z must be a matrix,not a scalar or vector
z应该怎么改?
>> [x,y]=meshgrid(-5:0.1:5);
>> z=5;
>> surf(x,y,z);shading interp;
Error using surf (line 75)
Z must be a matrix,not a scalar or vector
matlab使用插值进行着色处理Z must be a matrix,not a scalar or vectorz应该怎么改?>> [x,y]=meshgrid(-5:0.1:5);>> z=5;>> surf(x,y,z);shading interp;Error using surf (line 75)Z must be a matrix,not a scalar or vector
z应该这样写:z=5*ones(size(x));
surf和mesh中x,y,z必须是同样维度的矩阵.
完整代码如下:
clear
clc
[x,y]=meshgrid(-5:0.1:5);
z=5*ones(size(x));
surf(x,y,z);
shading interp;
运行出来的结果如下: