How to solve implicit equations without the Symbolic Math Toolbox

Hi everyone,
I am trying to solve the following equation:
All the other variables are known except M. I am trying to solve for M. The MATLAB installation I am using is an academic version which doesn't have the Symbolic Math Toolbox. I would appreciate any help on this. Thanks.

 Accepted Answer

You can use fzero or fsolve, e.g.,
a=2/(gamma+1);
b=(gamma-1)/(gamma+1);
c=gamma/2/(gamma-1);
M=fzero(@(M) A/Astar - (a+b*M^2)^c/M, Mguess )

3 Comments

I tried this:
A = 6 ;
gam = 1.66 ;
a = (2/(gam+1));
b = (gam-1)/2 ;
c = gam /(2*(gam-1)) ;
fun = @(M) A - (1/M)*(a*(1+(b*M^2)))^c ;
x0 = 2.5;
z = fzero(fun,x0)
I get z = 10.1278 Which doesn't make sense if that is the value for M.
It does make sense because if you evaluate fun at that point you will see that it satisfies your equation,
K>> z = fzero(fun,2.5), val=fun(z)
z =
10.1278
val =
0
However, since the solution is non-unique, perhaps you were looking for the one closer to M=0,
K>> z = fzero(fun,0.1), val=fun(z)
z =
0.1171
val =
1.7764e-15
You're quite right Matt. Thanks a lot.

Sign in to comment.

More Answers (2)

The matlab function 'fzero', which I am sure you do have, and which is explained at:
http://www.mathworks.com/help/matlab/ref/fzero.html
will allow you to solve your problem. It does require an initial estimate of the approximate solution, and you can get that by first creating a plot of your expression as M varies to see roughly where it crosses the A/A* value, that is, where the difference between the two sides of your equation is zero.
Creo que siempre debe construirse la gráfica con "ezplot". Y analizarla antes de comenzar a calcular. Evita muchas sorpresas y equivocaciones.

Categories

Community Treasure Hunt

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

Start Hunting!