# Spline Fitting

Posted 2014.12.22 16:14

Spline fitting is widely used in vast applications such as what you already have in your mind... :)

In this post, I will show some examples of spline fitting based on excellent code provided by Jonas Lundgren <splinefit@gmail.com>.

Basically, what is does is to find coefficients of some polynomials in some partitions of the input space. The boundary of each partition must be connected and smooth which serve as constraints in finding the coefficients.

Following is an example of spline fitting using different orders.

The input space is partitioned into 8 equally divided partitions. The whole function is modeled using piecewise polynomial structure provided by Matlab. (ppval is used)

One can also incorporate some constraints into the spline fitting such as fixing value of a function at certain point or fixing gradient of a function. (Actually I guess these are pretty much all it can do.) Anyway following is the result of a spline fitting given some constraints.

Furthermore, it can be used as a robust regression algorithm which I am not that familiar with.. Nevertheless, the results are amazing. As optimizing coefficient is done using least square method, I guess robust least square methods are applied.

Constraints are given as follows:

4 Constraints in spline fitting

1.  y(0.0) is 1.0

2. y'(0.0) is 1.0

3.  y(6.3) is 2.0

4. y'(6.3) is -1.0

Demo code

더보기

"the most important" splinefit function

더보기

Notes

#### 'Enginius > Matlab' 카테고리의 다른 글

 Fast implementation of kdpp  (0) 2015.04.02 2014.12.26 2014.12.22 2014.12.17 2014.12.15 2014.08.05
« PREV : 1 : ··· : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 : ··· : 68 : NEXT »