Clear Filters
Clear Filters

Find the best fit 2 piecewise polynomial function for a data set with 1 optimal breakpoint location

3 views (last 30 days)
I have a 2D data set (2 variables x and y). I would like to use 2 piecewise polynomial functions with 1 breakpoint to best fit the dataset.
For example, function 1 = polynomial1 for mini_data < t < a and function 2 = polynomial2 for a<t<max_data. Also, I need to find the optimal breakpoint a value.
What maths tool/algorithm should I use, please?
Thanks in advance!
  3 Comments
Yutao Wang
Yutao Wang on 25 May 2021
Edited: Yutao Wang on 25 May 2021
Thanks, @Torsten.
Any degree of polynomial is fine, perhaps degree = 2 to 6 is preferred.
At breapoint, it needs to be continuous + continuity of the first derivative. An example of the data is given here. Thanks in advance!
Torsten
Torsten on 26 May 2021
Edited: Torsten on 26 May 2021
min: sum_{i=1}^{i=ndata} (p(xdata(i),a) - ydata(i))^2
subject to
p1(a,a) = p2(a,a)
p1'(a,a) = p2'(a,a)
xdata(1) <= a <= xdata(ndata)
with
p(x,a) = p1(x,a) for x<=a
p(x,a) = p2(x,a) for x>=a
Parameters to be optimized are a and the coefficients of the polynomials p1 and p2.
A typical application for Matlab's "fmincon".

Sign in to comment.

Answers (0)

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!