```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can I determine a vector if I knew the angle between two
Date: Thu, 1 Dec 2011 07:16:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <jb79jo\$1bb\$1@newscl01ah.mathworks.com>
References: <jb6onn\$cch\$1@newscl01ah.mathworks.com> <e1475487-6bfd-4ed0-81da-c576db6f35b0@q9g2000yqe.googlegroups.com> <jb6rho\$kbe\$1@newscl01ah.mathworks.com> <jb6thh\$pu3\$1@newscl01ah.mathworks.com> <jb6un1\$t6f\$1@newscl01ah.mathworks.com>
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 1322723768 1387 172.30.248.45 (1 Dec 2011 07:16:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 1 Dec 2011 07:16:08 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:751054

"Roger Stafford" wrote in message <jb6un1\$t6f\$1@newscl01ah.mathworks.com>...
>  c = cos(theta); s = sin(theta); n = norm(u);
>  v1 = [u(1)*c-u(2)*s,u(2)*c+u(1)*s]/n;
>  v2 = [u(1)*c+u(2)*s,u(2)*c-u(1)*s]/n;
- - - - - - - - -
It would have been more appropriate to express your rotations in terms of matrices since that is what matlab is all about.  Let u, v1, and v2 be column vectors (with x-coord. first and y-coord. second.)

c = cos(theta); s = sin(theta);
R1 = [c -s;s c]; R2 = [c s;-s c];
v1 = R1*u; v2 = R2*u;

(Note: these leave the lengths of v1 and v2 the same as that of u.)

Roger Stafford
```