Slope of line intersecting with y axis

1 回表示 (過去 30 日間)
LH
LH 2022 年 10 月 11 日
編集済み: John D'Errico 2022 年 10 月 11 日
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.

回答 (1 件)

John D'Errico
John D'Errico 2022 年 10 月 11 日
編集済み: John D'Errico 2022 年 10 月 11 日
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?

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by