Equally spaced points along a nonlinear path
Show older comments
I have a path linear by parts that I need to equally divide with points. How do I do that?
Accepted Answer
More Answers (1)
John D'Errico
on 27 May 2024
Edited: John D'Errico
on 27 May 2024
Simpler yet, just download my interparc from the file exchange. It allows you to do the operation in a variety of ways, using several variations of spline interpolant, or assuming piecewise linear segments.
It does all the work for you, and it is free.
x = randn(6,1);
y = randn(6,1);
% 500 points, equally spaced along the curve in arclength
Pspline = interparc(500,x,y,'spline');
plot(x,y,'ro',Pspline(:,1),Pspline(:,2),'-')

Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!