how can i determine angle between 2 variables
3 views (last 30 days)
Show older comments
how can i do/calculate the angle like in the ss below ,i know rBx,rBy and g
g=180/pi;
teta1=300;teta2=320;teta3=40;teta4=100;teta5=160; % in degrees
Alfa=deg2rad(teta1/g);aLfa=deg2rad(teta2/g); alFa=deg2rad(teta3/g);alfA=deg2rad(teta4/g);alfa=deg2rad(teta5/g);
rBx=-1*(r1*cos(Alfa)+r2*cos(aLfa)+r3*cos(alFa)+r4*cos(alfA)+r5*cos(alfa)+rAx)
rBy=-1*(r1*sin(Alfa)+r2*sin(aLfa)+r3*sin(alFa)+r4*sin(alfA)+r5*sin(alfa)+rAy)
2 Comments
Answers (1)
the cyclist
on 5 Jan 2021
You got the order of the inputs incorrect. It should be
atan2(rAy,rAx)*g
This will give a negative answer, measuring the angle "down" from the x-axis. If you add 360deg, you'll get the answer you want.
0 Comments
See Also
Categories
Find more on Array and Matrix Mathematics 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!