Matlab – Angle between two vectors matlab

mathMATLABvector

I want to calculate the angle between 2 vectors V = [Vx Vy Vz] and B = [Bx By Bz].
is this formula correct?

VdotB = (Vx*Bx + Vy*By + Vz*Bz)

 Angle = acosd (VdotB / norm(V)*norm(B))

and is there any other way to calculate it?

My question is not for normalizing the vectors or make it easier. I am asking about how to get the angle between this two vectors

Best Answer

Based on this link, this seems to be the most stable solution:

atan2(norm(cross(a,b)), dot(a,b))