From: "y Mehta" <mehtayogesh@gmail.(DOT).com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Angle between two vectors
Message-ID: <ef5ce9c.-1@webcrossing.raydaftYaTP>
Date: Mon, 9 Jul 2007 17:16:29 -0400
Lines: 12
NNTP-Posting-Host: 63.211.21.46
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:418088


How do I find the angle between two unit vectors a and b? I know I
can find cosine theta by the following formula:

theta = acos(dot(a,b));

However, how do I know whether the angle is actually theta, or -theta
or pi-theta or pi+theta??

Notice that the vectors are in three dimension (3d).

Thanks,
-YM