help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fixed points piecewise-linear fitting


From: Sergei Steshenko
Subject: fixed points piecewise-linear fitting
Date: Sat, 17 Mar 2012 04:43:00 -0700 (PDT)

Hello,

strictly speaking, it's not an Octave-specific question, but an algorithmic one.

Suppose there is a measured function Y(X). In Octave terms X is a vector with N 
elements.

Suppose there are fixed points Xf such that

X(1) <= Xf(1)
Xf(end) <= X(end).

The Xf points are more sparse than X.


The Xf points are fixed, i.e. one can't change them as he/she pleases.

The goal is to find piecewise-linear function Yf(Xf) which best fits Y(X).

I.e. for each two Xf(k), Xf(k+1) pair of points to find a piece of straight 
line defined by Yf(k), Yf(k+1)pair of points such that the whole Yf fits Y 
pretty well.

Best fitting I'm interested in is according to minimum of sum(abs(Y - 
Yf_interpolated)). The Yf_interpolated is linear interpolated Yf on X, so 
dimensions of Y and Yf_interpolated match.


I did some quick web searching and my impression is that there is no 
universally adopted algorithm for this task, but there is a number solutions, 
including some for R-language.

I myself wrote a straightforward brute force implementation which works pretty 
well and acceptably fast for me.

Anyway, I'm writing this Email in the hope to be educated by the community - 
maybe there are already more elegant wheels than the one I've invented.

Thanks,
  Sergei.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]