필터 지우기
필터 지우기

Histogram with circular bars

조회 수: 4 (최근 30일)
Joanna Smietanska
Joanna Smietanska 2019년 10월 10일
답변: Bjorn Gustavsson 2019년 10월 10일
Hi, I have data grouped into 100x3 and 100x4 matrices. Each matrix column refers to different types of measured angles, e.g. alpha, beta and so on. I prepared single polar histogram for first angle:
A = [160 65 200; 145 75 225; 160 50 250; 120 70 220]; % shortened version of one of 3-column matrices
[N, bin] = histcounts(A(:,1), 10, 'Normalization','probability');
minData = min(min(N));
maxData = max(max(N));
f = figure;
p1 = polarhistogram(A(:,1),10, 'Normalization','probability','FaceColor', 'b');
colorbar;
caxis([minData maxData]);
How can I plot content of each matrix into one polar probability histogram with concentric bins respective for each angle? I can't find out how to add other circular bins for subsequent angles. I would like to create something similar to this plot:
I will be very grateful for any advice and help.

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2019년 10월 10일
I would do something like this:
edges = 0:15:360;
N_all(1,:) = histcounts(M1,edges);% Put one histogram per row into N_all
N_all(2,:) = histcounts(M2,edges);
N_all(3,:) = histcounts(M3,edges);
N_all(4,:) = histcounts(M4,edges);
N_all(5,:) = N_all(4,:); % Replicate the last row
R = 1:5; % some arbitrary radial coordinates
theta = edges*pi/180; % angles in radians
try
polarPcolor(theta*180/pi,R,N_all),shading flat
catch
disp('You can find the polarPcolor function on the file exchange')
[theta,R] = meshgrid(theta,R);
pcolor(R.*cos(theta),R.*sin(theta),N_all),shading flat
end
HTH

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by