matlab报错Z must be a matrix, not a scalar or vector,哪里出错了?代码为:x=-3:0.01:3;y=--2:0.01:2;[x,y]=meshgrid(x,y);f=(4-2.1*x.^2+(x.^4)./3).*x.^2+x.*y+(-4+4*y.^2).*y.^2;mesh(x,y,f);运行后报错:Error using mesh (line 76)Z must be a

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 22:02:09
matlab报错Zmustbeamatrix,notascalarorvector,哪里出错了?代码为:x=-3:0.01:3;y=--2:0.01:2;[x,y]=meshgrid(x,y);f=(

matlab报错Z must be a matrix, not a scalar or vector,哪里出错了?代码为:x=-3:0.01:3;y=--2:0.01:2;[x,y]=meshgrid(x,y);f=(4-2.1*x.^2+(x.^4)./3).*x.^2+x.*y+(-4+4*y.^2).*y.^2;mesh(x,y,f);运行后报错:Error using mesh (line 76)Z must be a
matlab报错Z must be a matrix, not a scalar or vector,哪里出错了?
代码为:
x=-3:0.01:3;
y=--2:0.01:2;
[x,y]=meshgrid(x,y);
f=(4-2.1*x.^2+(x.^4)./3).*x.^2+x.*y+(-4+4*y.^2).*y.^2;
mesh(x,y,f);
运行后报错:
Error using mesh (line 76)
Z must be a matrix, not a scalar or vector
Error in picture3 (line 5)
mesh(x,y,f);
请问是哪里出错了?是f=(4-2.1*x.^2+(x.^4)./3).*x.^2+x.*y+(-4+4*y.^2).*y.^2;出错了吗?

matlab报错Z must be a matrix, not a scalar or vector,哪里出错了?代码为:x=-3:0.01:3;y=--2:0.01:2;[x,y]=meshgrid(x,y);f=(4-2.1*x.^2+(x.^4)./3).*x.^2+x.*y+(-4+4*y.^2).*y.^2;mesh(x,y,f);运行后报错:Error using mesh (line 76)Z must be a
y=--2:0.01:2;
这一句多了个负号