Cosine of an angle

4 views (last 30 days)
Muerus Rodrigues
Muerus Rodrigues on 29 Apr 2021
Answered: Matt J on 29 Apr 2021
Hello, We know Cosine (x) = Cosine(-x). I have a set of three equations and three unknowns involving finding l2, m2 and d2. I am only able to get the positive angle as the result (1.5708). How do we obtain negative angle i.e (-1.5708) as a result. Thank you
E4 = (Sk(1)+(r)*cos(l2)*sin(m2))== Sk(1)-unit_vi(1)*d2;
E5 = (Sk(2)+(r)*sin(l2)*sin(m2))== Sk(2)-unit_vi(2)*d2;
E6 = ((Sk(3)-L)+(r)*cos(m2))== Sk(3)-L;
result2 = solve(E4,E5,E6);
disp(double(result2.l2))
disp(double(result2.m2))
disp(double(result2.d2))
Output:
0
1.5708
3
Currently, I am doing - double(result.m2) to substitute in another equation.

Answers (2)

Star Strider
Star Strider on 29 Apr 2021
Experiment with vpasolve, and specifically Specify Ranges of Solutions .

Matt J
Matt J on 29 Apr 2021
As far as I can see, only by changing the equations:
E4 = (Sk(1)-(r)*cos(l2)*sin(m2))== Sk(1)-unit_vi(1)*d2;
E5 = (Sk(2)-(r)*sin(l2)*sin(m2))== Sk(2)-unit_vi(2)*d2;
E6 = ((Sk(3)-L)+(r)*cos(m2))== Sk(3)-L;

Community Treasure Hunt

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

Start Hunting!