Path: news.mathworks.com!not-for-mail
From: "Benjamin Kraus" <bkraus@bu.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Fit a linear function of two angles
Date: Mon, 30 Apr 2012 02:34:08 +0000 (UTC)
Organization: Boston University
Lines: 9
Message-ID: <jnktmv$663$1@newscl01ah.mathworks.com>
Reply-To: "Benjamin Kraus" <bkraus@bu.edu>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1335753248 6339 172.30.248.45 (30 Apr 2012 02:34:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 30 Apr 2012 02:34:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 630274
Xref: news.mathworks.com comp.soft-sys.matlab:766323

I've got two lists of angles (in radians, ranging from -pi to pi), that have a fixed offset from each other (plus a fair bit of noise).

angle1 = angle2+offset

I'm trying to calculate the offset. The problem is that both angles run from -pi to pi, so it isn't as simple as calling 'polyfit(angle1,angle2,1)', because I need to take into account that the angles wrap around. I know this is a simple problem, with a relatively simple solution, but it is eluding me at the moment.

Does anybody have any suggestions?

- Ben