File Exchange

## B-spline approximation

version 3.0.1 (1.79 KB) by Dorian Depriester

### Dorian Depriester (view profile)

Computes the B-spline approximation from a set of coordinates. Supports periodicity and n-th order approximation.

Updated 14 May 2019

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: 2) 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);
BS3=BSpline(XY,'order',3);
BSper=BSpline(XY,'periodic',true);
h=plot(XY(:,1),XY(:,2),'-o',BS2(:,1),BS2(:,2),BS3(:,1),BS3(:,2),'--',BSper(:,1),BSper(:,2),'-.');
legend('Reference data (knots)','2^{nd} order Bspline','3^{rd} order Bspline','2^{nd} order periodic Bspline')
set(h, 'LineWidth',2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

### Cite As

Dorian Depriester (2020). B-spline approximation (https://www.mathworks.com/matlabcentral/fileexchange/71456-b-spline-approximation), MATLAB Central File Exchange. Retrieved .