Solving an equation. use fsolve, root, solve?

4 次查看(过去 30 天)
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."

回答(1 个)

Walter Roberson
Walter Roberson 2013-10-19
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

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by