12 views (last 30 days)

Hello,

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.

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.

Constantino Carlos Reyes-Aldasoro
on 18 Jul 2018

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:

https://en.wikipedia.org/wiki/Dot_product

and the dot product help for Matlab

https://uk.mathworks.com/help/matlab/ref/dot.html

If you still have doubts after reading these, let us know.

Matt J
on 18 Jul 2018

Constantino Carlos Reyes-Aldasoro
on 19 Jul 2018

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.

Opportunities for recent engineering grads.

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

Start Hunting!
## 3 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590385

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590385

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590392

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590392

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590897

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/410852-is-it-possible-to-project-vector-onto-another-vector-that-has-different-length#comment_590897

Sign in to comment.