matlab画三维图问题 [N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b))^2-(N2+2).^2-(N2+N2).^2+2.*(N2+2).*(N1+N2).*cos(arccos(N2.*cos(a0b)/(N2+2)-a0b));?Error using ==> mpowerInput arguments must be 2-D.哪里出错啦
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 02:29:53
matlab画三维图问题 [N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b))^2-(N2+2).^2-(N2+N2).^2+2.*(N2+2).*(N1+N2).*cos(arccos(N2.*cos(a0b)/(N2+2)-a0b));?Error using ==> mpowerInput arguments must be 2-D.哪里出错啦
matlab画三维图问题
[N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b))^2-(N2+2).^2-(N2+N2).^2+2.*(N2+2).*(N1+N2).*cos(arccos(N2.*cos(a0b)/(N2+2)-a0b));?Error using ==> mpower
Input arguments must be 2-D.哪里出错啦
matlab画三维图问题 [N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b))^2-(N2+2).^2-(N2+N2).^2+2.*(N2+2).*(N1+N2).*cos(arccos(N2.*cos(a0b)/(N2+2)-a0b));?Error using ==> mpowerInput arguments must be 2-D.哪里出错啦
[X,Y,Z] = meshgrid(xgv,ygv,zgv) replicates the grid vectors xgv, ygv, zgv to produce the coordinates of a 3D rectangular grid (X, Y, Z). The grid vectors xgv,ygv,zgv form the columns of X, rows of Y, and pages of Z respectively. (X,Y,Z) are of size numel(ygv)-by-numel(xgv)-by(numel(zgv).
[X,Y,Z] = meshgrid(gv) is equivalent to [X,Y,Z] = meshgrid(gv,gv,gv).
> 储运天天
有这种用法,建立三维meshgrid
> zero1052547116
我不是很理解你想画什么样的三维图,
但就你发出来的代码要改的部分有2点:
1、如果你不是进行矩阵运算的话,乘号、除号、次方的左边要加上点
2、arccos函数在matlab中是acos
修改如下:
[N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b)).^2-(N2+2).^2-(N2+N2).^2+2.*(N2+2).*(N1+N2).*cos(acos(N2.*cos(a0b)./(N2+2)-a0b));
至少单凭这两句不会报错了