Azzera filtri
Azzera filtri

Slope of line intersecting with y axis

1 visualizzazione (ultimi 30 giorni)
LH
LH il 11 Ott 2022
Modificato: John D'Errico il 11 Ott 2022
Hi,
I am trying to caluclate the slope of a line intersecting with one of the axes. I do understand that, as shown in the figure below, the slopw in case (a) is the where θ is the angle between the line and the x axis. But what about case (b)? What is the slope when the line intersects with the y axis and the angle θ becomes between the line and the y axis. is the slope becomes the ?
% case a
slope_a = tan(theta) % or y2-y1/x2-x1
%case b
slope_b = cot(theta) % or x2-x1/y2-y1
Thanks.

Risposte (1)

John D'Errico
John D'Errico il 11 Ott 2022
Modificato: John D'Errico il 11 Ott 2022
What has this to do with MATLAB?
The axis has NOTHING to do with the slope!!!!
The slope in both cases is (y2 - y1)/(x2 - x1). Which axis a line intersects is completely irrelevant. In fact, do you see the line ALWAYS intersects both axes, unless the line is exactly horizontal or vertical. In the case of a vertical line of course, the slope is undefined.
How you define the ANGLE a line intersects with an axis is irrelevant, as slope is not represented by an angle. Yes, you can compute that angle, but then surely you would recognize that the angle a line makes when it intersects with the two axes is always given by the angles of a right triangle, and therefore one angle is 90 degrees minus the other?

Categorie

Scopri di più su Visual Exploration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by