How can I plot intensity as colour against a polar plot?
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a set of radial and angular values that cover a hemisphere volume. I've converted these values to cartesian coordinates and plotted it here so you can visualise (in reality I have many more points than this but it is then too dense to see):

For each of these (x, y) or (r, theta) points, I have a corresponding intensity function, F. I have tried plotting this along with the (x,y) points above with imagesc but it goes completely wrong. I have looked at colormap and pcolor etc also but I never get a plot with a hemisphere as above, it usually comes out as variations of a big blue square. Essentially what I am expecting to see is a rainbow, as my intesity functions varies radially only.
I don't mind whether I do a polar plot or convert to cartesian as above, but can anyone talk me through the steps of how to plot F as a colour?
I essentially have a radius vector R, a smaller vector A that runs from 0 to pi, and a vector F the same length as R. I have been able to convert to cartesian within a For loop such that I get x and y of equal vector sizes and also a vector of the same size F, where F basically repeats itself wherever R is unchanged.
Thanks
Risposte (1)
Raag
il 23 Feb 2025
Hi Orla,
As per my understanding the issue you are encountering with plotting intensity as colour on a polar plot can be effectively addressed by converting your polar coordinates to Cartesian coordinates and then using MATLAB's plotting functions designed for Cartesian plots. Here's a brief example:
First we need to form a mesh over radius and angle by creating a grid using your radial(R) and angular values(A):
[Rgrid, Agrid] = meshgrid(R, A);
Next we need to transform polar coordinates to cartesian coordinates:
X = Rgrid .* cos(Agrid);
Y = Rgrid .* sin(Agrid);
Next we need to build a 2D array for the intensity, so if your intensity function (F) depends only on (R), replicate it for each angle:
Fgrid = myF(Rgrid); % Example function
At last, we need to use the ‘pcolor’ function to display the intensity as colour:
figure;
pcolor(X, Y, Fgrid);
shading interp;
colormap jet;
colorbar;
axis equal;
I tested the above code and successfully generated an image that visually represents the intensity as a colour gradient, forming your desired semicircle "fan" effect.

For a better understanding of the above solution, refer to the following MATLAB documentations:
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!