Filter löschen
Filter löschen

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 Ansicht (letzte 30 Tage)
%% 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)

Akzeptierte Antwort

Chunru
Chunru am 12 Apr. 2022
Bearbeitet: Chunru am 12 Apr. 2022
%% 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

Weitere Antworten (2)

raghav sikka
raghav sikka am 12 Apr. 2022
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 Kommentare
raghav sikka
raghav sikka am 12 Apr. 2022
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 am 13 Apr. 2022
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.

Melden Sie sich an, um zu kommentieren.


raghav sikka
raghav sikka am 13 Apr. 2022
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); ?

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by