matlab画三维图问题 求高手解救!!!
[N1,N2,a0b]=meshgrid(linspace(0,100));val=(N1.*cos(a0b))^2-(N2+2).^2-(N2+N2).^2+2.*(N...
[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. 哪里出错啦 求高手解决!!! 展开
Input arguments must be 2-D. 哪里出错啦 求高手解决!!! 展开
2个回答
展开全部
[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));
至少单凭这两句不会报错了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询