How to solve equation with several unknown variables for a specific variable?
Afficher commentaires plus anciens
Hello
Im trying to solve an equation using the following code:
syms w0 g l r l a m
eqn = m*g*l*(1-cos(a))==1/2*1/2*m*(r^2+2*l^2)*((r^2/(r^2+2*l^2))*w0)^2
Sa = solve(eqn,cos(a))
However it gives me these answers:
eqn =
logical
0
Warning, solving 2 equations for 1 variables
Sa =
1/2 pi
I know the answer should be:
cos(a)=1-(w0^2/(4*g*l))*(r^4/(r^2+2*l^2))
Is there any way to solve this problem? Any help is greatly appreciated!
Réponse acceptée
Plus de réponses (1)
When you pose it as you did to solve, solve assumes you are trying to solve TWO equations, one of which is the equation
cos(a) == 0
READ THE WARNING MESSAGE!
Instead, do this:
syms w0 g l r l a m
eqn = m*g*l*(1-cos(a))==1/2*1/2*m*(r^2+2*l^2)*((r^2/(r^2+2*l^2))*w0)^2;
isolate(eqn,cos(a))
1 commentaire
Studentguy
le 9 Déc 2023
Catégories
En savoir plus sur Common Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




