Slope of line intersecting with y axis
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!