calculate the difference on the antenna azimuth

18 ビュー (過去 30 日間)
michael
michael 2021 年 6 月 7 日
編集済み: Aparajith Raghuvir 2021 年 6 月 7 日
Hi,
I need to calculate the difference of 2 azimuths (lets say analytical and real azimuth).
There is no issue if both are preatty close in between 0 and 360-eps.
The problem begins if one of them is on the other side of the 0 - if I have analytical to be 359 and actual is 1, the diff is 2 degree. If I'll calculate (analytical - actual) I'll get 358 and if I'll calculate (actual-analytical) I'll get -358 which is wrong for both cases.
Is there some convinient way to do the calculation so that the sign will also be avilable (i.e. who is bigger)

採用された回答

Aparajith Raghuvir
Aparajith Raghuvir 2021 年 6 月 7 日
編集済み: Aparajith Raghuvir 2021 年 6 月 7 日
Hello Michael,
Given an angle A in degrees, the signed angle is
(A + 180) modulo 360 - 180
The difference between two angles, as in your requirement, can be found as follows:
abs(mod((a1+180), 360) - mod((b1+180), 360))
where a1, b1, are the two angles in consideration.
Hope this helps.
Thanks,
Aparajith

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Radiation and Collection についてさらに検索

製品


リリース

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by