equation code not getting right answer

Hello, I'm trying to code this expression, this is my attempt but I'm not getting the same answer/value, not sure what I'm doing wrong. Any help/guidance will be appreciated.
% Given values
%AInfinity = 1;
%AInlet = 6.5;
MInlet = 0.5;
MInfinity = 2;
gamma = 1.4;
a = (1 + (gamma-1/2)* MInfinity^2)
b = (1 + (gamma-1/2)* MInlet^2)
b1 = (MInlet/MInfinity)
r = b1*(a/b)^(gamma + 1/(2*gamma -1))

 採用された回答

VBBV
VBBV 2024 年 3 月 2 日
編集済み: VBBV 2024 年 3 月 2 日

0 投票

% Given values
%AInfinity = 1;
%AInlet = 6.5;
MInlet = 0.5;
MInfinity = 2;
gamma = 1.4;
a = (1 + ((gamma-1)/2)* MInfinity^2) % for numerator
a = 1.8000
b = (1 + ((gamma-1)/2)* MInlet^2) % for numerator
b = 1.0500
b1 = (MInlet/MInfinity)
b1 = 0.2500
r = b1*(a/b)^((gamma + 1)/(2*(gamma -1))) % for num and den
r = 1.2595

3 件のコメント

VBBV
VBBV 2024 年 3 月 2 日
use the parenthesis for num & den in the expression
Cesar Cardenas
Cesar Cardenas 2024 年 3 月 17 日
Thank you, I just would like to know if these are well coded? Thanks
p02 = pa * (1 + eta_d * (gamma - 1) / 2 * Ma^2) ^ (gamma / (gamma - 1))
p2 = p02 * (1 + (gamma - 1) / 2 * M2^2) ^ (gamma / (gamma - 1))
Torsten
Torsten 2024 年 3 月 17 日
I just would like to know if these are well coded?
Yes, the two expressions are correctly coded.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGamma Functions についてさらに検索

質問済み:

2024 年 3 月 2 日

コメント済み:

2024 年 3 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by