unwrap the angle code

4 ビュー (過去 30 日間)
Niraj
Niraj 2012 年 11 月 15 日
Hi, I have a vector of angles which are in the range of -360 to 360. I need to unwrap them. I donot have the wrap and unwrap built in function in my old version of MATLAB.
Could any one come up with a small piece of code to unwrap manually?
Thanks please reply.

回答 (1 件)

C.J. Harris
C.J. Harris 2012 年 11 月 15 日
Going from a range of -360 to 360 degrees to 0 to 360 degrees is usually called wrapping the angle, not unwrapping. This anonymous function should do the trick:
wrap = @(x)mod(x,360);
Example:
nAngle = -270;
wrap(nAngle)
ans =
90
  1 件のコメント
Niraj
Niraj 2012 年 11 月 23 日
Thanks for the answer and correcting me..

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by