Path: news.mathworks.com!not-for-mail
From: "Loren_Shure" <loren.shure@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Angle between two vectors
Date: Mon, 19 Jul 2010 08:21:39 -0400
Organization: MathWorks
Lines: 31
Message-ID: <i21g0k$ker$1@fred.mathworks.com>
References: <ef5ce9c.-1@webcrossing.raydaftYaTP> <fjj9nj$fia$1@fred.mathworks.com> <fjk0tg$jli$1@fred.mathworks.com> <fl377q$4ip$1@fred.mathworks.com> <fl3moi$pvc$1@fred.mathworks.com> <i1su0s$deu$1@fred.mathworks.com> <i1t7en$gvq$1@fred.mathworks.com> <i1umi8$r2p$1@fred.mathworks.com> <i1v3gj$8rh$1@fred.mathworks.com> <i1vcn1$s7p$1@fred.mathworks.com> <i1vhmb$1rq$1@fred.mathworks.com> <i1vm13$ok8$1@fred.mathworks.com>
NNTP-Posting-Host: ah-loren0w.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="UTF-8";
	reply-type=response
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1279542100 20955 172.31.57.72 (19 Jul 2010 12:21:40 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 19 Jul 2010 12:21:40 +0000 (UTC)
In-Reply-To: <i1vm13$ok8$1@fred.mathworks.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:654142


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in 
message news:i1vm13$ok8$1@fred.mathworks.com...
> "Bard R." <this.is.not.a.real.address@gmail.com> wrote in message 
> <i1vhmb$1rq$1@fred.mathworks.com>...
>> This is exactly what I was looking for. And so much more compact than the 
>> solution I had put together during the day. It works if A and B are 
>> opposite (I had to do an extra check for that as well) and for my 
>> application N is by definition never parallell to neither A nor B.
>> Thanx a lot!
>> Bě±…rd
> - - - - - - - - - - - -
>  Well, if A and B, or even their projections, are in opposite directions, 
> the outcome can suddenly flip from one extreme to the other depending on 
> rounding.  A roundoff one way gets +pi as a result and in the other 
> direction flips the answer over to -pi.  I don't see any good way out of 
> that problem.  It is more or less inherent in the nature of numerical 
> computation of angles.  A digital computer cannot even compute the exact 
> value of pi itself.
>
> Roger Stafford

Have you checked out the function subspace: 
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/subspace.html ?


-- 
Loren
http://blogs.mathworks.com/loren/
http://matlabwiki.mathworks.com/MATLAB_FAQ