How can I calculate the slope of segments given the coordinates?

3 ビュー (過去 30 日間)
Bruno
Bruno 2017 年 1 月 8 日
回答済み: Walter Roberson 2017 年 1 月 8 日
I did linear fit on the data, and I obtained five segments (AB, BC, CD, DE and EF) with X1 and Y1 vector (coordinates for the segments). I want to calculate the slope of each segment with the data contained in the X1 and Y1:
%slopes=(y2_y1)./(x2-x1);
for i=1:size(YI,2);
y(:,1) = YI(2,2)-YI(1,1);
end
for i=1:size(XI,2);
x(:,1) = XI(2,2)-XI(1,1);
end
slopes=y/x;

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 1 月 8 日
slopes = y./x;

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by