Clear Filters
Clear Filters

how to obtain polar plot (with colorbar) with same dimensions of X Y and Z (i.e. 1XN)?

10 views (last 30 days)
I wish to produce a polar plot with with colorbar
PosCir = (2:1:6);
R = 2:0.25:6.5; % size = 1x19
theta = randi(360,1,19); % size 1x19; non-monotonically varying increase/decrease
Z = rand(1e5,1,19); % size 1x19
now is it possible to make a polar plot with a patch showing color of Z corresponding to eaach theta and R value?
I have used the following function available at:
polarPcolor(R,theta,Z,'Ncircles',5,'Nspokes',24,'circlesPos',PosCir); % 2,3,4,5,6
Below, is the ideal example case, but I am dealing with different dimensions of variable. So, it gives error.
%% example case
PosCir = (2:1:6);
R1 = linspace(2,6.5,19);
theta1 = linspace(0,360,24);
Z1 = linspace(0,10,24)'*linspace(0,10,19);
polarPcolor(R1,theta1,Z1,'Ncircles',5,'Nspokes',24,'circlesPos',PosCir); % 2,3,4,5,6
Any help will be greatly appriciated.

Answers (1)

Yukthi S
Yukthi S on 19 Apr 2024
Hi Megha
I understand that you are getting some errors while trying to use “polarPcolor” in the code. There can be two possibilities for this.
One would be ,since “polarPcolor” is a custom function ,you should ensure that the function file is added to the MATLAB path before running the code.
The second reason can be if you are using MATLAB Online, upload the function file to MATLAB Drive and add it to the path.
I tried the code provided by you at my end and I got the below plot :
Hope this resolves the issue!


Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!