I'm trying to solve the Machnumber-Area equation for isentropic flows. This equation has two real positive roots, but I'm not able to get any of these when trying to solve with the "solve" routine.
The code to solve the equation:
gamma = 1.4;
L = 3;
n = 30;
dx = L/n;
x = 0;
for i=1:n+1
A(i) = 1 + 2.2*( x - 1.5 )^2;
X(i) = x;
x = x + dx;
end
A0 = min(A);
for i=1:1 %n1
syms M
eqn = (A(i)/A0)^2 == ( 1/M^2 )*( ( 2/(gamma+1) )*( 1+0.5*(gamma-1)*M^2 ) )^( (gamma+1)/(gamma-1) )
solM = solve(eqn,M)
% Mach_is(i) = solM;
end
I commented out to loop through the entire vector since it crashes do the the output I get:
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 1))^(1/2)
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 2))^(1/2)
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 3))^(1/2)
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 4))^(1/2)
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 5))^(1/2)
(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 6))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 1))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 2))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 3))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 4))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 5))^(1/2)
-(1/root(z^6 - (40824726*z^5)/390625 + (3*z^4)/5 + (4*z^3)/25 + (3*z^2)/125 + (6*z)/3125 + 1/15625, z, 6))^(1/2)
Can anyone suggest why am I getting this and how to solve the equation?