3 views (last 30 days)

Show older comments

As we all know, the dot product of 2 vectors must be a scalar quantity. I have two vectors P and Z and they both have 6138 data points. So i converted them to Matrix of dimension 6138x3. Now when I used dot(P,Z) I am getting a 1x3 matrix. My question is how can I get the scalar quantity from this? Or Is there other way to the dot product of these two vectors using MATLAB.

THX

Sai Veeramachaneni
on 12 Mar 2021

Hi,

For multidimensional arrays, dot function calculates the dot product of corresponding vectors along the first array dimension whose size does not equal 1.

In your case I think sum(dot(A,B)) works for you.

Hope it helps.

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

Start Hunting!