首页 > 解决方案 > 如何在 MATLAB 中绘制极坐标函数?

问题描述

我想在 MATLAB 中将给定函数绘制为极坐标 3D 图

功能

使用代码:

  syms r x y k z
[ph,r] = meshgrid((0:5:360)*pi/180,0:.5:10);
[X,Y] = pol2cart(ph,r);
Z = X+i*Y;
J = besselj(5,r);
u = symsum(1i.^(-k).*J.*exp(1i*k*ph),k,-5,5);
h = polar([0 2*pi], [0 1]);
delete(h)
hold on
contour(X,Y,real(u),30)
axis equal
xlabel('Real','FontSize',14);
ylabel('Imaginary','FontSize',14);

然而,我只得到等高线图,但没有添加命令的极坐标图:

surf(X,Y,abs(u))
hold on
surf(X,Y,zeros(size(X)))
hold off

如何获得表面的极坐标 3D Plot?

谢谢!

标签: matlabplot

解决方案


推荐阅读