MATLAB Answers

Is it possible to project vector onto another vector that has different length ?

12 views (last 30 days)
Sarah A
Sarah A on 18 Jul 2018
Commented: Sarah A on 21 Jul 2018
Is it possible to project vector (a) onto another vector (b) that has different length? for example, let a is a vector of 51 element and b is 90 element.


Pawel Jastrzebski
Pawel Jastrzebski on 18 Jul 2018
You need to provide more information with your question. What do you need this transformation for? And the 'vector projection' is quite ambiguous without further context ax well.
Do you mean vector projection as in:
Or you want to create the same vector containing all of the original data points as well and new points in between:
Or you want to use your original vector to create a new one which will have a different boundaries compared to the original one:
Jan on 19 Jul 2018
@Sarah A: This definition from WikiPedia works only, if the vectors have the same length. So it is still not clear, what you want to achieve.

Sign in to comment.

Accepted Answer

Jan on 18 Jul 2018
A projection between vectors of different sizes is not mathematically defined. So it depends on what you need:
a = [a1, a2, a3]
b = [b1, b2, b3, b4, b5]
Then perhaps you want:
c = a1 * b1 + a2 * b2 + a3 * b3
c = a1 * b1 + a2 * b2 + a3 * b3 + b4 + b5
c = a1 * b3 + a2 * b4 + a3 * b5
I have not seen any mathematical problem in the last 30 years, in which such an operation is required. Please post the context of the problem, because I assume, that the need for this operation is a misunderstanding.

  1 Comment

Sarah A
Sarah A on 21 Jul 2018
Thank you for answering. Yes I still working on my idea and if I have more details of what I am going to do I will comment here.

Sign in to comment.

More Answers (1)

Constantino Carlos Reyes-Aldasoro
As mentioned previously, we would need a bit more context to be able to provide more guidance. I guess that what you want to do is the dot product of two vectors, say A and B, so that you can see the projection of one over another and thus you would have two vectors with the same orientation, one is not modified and the second will have a different magnitude due to the projection, if they had the same orientation the magnitude is not changed, but if they were at 90 degrees of each other, the magnitude of the projection would be zero, that is, they are orthogonal to each other. Check wikipedia for dot product:
and the dot product help for Matlab
If you still have doubts after reading these, let us know.


Sarah A
Sarah A on 18 Jul 2018
do you mean if a = 1*3 and b = 1*5
the result will be as the following:
a1*b1 + a2*b2 + a3*b3 + 0*b4 + 0 *b5 ?
Matt J
Matt J on 18 Jul 2018
You tell us. What is the result supposed to represent? What are the inputs supposed to represent? Can we assume the representation of a in 5D is [a1,a2,a3,0,0] ?
Constantino Carlos Reyes-Aldasoro
I guess the confusion is within "vectors" normally you have a vector on a number of dimensions and each will have a magnitude, i.e. 2x + 3y.
In your description it seems that a has 3 dimensions and b has 5.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!