Angle between two vectors matlab Based on this link, this seems to be the most stable solution: atan2(norm(cross(a,b)), dot(a,b))