How to find angle between two lines?

Illustration
Beulah A - 2024-01-11T13:49:19+00:00
Question: How to find angle between two lines?

For example, there is line L1 between two points (x1,y1) and (x2,y2). Another line L2 between points (x1,y1) and (x3,y3). I want to find the angle between the lines L1, L2. How to find in MATLAB? I think in matlab there is no predefined function which performs the same.  

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

A more stable method that what Jos suggested is:
 
v_1 = [x2,y2,0] - [x1,y1,0];
v_2 = [x3,y3,0] - [x1,y1,0];
Theta = atan2(norm(cross(v_1, v_2)), dot(v_1, v_2));

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!