我想在球坐标中绘制以下函数B(r,theta,phi)。
Bo = 1;
a = 1; % m
lambda = 1; % m^-1
syms r theta;
Br = 2*Bo*(a/r)*besselj(1,lambda*r)*cos(theta)
Bth = -Bo*(a/r)*diff(r*besselj(1,lambda*r),r)*sin(theta)
Bph = lambda*a*Bo*besselj(1,lambda*r)*sin(theta)
[Bx,By,Bz]=sph2cart(Bth,Bph,Br);
x=linspace(0,a);
y=linspace(0,a);
z=linspace(0,a);
quiver3(x,y,z,Bx,By,Bz)
当我运行上面的代码时,我收到以下警告和错误。
Warning: Using only the real component of complex data.
> In getRealData (line 14)
In quiver3parseargs (line 87)
In quiver3HGUsingMATLABClasses (line 41)
In quiver3 (line 41)
In taylor_state (line 19)
Error using quiver3 (line 43)
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use VPA.
Error in taylor_state (line 19)
quiver3(x,y,z,Bx,By,Bz)