Algorithm to make a polynomial fit of a part of a data set -


i have problem of algorithm. don't know if stackoverflow right place post since use matlab , want it, post there. problem following : have set of data , not know except fact @ end of set, points have quite linear. want make linear fit of these points linearly distributed without using part not.

(an image better understand) :enter image description here

as see there, have blue data, not linear has linear part @ end (red part). want, find algorithm allows me know when behaviour of data curve ends linearity.

i don't know if i'm clear ?

i've tried taking few points @ right , make linear fit of few points. add points few , check if "near enough" of linear fit. make once more linear fit added points , on think it's not best solution because "first" points have lot of noise (which not represented here on image)...

do have idea or proposition or link ?

thank !

what want, find algorithm allows me know when behaviour of data curve ends linearity.

linear data has particularly nice property, has constant slope. second derivative of linear section should approximately zero.

use spline fit (with kind of smoothing if data noisy) continuous version of data, call g(x). when g''(x) ~ 0, i.e. when second derivative small, linear section.


Comments