MATLAB: Find the angle between two points in 3D plot.

3d plotsangle

Untitled-1.png
How can we find the angle between two points in 3D plot along y-axis?

Best Answer

if the 3D (x-y-z) coordinates of your two points are P1 and P2, both are (3 x 1) or (1 x 3) vectors
angleradian = acos((P2(2)-P1(2)) / norm(P2-P1))