MATLAB: Multiple Answers From ‘solve’

functionssolve

I have an equation that I am passing to the 'solve' function. I know for a fact that it has two solutions. It only returns one solution. This is how I'm calling solve:
solve(S)
where S is a string containing the equation. It's pretty ugly but I can provide it if needed. What I need is a way to get that second solution.

Best Answer

syms theta2 theta4
S=(-4.19*sin(theta2*pi/180)-5.166*sin(theta4*pi/180)+23.3*sin(82.99*pi/180))^2+(-4.19*cos(theta2*pi/180)-5.166*cos(theta4*pi/180)+23.3*cos(82.99*pi/180))^2-24.073^2;
sols = solve(S,theta4);
sols = subs(sols,theta2,73.5);
sols =
[-115.9829194]
[ ]
[-73.90876566]
The first solution, added to 180, gives 64.0170806.