matlab中角度,利用 matlab 计算各种角度

各种(空间)角度的计算方法以前自己的立体几何学的不好,各种计算方法全都忘记的差不多了,在这里整理与总结一下,便于以后查询和分享吧

1.两向量间夹角Calculate the 3D angle between two vectors

The angle between two three-element vectors, P1 and P2, can be calculated using matlab in the following way:

a = atan2(norm(cross(P1,P2)),dot(P1,P2)); % Angle in radians

The angle will lie between 0 and pi radians. To get degrees use ‘atan2d’.

Note: However, the cosine of such an angle can be calculated as:

cosine of the angle = dot(P1,P2)/(norm(P1)*norm(P2))

No need to compute the angle itself.