[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Piecewise linear fitting
Mike Barker <email@example.com> wrote in message
> I would like to get my hands on an IDL routine that does a piecewise
> linear fit to data. The number of pieces is known but the locations of
> the break points are not. I don't have the time nor the expertise
> necessary to write it myself. Could anyone please direct me to such a
> program? I've done several lengthy searches but to no avail. I would
> greatly appreciate any help you could give.
I have some LOESS code if that is what you are interested, but of course
it is still in my typical poorly written hacky version.
So what is the rule for how to break the pieces up. Is it
every 'n' points makes a piece, or is it every 'x units' makes
a peice. (ACK, I can never remember if it is 'piece' as in I
want a piece of pie, or if it is 'peice' as in I want another
peice of ice. mmmm ice)
So, here is a solution if there is some constant rule (whether number
of points or constant unit interval):
Use histogram with reverse indices,
loop through the bins with your linear fitting (using poly_fit I guess).
hope this vague answer helps,
bob "my second histogram answer" stockwell