Path: news.mathworks.com!not-for-mail
From: "Anh Huy Phan" <phananhhuy@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Find angles between two vectors
Date: Wed, 23 Jan 2008 14:08:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 41
Message-ID: <fn7ho2$o6t$1@fred.mathworks.com>
References: <fn7egt$447$1@fred.mathworks.com> <fn7gru$7jd$1@fred.mathworks.com>
Reply-To: "Anh Huy Phan" <phananhhuy@mathworks.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1201097282 24797 172.30.248.37 (23 Jan 2008 14:08:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jan 2008 14:08:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 113206
Xref: news.mathworks.com comp.soft-sys.matlab:447198


"us " <us@neurol.unizh.ch> wrote in message 
<fn7gru$7jd$1@fred.mathworks.com>...
> "Justin Morehouse":
> <SNIP many many words...
> 
> > Hi there, I have a two vectors (3,5) and (5,6) and I 
was 
> > wondering how do I get the angle between them in matlab.
> > on paper I would multiply both vectors to get (15+30) to 
> = 
> > 45 and then square both (3,5) and (5,6) to get (9+25) 
and 
> > (25+36). Then I would get the square root of both (34) 
> and 
> > (61) and multiply them together  and then divide 45 by 
> that.
> > Afterwhich  I would then use a trusty calc to do cos 
> theta 
> > of that, but how can math lab do that...
> 
> ML obeys your words... (as one of the solutions...)
> 
>      v1=[3,5];
>      v2=[5,6];
>      a=acosd(dot(v1,v2)/(norm(v1)*norm(v2)))
> 
> us

The same question was posted and available at the following 
address

http://www.mathworks.com/matlabcentral/newsreader/
view_thread/151925

It is better that you search your topic before posting a 
question about it.

Anh Huy Phan
RIKEN - BSI