How to solve equation with several unknown variables for a specific variable?
Show older comments
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!
Accepted Answer
More Answers (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 Comment
Studentguy
on 9 Dec 2023
Categories
Find more on Common Operations 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!



