Finding the angle of inclination from two end points of a line.

32 vues (au cours des 30 derniers jours)
Ba Ba Black Sheep!
Ba Ba Black Sheep! le 19 Juin 2017
Commenté : samundeeswari p le 23 Oct 2021
point1 = [22, 114];
point2 = [693, 233];
x1 = point1(1);
y1 = point1(2);
x2 = point2(1);
y2 = point2(2);
slope = (y2 - y1) ./ (x2 - x1);
angle = atand(slope)
Output
angle = 10.0567
This line has a negative slope. Why am I getting an incorrect answer?
  3 commentaires
Ba Ba Black Sheep!
Ba Ba Black Sheep! le 19 Juin 2017
Oh! I got it!!
samundeeswari p
samundeeswari p le 23 Oct 2021
This code works well... Thank you

Connectez-vous pour commenter.

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 19 Juin 2017
point1 = [22, -114];
point2 = [693, -233];
x1 = point1(1);
y1 = point1(2);
x2 = point2(1);
y2 = point2(2);
slope = (y2 - y1) ./ (x2 - x1)
angle = atand(slope)

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by