I need to draw a shape in matlab help me

10 Ansichten (letzte 30 Tage)
veli
veli am 13 Dez. 2024
Bearbeitet: John D'Errico am 26 Jan. 2025
Hi,I simulate something in matlab .For those wondering, this is the cross section of the rotor in the axial compressor.. I want to draw this picture in matlab same dimensions,same angles,and same shape.Additionally, I would like to have red dots at the corners of the angled areas where they intersect with the horizontal axes. I am open to your suggestions regarding this.Of course, dashed lines also need to be drawn. The dashed lines can be in blue. My drawing needs to start from the origin point.It needs to be added to the code I will post below and changed when I change the values related to the shape in the code.
% datas
rpm = 30000; % rev/min
Pti_Pte = 1.5; % compression ratio
efficiency = 0.9; % isentropic efficiency
mass_flow_rate = 1.6; % kg/s
r1s = 0.15; % m (stator distance from rotor axis)
aspect_ratio = 0.7; % geometrical ratio
P_amb = 101325; % Pa
T0 = 288.15; % K (environmental temperature)
gamma = 1.4; % specific heat ratio of air
cp = 1005; % J/(kg·K)
load_coefficient = 0.4;
% Calculating chord length and r2h from aspect ratio
chord = r1s / aspect_ratio; % chord = span / aspect_ratio
r2h = r1s - chord; % Shroud radius
% Step 1: Isenthalpic Relations and Tt2s Calculation
Tt1 = T0; % St2-St1 = 0
Tt2s = Tt1 * (Pti_Pte ^ ((gamma - 1) / gamma));
% Step 2: Tt2 calculations
Tt2 = Tt1 + (Tt2s - Tt1) / efficiency;
% Step 3: Enthalpy change (Delta H)
delta_h = cp * (Tt2 - Tt1); % J/kg
% Step 4: Umean calculation
U_mean = sqrt(delta_h / load_coefficient); % m/s
% Step 5: Axial velocity ve Mach Number
rho = P_amb / (287 * T0); % Density, ideal gas equation
V_axial = U_mean *0.5; % Axial hız
Mach = V_axial / sqrt(gamma * 287 * T0); % Mach sayısı
% Step 6: Calculation of Angles
V_theta2 = delta_h / U_mean; %
beta1 = atan(U_mean / V_axial)* (180 / pi); % Beta1 angle (degree)
beta2 = atan((U_mean - V_theta2) / V_axial) * (180 / pi); % Beta2 angle (degree)
% % Visualization of Results
fprintf('Tt2s: %.2f K\n', Tt2s);
Tt2s: 323.54 K
fprintf('Tt2: %.2f K\n', Tt2);
Tt2: 327.47 K
fprintf('Delta H: %.2f J/kg\n', delta_h);
Delta H: 39520.86 J/kg
fprintf('Umean: %.2f m/s\n', U_mean);
Umean: 314.33 m/s
fprintf('Mach Number: %.2f\n', Mach);
Mach Number: 0.46
fprintf('V_axial: %.2f m/s\n', V_axial);
V_axial: 157.16 m/s
fprintf('V_theta2: %.2f m/s\n', V_theta2);
V_theta2: 125.73 m/s
fprintf('Beta1: %.2f derece\n', beta1);
Beta1: 63.43 derece
fprintf('Beta2: %.2f derece\n', beta2);
Beta2: 50.19 derece
  7 Kommentare
Walter Roberson
Walter Roberson am 13 Dez. 2024
You do not calculate any vectors in your code, so it is difficult to understand what you want plotted.
Your diagram has some angles labeled on it, but nothing in your code appears to be calculating approximately 100.
Your diagram has a couple of distances labeled on it, but nothing in your code appears to be calculating anything close to those distances.
We therefore have no idea how the values you calculate in your code relate to the diagram.
veli
veli am 13 Dez. 2024
Ok, I just want to draw this image independently of the code I wrote here. It is enough for you to help me with this. Forget the code, it is enough to have a different code.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John D'Errico
John D'Errico am 26 Jan. 2025
Bearbeitet: John D'Errico am 26 Jan. 2025
This is not a difficult problem. Not at all. But it is impossible for us to do it, based on having been given no information except a picture, and some unrelated code to anything you are asking. So only you can solve your problem. How?
First, Learn to use plot. Or, if you prefer, you can use line. really, you can do literally everything you are asking by merely using plot. (Multiple times, so you will need to learn to use the hold command also, to allow you to plot multiple things on the same figure.)
All you need to know is how to find the endpoints of the lines you want. That means almost all of your lines, being straight, just require you to decide on the endpoints of those lines. And since surely you know what the lines indicate and what they mean, you can draw them.
When I say learn how to use plot or line, that means you will understand how to indicate a line stype, and a line color.
That is, a solid line is indicated by '-' in the line spec. A dashed line by '--'. and a line with interspersed dashes and dots '-.' Does that make sense? If not, then read the help for plot!
If you want to put a red dot in a specific place, well, you know where you want to put it! plot can plot a dot. And you can specify wher the dot should be placed, and what color plot should use. So what is the problem?
Finally, you have a few curved arcs. They appear to be partial circles, fragments thereof. You can define a circle by the center of a circle, and the angles of the start and end points on those circles.
Break a problem too large for you to understand into a set of small problems. Learn to solve each small problem, ONE AT A TIME. Then at the end, put them all together. Solve a programming problem one byte at a time.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by