Interpolate Curve - Simple 2D or 3D Curve Interpolation

Version 1.0.0 (3.44 KB) by John Kearns
S = interpc(Q); Outputs curve S by interpolating 2D or 3D curve Q using any method available in 'interp1()'. Designed for ease of use.
34 Downloads
Updated 21 Jul 2023

View License

S = interpc(Q); interpolates the input curve Q, which may be 2D or 3D, to output the curve S.
interpc() expects that Q is an [(Nq)x2] or [(Nq)x3] array, where Nq = length(Q); That is, the columns of Q must represent the spatial data. This will be generalized in future versions.
S will have higher point density around the regions of Q that have high curvature.
The number of points in S can be specified with a second input argument Ns, which is an positive integer.
That is, S = interpc(Q,Ns) will produce an S such that length(S) = Ns. Ns = 100 by default.
ANY method for interpolation available to MATLAB's inbuilt 'interp1()' can be used. This is specified with third input argument. Default interpolation scheme is 'makima'.
That is, S = interpc(Q,Ns,'pchip') will generate the points of S by pchip interpolation of Q along each component of Q. Future versions will allow different interpolation schemes for x, y, & z components of Q.
interpc() isn't anything revolutionary, but it's designed to be simple and straightforward to use. Perfect for MATLAB beginners.
This function was inspired by my regular use of curvspace(), written by Yo Fukushima. You can get curvspace here.

Cite As

John Kearns (2024). Interpolate Curve - Simple 2D or 3D Curve Interpolation (https://www.mathworks.com/matlabcentral/fileexchange/132563-interpolate-curve-simple-2d-or-3d-curve-interpolation), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: curvspace

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0