필터 지우기
필터 지우기

How to draw concentric arcs in a 120 degree sector and the contour plots for mass flux of water spray in each concentric compartment ?

조회 수: 1 (최근 30일)
%% for polar plot
theta = linspace(0,120,8); % angle division
rho = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values
polarplot(theta,rho)
%% to plot concentric arcs
n = 120;
r = 0:0.01:0.75;
r=r';
theta = pi*(0:(n))/180;
Y = r*cos(theta);
X = r*sin(theta);
plot(X,Y)
%% contour plots for mass flux density
x1 = 0.05:.10:0.75; % radius (in m) at which concentric arcs are drawn for 120 ° sector
x2 = linspace(0,120,8); % angle division
[X1, X2]= meshgrid(x1,x2);
z = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values
figure
contourf (x1, x2, z)

채택된 답변

Chunru
Chunru 2022년 4월 12일
편집: Chunru 2022년 4월 12일
%% for polar plot
theta = linspace(0,120,8); % angle division
rho = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values
polarplot(deg2rad(theta),rho) % use radian for theta
%% to plot concentric arcs
% (change the order of theta and r)
n = 120;
r = 0:0.01:0.75;
theta = deg2rad(0:n);
X = cos(theta') * r;
Y = sin(theta') * r;
plot(X,Y); axis equal
%% contour plots for mass flux density
% z = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values
% z should be compatible with x1 and x2, e.g.
Z = sqrt(X.^2 + Y.^2);
figure
contourf (X, Y, Z); axis equal
%% For data r and z
r = [0.05, 0.15,0.25,0.35,0.45,0.55,0.65,0.75]; %sector radius
z1 = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009];
X = cos(theta') * r;
Y = sin(theta') * r;
Z = repmat(z1, [length(theta), 1]);
figure
contourf (X, Y, Z, 5); axis equal

추가 답변 (2개)

raghav sikka
raghav sikka 2022년 4월 12일
Thanks for reply ! I forgot to convert in radian..
I am afraid the rho vector (mass flux values) is defined based on radius 'r' not theta as like in polar plot such that first value 0.000959931) corresponds to (first) inner most concentric sector of radius 0.05 m and so on...
rho = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values
The first (inner) concentric sector is 0.05 m in radius, then 0.10 m difference until radius r = 0.75 m.
  댓글 수: 7
raghav sikka
raghav sikka 2022년 4월 12일
Thank you.
yes, I agree it needs more data to make it smoother.
But we have 8 levels only. can we plot only 8 levels in contour? also, why there is a gap at center region (white) ?
How to replicate it for other two sectors to make it a full concentric circle (360 deg)?
Chunru
Chunru 2022년 4월 13일
If you do want to use exactly 8 levels for the similar data you have provided, you can consider to use "patch". doc patch for more info.
The center region white gap is due to no data along that part (rho does not start from 0)
For full concentric plot, you need to make theta 360 deg. For three sectors, you can hold on and plot other two sectors on same plot.

댓글을 달려면 로그인하십시오.


raghav sikka
raghav sikka 2022년 4월 13일
r = [0.05, 0.15:0.1:0.75]; % gives 8 sectors
rho = [0.000959931, 0.051254502, 0.025132741, 0.099483767, 0.174300215, 0.134972129, 0.0429351, 0.015068009]; % mass flux values .... why still gap at the center?
How to use patch(x,y) for each concentric sector (r=0.05,0.15:0.1:0.75); ?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by