Vector dot product rules
Another simple review of the vector dot product, for those of you that have forgotten. The operation that involves multiplying two vectors together can be done in a few ways. The first operation is called either the scalar product or the dot product. One of the well known definitions looks like this:
This is a scalar product that is equal to the two magnitudes multiplied together and multiplied by the cosine of the angle between them. If the two vectors are perpendicular to each other then the angle between them is 90 degrees, which will make the dot product equal zero. This is an equivalent equation.
When you finish your dot product, you should have a number, not a directional vector. So if you get something like this you did something wrong: . If you ended up with (any #) then you don’t have to completely rule out your answer.
A few vectors to practice with:
Okay, now we have found our dot product by applying RULE 2 above. We can use this value along with our individual vector magnitudes to apply RULE 1 and obtain the angle .
We can calculate the projection of the vector A onto the vector B by this relationship:
Note that this is a scalar quantity, and that we can also define the projection of B onto vector A in a similar fashion:
Performing a vector dot product in MATLAB
Perform a dot product in MATLAB like so:
>>A = [ 1 2 3];
>>B = [2 3 4];