Effacer les filtres
Effacer les filtres

Solving an equation help

4 vues (au cours des 30 derniers jours)
Cizzxr
Cizzxr le 17 Mar 2021
Commenté : Cizzxr le 17 Mar 2021
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 commentaires
Cizzxr
Cizzxr le 17 Mar 2021
Modifié(e) : Walter Roberson le 17 Mar 2021
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 le 17 Mar 2021
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

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 17 Mar 2021
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 commentaire
Cizzxr
Cizzxr le 17 Mar 2021
Thank you very much Walter!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by