Solving an equation help

1 visualización (últimos 30 días)
Cizzxr
Cizzxr el 17 de Mzo. de 2021
Comentada: Cizzxr el 17 de Mzo. de 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 comentarios
Cizzxr
Cizzxr el 17 de Mzo. de 2021
Editada: Walter Roberson el 17 de Mzo. de 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 el 17 de Mzo. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Mzo. de 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 comentario
Cizzxr
Cizzxr el 17 de Mzo. de 2021
Thank you very much Walter!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by