Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Fit a linear function of two angles
Date: Mon, 30 Apr 2012 15:15:07 +0000 (UTC)
Organization: Xoran Technologies
Lines: 20
Message-ID: <jnma9r$812$1@newscl01ah.mathworks.com>
References: <jnktmv$663$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1335798907 8226 172.30.248.48 (30 Apr 2012 15:15:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 30 Apr 2012 15:15:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:766393

"Benjamin Kraus" <bkraus@bu.edu> wrote in message <jnktmv$663$1@newscl01ah.mathworks.com>...
> 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
> 
=========

Another idea. Transform this to

 A=sin(offset)=sin(angle1-angle2)
 B=cos(offset)=cos(angle1-angle2)

where A and B are unknowns constrained so that norm([A,B])=1 and 
sin(angle1-angle2) and cos(angle1-angle2) are transformations of the data.
You can least squares solve this problem using

http://www.mathworks.com/matlabcentral/fileexchange/27596-least-square-with-2-norm-constraint

and then extract the desired offset using 
offset=atan2(B,A).