Solving an equation. use fsolve, root, solve?

4 views (last 30 days)
toner
toner on 19 Oct 2013
Answered: Walter Roberson on 19 Oct 2013
Hey there I'm having a lot of trouble doing something that I imagine is very simple. I'm trying to solve an equation, trying to solve for a variable.
The code I am working with is here:
syms Msub
gamma = 1.4;
solve(0.0525/0.0200 = (1/Msub)*((2/(gamma+1))*(1+((gamma-1)/2)*Msub^2))^((gamma+1)/(2*(gamma-1)), Msub)
how can I obtain the two values for Msub!? I keep getting the error "The expression to the left of the equals sign is not a valid target for an assignment."

Answers (1)

Walter Roberson
Walter Roberson on 19 Oct 2013
You are using an older version of MATLAB that does not support using "=" between symbols to indicate a equation. Convert to
solve( (-0.0525/0.0200) + (1/Msub)*((2/(gamma+1))*(1+((gamma-1)/2)*Msub^2))^((gamma+1)/(2*(gamma-1)), Msub)
That is, A=B can be converted to A-B=0 or (-A)+B=0

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!