From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Oscillating Discontinuity in atan2
Date: Thu, 14 Apr 2011 13:49:05 +0000 (UTC)
Organization: Xoran Technologies
Lines: 9
Message-ID: <io6u0h$kst$>
References: <io4dgr$6m3$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1302788945 21405 (14 Apr 2011 13:49:05 GMT)
NNTP-Posting-Date: Thu, 14 Apr 2011 13:49:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:721882

"Sable Campbell" wrote in message <io4dgr$6m3$>...
> I tried to unwrap this oscillating data coming out of my atan2 function, so that the output would extend beyond these limits, but it simply unwraps to an extremely large number.
> Please advise.

The ANGLE function is discontinuous in the neighbourhood of the negative real axis. This means that any numerical noise in the input X to angle(X) will can cause the values of X to jitter back and forth across the real axis with corresponding discontinuous jumps in angle(X) between pi and -pi.

Bottom line. You must insert code to detect when X gets close, within some tolerance, to the negative real axis and manually round it to a desired value (pi or -pi).