image thumbnail

B-spline approximation

version 3.0.3 (1.83 KB) by Dorian Depriester
Computes the B-spline approximation from a set of coordinates. Supports periodicity and n-th order approximation.


Updated 11 Feb 2021

View License

Computes the B-spline approximation from a set of coordinates (knots).
The number of points per interval (default: 10) and the order of the B-spline (default: 3) can be changed. Periodic boundaries can be used.

It works on any dimension (even larger than 3...).

This code is inspired from that of Stefan Hueeber and Jonas Ballani [1].

Example (see image):
rng(1) % Set random seed for reproductility
XY=rand(5,2); % Random set of 5 points in 2D
BS2=BSpline(XY); % Default order=3 (quadratic)
BS3=BSpline(XY,'order',4); % order=4 -> cubic B-spline
legend('Control polygon','Quadratic','Cubic','Quadratic periodic')
set(h, 'LineWidth',2)


Cite As

Dorian Depriester (2021). B-spline approximation (, MATLAB Central File Exchange. Retrieved .

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

Inspired by: MTEX2Gmsh

Community Treasure Hunt

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

Start Hunting!