area mach relation find M(x)

I'm trying to find M(x), mach number, with a range of 1 to 15 but in 0.2 intervals. I only know A_star, Pt, Tt, Pinf, gamma, and R. Not A(x)/A_star, the area ratio. So, I'm confused on how to find M(x) without the full area ratio.
For my code I have this so far. Gamma is known, and so is A_star. I need to find Area ratio so I can find A(x).
%M(x), ranging from 1 to 15
%simply eq.
g1 = g-1;
g2 = g+1;
%Find A(x) based on M(x)
M = 1:02:15;
Aratio = zeros(size(M));
for i = 1:M
Aratio(i) = (1/M(i))*(((2/g2)*(1+(g1/2)*M(i)^2))^((1/2)*(g2/g1)));
end

7 commentaires

Can you please show source formulas or equations?
You don't need to use for loop since you defined M
M = 1:02:15;
Aratio = 1./M.*( (2/g2*(1+g1/2*M.^2)).^(1/2*g2/g1) );
Hailey
Hailey le 2 Sep 2019
Here is the equation. Would a for loop be easiest for this? I know the intrevals for M(x), just need to get the ratio per each intreval of M(x). Thank you! I hope that made sense.
darova
darova le 2 Sep 2019
You can't find a solution if you have 2 uknown variables with 1 equation
Maybe you have more data?
Hailey
Hailey le 3 Sep 2019
I have M(x) though. It's a range of numbers. I just don't know how to find the ratio value per M(x) range. Thank you!
Torsten
Torsten le 3 Sep 2019
To calculate A(x)/A_star from M(x), the code you posted is correct.
Hailey
Hailey le 3 Sep 2019
Yes, the equation is right, but the for loop is majorly wrong. I'm not getting the answer that's needed for the equation per Mach number.
I know how to do it in excel, but MATLAB I don't understand the language.
Torsten
Torsten le 3 Sep 2019
for i = 1:numel(M)
Aratio(i) = (1/M(i))*(((2/g2)*(1+(g1/2)*M(i)^2))^((1/2)*(g2/g1)));
end
is the correct for-loop to calculate A(x)/A_star from M(x) according to your formula.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Foundation and Custom Domains dans Centre d'aide et File Exchange

Question posée :

le 2 Sep 2019

Commenté :

le 3 Sep 2019

Community Treasure Hunt

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

Start Hunting!

Translated by