# MATLAB: How to find cosine angle known the end points of 2 linesegments

angle between 2 linesegments

There are 2 line segments, known their end points, how can i find angle between them

v1 = [1 1]v2 = [0 3]D = [v1;v2]; %possibly you have something like thiscostheta = dot(D(1, :), D(2, :)) / (norm(D(1, :)) * norm(D(2, :)));thetaindegrees = acosd(costheta)