problem with the code
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi,
Which angle is calculating with this matlab code
a=sensor1; b=sensor2; c=22;
numerator=(b^2)+(c^2)-(a^2); %Täljare demoninator=2*b*c; %Nämnare
cos_alpha=numerator/demoninator;
alpha=acosd(cos_alpha); %The angle alpha in degrees
Can anyone help me in understanding this code
Thanks in advance
1 个评论
Jim
2013-5-12
回答(1 个)
Roger Stafford
2013-5-12
Apparently there is a triangle with vertices A, B, and C with sides opposite to these vertices of length a, b, and c, resectively. The angle, alpha, at vertex A must satisfy the cosine law:
a^2 = b^2 + c^2 - 2*b*c*cos(alpha)
cos(alpha) = (b^2+c^2-a^2)/(2*b*c)
alpha = acosd((b^2+c^2-a^2)/(2*b*c)) (in degrees)
1 个评论
Jim
2013-5-12
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!