How to make an angle continuous from -inf to +inf

19 ビュー (過去 30 日間)
Miguel Lopes
Miguel Lopes 2015 年 2 月 25 日
コメント済み: Miguel Lopes 2015 年 2 月 25 日
Hello,
I have a vector with angles between [-pi, pi[.
So for instance if we go clockwise in degrees: -177 -178 -179 -180 179 178 177
What I wanted this to be would be: -177 -178 -179 -180 -181 -182 -183
I want it to be continuous from -inf to +inf.
How can i do it in a clean way without having to check how many turns it already turned. I know how to do it with a for loop and reading angle by angle and a bunch of if's, but isn't there a command in matlab that does that for me in a clean way??
Thanks

採用された回答

James Tursa
James Tursa 2015 年 2 月 25 日
編集済み: James Tursa 2015 年 2 月 25 日
doc unwrap
>> p = (pi/180)*[-177 -178 -179 -180 179 178 177]
p =
-3.0892 -3.1067 -3.1241 -3.1416 3.1241 3.1067 3.0892
>> (180/pi)*unwrap(p)
ans =
-177.0000 -178.0000 -179.0000 -180.0000 -181.0000 -182.0000 -183.0000
  1 件のコメント
Miguel Lopes
Miguel Lopes 2015 年 2 月 25 日
It worked!!!
Thank youuu

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by