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

2 次查看(过去 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