Piecewise linear fit without interpolating between every two points

4 ビュー (過去 30 日間)
Maarten
Maarten 2013 年 6 月 21 日
回答済み: Greg Dionne 2016 年 7 月 8 日
Hello,
I'm trying to do a linear piecewise interpolation of measurement data. The method used in the curve fitting toolbox is 'connect the dots': if I have 15 data points, the algorithm creates 14 line segments between the dots. I would like to know: is it possible to use fewer line segments? Example: I have 30 data points and I would like the best interpolation using 4 line segments. I could divide my 30 points in 4 intervals and do a linear fit on each interval, but it would be difficult to find the best fit that way. Is there a better method available in matlab?

回答 (2 件)

Matt J
Matt J 2013 年 6 月 21 日
This looks like it can do it
The file has options to let you fix the knots at desired locations or let the fitting algorithm chose them for you.

Greg Dionne
Greg Dionne 2016 年 7 月 8 日
The Signal Processing Toolbox R2016a has this capability. See FINDCHANGEPTS

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by