Solving an equation help

조회 수: 2 (최근 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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by