Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
multiple-vector rotation

Subject: multiple-vector rotation

From: yuan

Date: 6 Jun, 2010 01:25:06

Message: 1 of 2

Hi there,

I got a problem about the multiple-vector rotation. It is stated as follows:

% randomly initialize two vectors
a = rand(10,1);b=rand(10,1);

% get the angle between them and save it as 'ane'
ane = dot(a,b)/(norm(a)*norm(b));
ane = acos(ane)*180/pi;

Now I want to get a new vector, say 'c', which has the same direction with 'a'. I check some materials about the vector rotation, but they only demonstrate how to rotate a 2D vector using a transformation matrix:

T=[cos(ane ),sin(ane );-sin(ane ),cos(ane )];

Can anyone give me hand...

Thanks so much....

Subject: multiple-vector rotation

From: Roger Stafford

Date: 6 Jun, 2010 03:08:03

Message: 2 of 2

"yuan " <tianyuan_2003@163.com> wrote in message <huetdi$p0f$1@fred.mathworks.com>...
> ........
> Now I want to get a new vector, say 'c', which has the same direction with 'a'. I check some materials about the vector rotation, but they only demonstrate how to rotate a 2D vector using a transformation matrix:
> ........

  What exactly do you mean by "which has the same direction with 'a'"? If you meant that literally it would be too trivial a problem. Perhaps you mean that you are to find a vector c which makes the same angle with respect to a as does b. If so, you should realize that in ten dimensions this can't be approached as some kind of "rotation". In three dimensions there would have been just one degree of freedom, namely the amount of rotation, whereas in ten dimensions you have eight degrees of freedom, so it becomes a very different sort of problem.

  I'll give you a strong hint. You can randomly create another vector which you could call d. It is unlikely to be parallel to a. (If it is, try again.) Now take a linear combination of a and d such that the result is orthogonal to a and call it e. This you should know how to do using the dot product appropriately. Next normalize a and e so they are unit vectors and write

 c = a*cos(t)+e*sin(t)

where t is the desired angle. Now see if you can prove that c will indeed have the angle t with respect to a.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us