フィルターのクリア

Solving an equation help

4 ビュー (過去 30 日間)
Cizzxr
Cizzxr 2021 年 3 月 17 日
コメント済み: Cizzxr 2021 年 3 月 17 日
So i have an equation shown as 'eqn' shown below, I am trying to solve for M but for some reason my code isnt running and im not sure why, any help would be appreciated
a = 1.4;
x = -0.5:0.1:0.5;
b = 0.153 + x.^2;
A1 = 0.153;
F2 = (b./A1);
eqn = F2 == ((a+1)./2).^((-a+1)/2.*(a-1)).*(((1+((a-1)./2)*M.^2).^((a+1)/2.*(a-1)))./M);
s = solve(eqn);
  3 件のコメント
Cizzxr
Cizzxr 2021 年 3 月 17 日
編集済み: Walter Roberson 2021 年 3 月 17 日
M is the Mach Number which needs to be solved, Ive used the equation in red which has a red rectangle around it on this page https://www.grc.nasa.gov/www/k-12/airplane/astar.html
M is the unknown and so basically, the value of F2 will change depending on what value of x in the array created is inputted.
So for example, a value of x=0 in the array will result in 'b' being 0.153,
which means the ratio of F2 is 0.153/0.153 which is 1. Thus F2 is equal to 1
and then the only unknown in my equation is M which im asking matlab to rearange to make M the subject and possibly plot a graph
of results
Cizzxr
Cizzxr 2021 年 3 月 17 日
I mean it could attempt to rearange the equation for M but im bound to make a mistake somewhere hence why i wanted to see if matlab would do it for me

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 3 月 17 日
a = 1.4;
x = -0.5:0.1:0.5;
b = 0.153 + x.^2;
A1 = 0.153;
F2 = (b./A1);
syms M real
assume(M>0)
eqn = F2 == ((a+1)./2).^((-a+1)/2.*(a-1)).*(((1+((a-1)./2)*M.^2).^((a+1)/2.*(a-1)))./M);
s = arrayfun(@vpasolve, eqn);
vpa(s,5)
ans = 
  1 件のコメント
Cizzxr
Cizzxr 2021 年 3 月 17 日
Thank you very much Walter!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by