Solving an equation. use fsolve, root, solve?

4 vues (au cours des 30 derniers jours)
toner
toner le 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."

Réponses (1)

Walter Roberson
Walter Roberson le 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

Catégories

En savoir plus sur Symbolic Math Toolbox 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