필터 지우기
필터 지우기

Slope of a line

조회 수: 1 (최근 30일)
Elie
Elie 2014년 2월 16일
답변: Paul 2014년 2월 16일
I'm trying to find the slope of this line
line([newBoxPolygon(1, 1) newBoxPolygon(4, 1)],[newBoxPolygon(1, 2) newBoxPolygon(4, 2)],'Color','G');
%Slope
X = (max([50 50])-min([50 50]));
Y=(max([1 10000])-min([1 10000]));
Slope_Reference=Y/X;
disp('Slope_Reference:');disp(Slope_Reference);
Is the slope i'm obtaining correct ?

채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 16일
편집: Mischa Kim 2014년 2월 16일
In general, your equation is correct, k = dY/dX, however, in
X = (max([50 50])-min([50 50])); % 50 - 50 = 0
Y = (max([1 10000])-min([1 10000]));
X = 0 resulting in a slope of Inf. So I am wondering what you are trying to compute the slope of.

추가 답변 (1개)

Paul
Paul 2014년 2월 16일
(max([50 50])-min([50 50]))
returns 0, since the minimum and maximum of the vector [50 50] is 50. This means that X=0 and thus Y/X = Y/0 = inf.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by