how to obtain polar plot (with colorbar) with same dimensions of X Y and Z (i.e. 1XN)?
조회 수: 4 (최근 30일)
이전 댓글 표시
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: https://in.mathworks.com/matlabcentral/fileexchange/49040-pcolor-in-polar-coordinates
figure
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
clear;
PosCir = (2:1:6);
R1 = linspace(2,6.5,19);
theta1 = linspace(0,360,24);
Z1 = linspace(0,10,24)'*linspace(0,10,19);
figure
polarPcolor(R1,theta1,Z1,'Ncircles',5,'Nspokes',24,'circlesPos',PosCir); % 2,3,4,5,6
Any help will be greatly appriciated.
Thanks.
댓글 수: 0
답변 (1개)
Yukthi S
2024년 4월 19일
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Purple에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!