Hi guys. Lets say I have two points, and I want to find the angle (0 to 360 deg measured counter clockwise) from the x-axis to the line connecting those two points. How can I do that in an efficient way?
Example: Point 1 is [1,2] and Point 2 is [4,11]

 Réponse acceptée

Matt J
Matt J le 9 Mai 2023
Modifié(e) : Matt J le 9 Mai 2023

1 vote

One way:
dPt=normalize(Point2-Point1,'n');
angle=acosd(dPt(1)) %degrees

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Version

R2021a

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by