[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: piecewise spline approximation
From: |
c. |
Subject: |
Re: piecewise spline approximation |
Date: |
Mon, 22 Apr 2013 19:10:21 +0200 |
On 22 Apr 2013, at 18:53, WizardOfBoz <address@hidden> wrote:
> Thanks Nir!
>
> I had looked at csaps, and csaps_sel (and interp1 and spline). My
> understanding of these functions is that I can put a vector of the
> independent variables Xi into the argument list with data vectorx X and Y,
> and get VALUES for the dependent variable Y at the points specified by Xi,
> or I can just put X and Y in and get the polynomials coefficients at every
> point in X.
>
> But I can't get what I want, which is the coefficients for a small number of
> polynomials splined over the intervals defined by the smaller vector Xi,
> that give a good fit the data in the bigger vectors X and Y.
>
> To explain: I have to take the polynomial coefficents out of Octave and use
> them in another application that has some constraints on function building
> and vector indexing. I can manually kludge (for example) five piecewise
> cubic polynomials, with five * 4 coefficients, into the other application.
> But it would be a hassle to put something with 100 or 1000 polynomials into
> that app.
if you have a recent version of Octave you could try the function splinefit,
like:
pp = splinefit (x, y, N);
where N is the number of polynomials you want to generate.
pp will be a struct containing the coefficients of your polynomials and the
intervals over
which they fit your data.
HTH,
c.