How can I plot 3D polar plot in MATLAB

Illustration
john pappachen - 2023-05-04T10:02:11+00:00
Question: How can I plot 3D polar plot in MATLAB

I have three values, azimuth, elevation and corresponding data points. is it possible to plot 3D polar plot using this three values. and 1 want to show the third value in colour. I am looking forward to hear your suggestions. A sample data is: file name : data.txt   318.1 8.68 19.43 317.15 8.86 22.48 316.19 9.05 23.5 315.23 9.23 25.54 314.28 9.41 28.53 313.32 9.6 31.59 312.36 9.78 35.61 311.4 9.96 36.67 310.44 10.15 37.71 309.48 10.33 41.71 308.51 10.52 43.78 307.55 10.7 48.83 306.59 10.89 49.88 305.62 11.07 51.95 304.66 12.26 53.96 303.69 12.45 54.01 302.73 13.63 58.04 301.76 13.82 63.09 300.79 14.01 65.1 299.83 14.19 60.12 298.86 15.38 58.14 297.89 16.57 57.17 296.92 16.76 54.19 295.94 17.94 50.21 294.97 18.13 48.24 293 19.32 46.27 292.03 19.51 45.31 291.05 20.7 42.33 290.08 19.89 40.36 289.1 19.07 39.38 288.12 18.26 35.43 287.15 17.45 33.45 286.17 16.64 32.46 285.19 15.83 31.48 286.21 15.02 29.49 285.23 14.80 25.52 284.25 14.40 20.52 283.26 13.59 19.54 282.28 12.79 15.58 281.3 12.08 13.62 280.31 11.17 12.64  

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

 

There may be File Exchange contributions for 3D polar plots. It is possible to use the sph2cart function to plot your data in 3D, however in Cartesian coordinates, so losing the angle data in the plot.
A 2D polar plot with the values in scaled colour is not difficult to code using the polarscatter function (in R2016b and later):
 
D = load('data.txt');
Az = D(:,1);
El = D(:,2);
Rd = D(:,3);

cn = ceil(max(El));                                             % Number Of Colors
cm = colormap(jet(cn));

figure(2)
polarscatter(Az*pi/180, Rd, [], cm(fix(El),:), 'filled')
grid on

Tbis colours the points by the value of El. Here, since the maximum El value defines 21 colours, no scaling of it is needed. In other situations (very high or very low maximum values), scaling would be necessary to get adequate colour definition.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!