MATLAB Answers

Calculating arc length of segments using interparc

18 ビュー (過去 30 日間)
Hari krishnan
Hari krishnan 2019 年 1 月 9 日
編集済み: Hari krishnan 2019 年 1 月 9 日
Hi, I was using 'interparc' function to divide an arc in to 'n' number of equal segments. I expected each segment to give me equal arc length. But when i calculate the arc-length of each one of these segments, i am getting different arc-lengths. Any explanation regarding this will be appreciated?
'px','py' and 'arc_pt' files are attached as references
px = X_coord_req;
py = Y_coord_req;
pt = interparc(50,px,py,'linear');
plot(px,py,'r',pt(:,1),pt(:,2),'b-o')
ax = gca;
ax.YDir = 'reverse';
axis([0 6600 0 5000])
arc_pt = zeros(length(pt)-1,1);
n = length(pt(:,1));
for ii = 1:n-1
arc_pt(ii) = sqrt((pt(ii+1,1) - pt(ii,1))^2 + (pt(ii+1,2) - pt(ii,2))^2);
end

  3 件のコメント

KSSV
KSSV 2019 年 1 月 9 日
interparc is not an inbuilt function........you need to attach that.
KSSV
KSSV 2019 年 1 月 9 日
Hari krishnan
Hari krishnan 2019 年 1 月 9 日
@KSSV. Apologies. Its the same function you attached above

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by