How to plot a matrix in polar coordinates with color?
3 views (last 30 days)
Hi I've been trying to plot this function in Matlab which is in polar coordinates:
V(rho, phi) = A * Sum(1/m * (rho/B)^m * sin(m*phi)) %m:1:1000:odd
A & B are constants and summation is on odd numbers from 1 to say 1000.
I wrote the following code to store a V for each rho and phi in a matrix. So the first column of this matrix is rho, the second one is phi and the third one is V. How can I plot rho and phi and represent V as the color so I'll have a 2D polar plot with color?
Andrew Newell on 25 Apr 2017
I think most approaches will involve converting the coordinates to Cartesian. Here is one approach:
r = 0.5:0.5:b;
ph = 0:0.2:2*pi;
[r,ph] = meshgrid(r,ph);
V1 = zeros([size(r) numel(n)]);
V1(:,:,ii) = A*(1/n(ii))*((r/b).^n(ii)).*sin(n(ii)*ph);
V1 = sum(V1,3);