4.0

4.0 | 1 rating Rate this file 54 downloads (last 30 days) File Size: 121.28 KB File ID: #25872

Free-knot spline approximation

by Bruno Luong

 

17 Nov 2009 (Updated 10 Jun 2010)

Code covered by the BSD License  

Least squares approximation of 1D data using free-knots spline

Download Now | Watch this File

File Information
Description

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Pseudo-inverse, Multiple same-size linear solver, Min/Max filter

MATLAB release MATLAB 7.9 (2009b)
Other requirements optimization toolbox or QP solvers available at: http://sigpromu.org/quadprog/index.html (QPC) http://www.mat.univie.ac.at/~neum/software/minq/ QPC solver is strongly recommended.
Zip File Content  
Other Files
BSFKFolder/BBspline.m,
BSFKFolder/BSFK.m,
BSFKFolder/BSFK_install.m,
BSFKFolder/example.png,
BSFKFolder/MinMaxFilterFolder/benchminmax.m,
BSFKFolder/MinMaxFilterFolder/Contents.txt,
BSFKFolder/MinMaxFilterFolder/demolena.m,
BSFKFolder/MinMaxFilterFolder/KramerBruckner.m,
BSFKFolder/MinMaxFilterFolder/lemire_engine.c,
BSFKFolder/MinMaxFilterFolder/lemire_engine.m,
BSFKFolder/MinMaxFilterFolder/lemire_engine.mexw32,
BSFKFolder/MinMaxFilterFolder/lemire_nd_engine.c,
BSFKFolder/MinMaxFilterFolder/lemire_nd_engine.mexw32,
BSFKFolder/MinMaxFilterFolder/lemire_nd_maxengine.c,
BSFKFolder/MinMaxFilterFolder/lemire_nd_maxengine.m,
BSFKFolder/MinMaxFilterFolder/lemire_nd_maxengine.mexw32,
BSFKFolder/MinMaxFilterFolder/lemire_nd_minengine.c,
BSFKFolder/MinMaxFilterFolder/lemire_nd_minengine.m,
BSFKFolder/MinMaxFilterFolder/lemire_nd_minengine.mexw32,
BSFKFolder/MinMaxFilterFolder/minmaxfilt.m,
BSFKFolder/MinMaxFilterFolder/minmaxfilt1.m,
BSFKFolder/MinMaxFilterFolder/minmaxfilter_install.m,
BSFKFolder/MinMaxFilterFolder/slowminmaxfilt_algo.m,
BSFKFolder/MinMaxFilterFolder/testminmaxfilt.m,
BSFKFolder/MinMaxFilterFolder/vanherk.m,
BSFKFolder/MultiSolverFolder/MultiProd.m,
BSFKFolder/MultiSolverFolder/MultiSolver.m,
BSFKFolder/MultiSolverFolder/SliceMultiProd.m,
BSFKFolder/MultiSolverFolder/SliceMultiSolver.m,
BSFKFolder/private/BernKnotDeriv.m,
BSFKFolder/private/Bernstein.m,
BSFKFolder/private/Bspline.m,
BSFKFolder/private/Bspline2pp.m,
BSFKFolder/private/BsplineKnotDeriv.m,
BSFKFolder/private/DerivB.m,
BSFKFolder/private/DerivBKnotDeriv.m,
BSFKFolder/private/derivchol.m,
BSFKFolder/private/DGD.m,
BSFKFolder/private/getoption.m,
BSFKFolder/private/Gram.m,
BSFKFolder/private/qpmin.m,
BSFKFolder/private/qrnull.m,
BSFKFolder/PseudoInverseFolder/@pseudoinverse/private/getoption.m,
BSFKFolder/PseudoInverseFolder/@pseudoinverse/private/lowercase.m,
BSFKFolder/PseudoInverseFolder/@pseudoinverse/pseudoinverse.m,
BSFKFolder/testBSFK.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
09 Jan 2010 x yuij  
01 Jun 2010 Bruno Luong

Periodic spline is now available

08 Jun 2010 Bruno Luong

Just discover an issue with continuous regularization. In the mean time, please use the discrete regularization

Please login to add a comment or rating.
Updates
18 Nov 2009

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

19 Nov 2009

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

28 Nov 2009

Change title and description

04 Dec 2009

A major enhancement with shape preserving splines

08 Dec 2009

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.

09 Dec 2009

Correct another bug in the Jacobian calculation (constrained case)

09 Dec 2009

Change the description.

10 Dec 2009

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

14 Dec 2009

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

18 Mar 2010

fixed small bug when calling QP engine minqdef

10 Apr 2010

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

31 May 2010

New feature: Periodic spline

01 Jun 2010

Remove some redundant code, modify test program

07 Jun 2010

A more robust conversion in pp form is implemented

07 Jun 2010

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

10 Jun 2010

Fix the bug for continuous regularization

Tag Activity for this File
Tag Applied By Date/Time
fitting Bruno Luong 17 Nov 2009 13:09:10
bspline Bruno Luong 17 Nov 2009 13:09:10
free knots Bruno Luong 17 Nov 2009 13:09:10
knot removal Bruno Luong 17 Nov 2009 13:09:10
data compression Bruno Luong 17 Nov 2009 13:09:10
least squares Bruno Luong 18 Nov 2009 10:17:14
shape preserving Bruno Luong 04 Dec 2009 09:49:00
spline Bruno Luong 10 Dec 2009 12:09:06
bspline Jon 09 Mar 2010 09:50:15
free knots Jon 09 Mar 2010 12:39:13

Contact us at files@mathworks.com