Info

この質問は閉じられています。 編集または回答するには再度開いてください。

problem with the code

1 回表示 (過去 30 日間)
Jim
Jim 2013 年 5 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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
Jim 2013 年 5 月 12 日
The distance between sensors is c=22, a and b are the distance of the sensors from the object. Now which angle is being calculated with this code

回答 (1 件)

Roger Stafford
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
Jim 2013 年 5 月 12 日
Thanks for ur reply
After calculating the angle what the below command will do?
l=sind(alpha)*b;

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by