如何在MATLAB中绘制柱坐标系中的函数a=a(r,θ)?

如何在MATLAB中绘制柱坐标系中的函数a=a(r,θ)?,matlab,Matlab,a是一个包含微分方程数值解的100x100矩阵。函数a(r,θ)在r和θ方面没有明确的形式。我尝试使用网格网格为r和θ创建网格,然后使用pol2cart将问题转换为笛卡尔坐标系。但这不起作用,因为a不能用r和θ表示 [R, Theta]=meshgrid(r,theta); [x,y,A]=pol2cart(Theta,r,a); contourf(x,y,A,50,'linecolor','none'); 看来这个错误可能只是资本化的问题r'->“r”在我的测试实现中生成了极坐标等高线图 %

a是一个包含微分方程数值解的100x100矩阵。函数a(r,θ)在r和θ方面没有明确的形式。我尝试使用网格网格为r和θ创建网格,然后使用pol2cart将问题转换为笛卡尔坐标系。但这不起作用,因为a不能用r和θ表示

[R, Theta]=meshgrid(r,theta);
[x,y,A]=pol2cart(Theta,r,a);
contourf(x,y,A,50,'linecolor','none');

看来这个错误可能只是资本化的问题r'->“r”在我的测试实现中生成了极坐标等高线图

% Setting up the plotting ranges
r = 0:99;
theta = linspace(0,2*pi,100);
[R, Theta]=meshgrid(r,theta);

a = R + Theta; % Your numerical solution goes here

[x,y,A]=pol2cart(Theta,R,a); % <- Your error is here?
contourf(x,y,A,50,'linecolor','none');
%设置打印范围
r=0:99;
θ=linspace(0,2*pi,100);
[R,θ]=网格网格(R,θ);
a=R+θ;%你的数值解在这里
[x,y,A]=pol2cart(θ,R,A);%