Free-knot spline approximation

Least squares approximation of 1D data using free-knots spline
5.8K Downloads
Updated 24 Feb 2022
The purpose of this function is to provide a flexible and robust fit to one-dimensional data using free-knot splines. The knots are free and able to cope with rapid change in the underlying model. Knot removal strategy is used to fit with only a small number of knots.
Optional L2-regularization on the derivative of the spline function can be used to enforce the smoothness.
Shape preserving approximation can be enforced by specifying the lower and upper bounds of the derivative(s) of the spline function on sub-intervals. Furthermore specific values of the spline function and its derivative can be specified on a set of discrete data points.
I did not test QUADPROG engine, but I have implemented it. Any feedback is welcome.

Cite As

Bruno Luong (2024). Free-knot spline approximation (https://github.com/BrunoLuong/Free-knot-spline-approximation/releases/tag/1.20.0.0), GitHub. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.20.0.0

See release notes for this release on GitHub: https://github.com/BrunoLuong/Free-knot-spline-approximation/releases/tag/1.20.0.0

1.19.0.0

quadprog is functioning (blind codding before)
Add regularization to make quadprog more robust. This is important change for those who use QUADPROG as engine.
Fix a bug when checking for knot collision

1.18.0.0

Fix the bug when starting knots are provided

1.16.0.0

Fix the bug for continuous regularization

1.15.0.0

Fix a small bug (eigs with 'sa' option requires true symmetric matrix, which is now always the case by symmetrizing)

1.14.0.0

A more robust conversion in pp form is implemented

1.13.0.0

Remove some redundant code, modify test program

1.12.0.0

New feature: Periodic spline

1.11.0.0

fix a bug with parsing k and nknots
Spline order can be as low as k=1 (piecewise constant fit)

1.10.0.0

fixed small bug when calling QP engine minqdef

1.9.0.0

Correct a bug in UpdateConstraints that did not update the knot positions. Precasting data to double. Update more frequently the scaling matrix. Reduce the Lagrange's tolerance to detect active set of QPC solver

1.8.0.0

Singular constraints will issue a warning (instead of an error). Refine the Gauss-Newton direction. Fix few minor bugs.

1.7.0.0

Change the description.

1.6.0.0

Correct another bug in the Jacobian calculation (constrained case)

1.5.0.0

Point-wise constraints. Discover an error of the Jacobian formula in [Schutze/Schwetlick 97] paper, modify the calculation accordingly. This concern only the constrained fitting.

1.4.0.0

A major enhancement with shape preserving splines

1.3.0.0

Change title and description

1.2.0.0

Remove NaN data before fitting, change TRY/CATCH ME syntax for better compatibility (tested under 2006B), estimate automatic of the noise standard deviation

1.1.0.0

Update description, more options added to control the fit, discrete regularization

1.0.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.