how can i determine angle between 2 variables
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
how can i do/calculate the angle like in the ss below ,i know rBx,rBy and g
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/479528/image.png)
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 commentaires
Réponses (1)
the cyclist
le 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 commentaires
Voir également
Catégories
En savoir plus sur Array and Matrix Mathematics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!