[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Polyfit with scaling
From: |
Ben Abbott |
Subject: |
Re: Polyfit with scaling |
Date: |
Mon, 04 Feb 2008 12:32:16 -0800 |
I've modified polyfit.m to be consistent with the Matlab's version.
In short, "help polyfit" replies
octave:168> help polyfit
-- Function File: [P, S, MU] = polyfit (X, Y, N)
Return the coefficients of a polynomial P(X) of degree N that
minimizes `sumsq (p(x(i)) - y(i))', to best fit the data in the
least squares sense.
The polynomial coefficients are returned in a row vector.
If a second output argument is requested a structured variable, S,
containing the following fields will be returned:
`R'
Triangular factor R from the QR decomposition.
`X'
The Vandermonde matrix matrix used to compute the polynomial
coefficients.
`df'
The degrees of freedom.
`normr'
The norm of the residuals.
`yf'
The values of the polynomial for each value of X.
When the third output, MU, is requested, POLYFIT will return the
coefficients associated with a polynomial in XHAT =
(X-MU(1))/MU(2). Where MU(1) = mean (X), and MU(2) = std (X).
This linear transformation of X improves the numerical stability
of the fit.
I've attached the modified script. I'd appreciate anyone's effort in testing it
functionality, comparing to Matlab, and/or improving the help documentation.
In the meantime, I'll be looking at polyval. It also needs to be modified to
take mirror these changes. Specifically, polyval needs to accept additional
inputs if it is to be compatible/consistent with Matlab's version. There are
four possible ways polyval may be called;
y = polyval (p, x);
[y, delta] = polyval (p, x, s);
y = polyval (p, x, [], mu);
[y, delta] = polyval (p, x, s, mu);
Ben
polyfit.m
Description: Binary data
- Re: Polyfit with scaling, (continued)
- Re: Polyfit with scaling, Ben Abbott, 2008/02/02
- Re: Polyfit with scaling, Dmitri A. Sergatskov, 2008/02/02
- Re: Polyfit with scaling, Ben Abbott, 2008/02/02
- Re: Polyfit with scaling, Dmitri A. Sergatskov, 2008/02/02
- Re: Polyfit with scaling, Ben Abbott, 2008/02/02
- Re: Polyfit with scaling, Ben Abbott, 2008/02/03
- Re: Polyfit with scaling, Dmitri A. Sergatskov, 2008/02/03
- Re: Polyfit with scaling, Ben Abbott, 2008/02/03
- Re: Polyfit with scaling, Thomas Weber, 2008/02/04
- Re: Polyfit with scaling, Ben Abbott, 2008/02/04
- Re: Polyfit with scaling,
Ben Abbott <=
- Re: Polyfit with scaling, John W. Eaton, 2008/02/04
- Re: Polyfit with scaling, Dmitri A. Sergatskov, 2008/02/04
- Re: Polyfit with scaling, John W. Eaton, 2008/02/04
- Re: Polyfit with scaling, Ben Abbott, 2008/02/04
- Re: Polyfit with scaling, Ben Abbott, 2008/02/04
- Re: Polyfit with scaling, Dmitri A. Sergatskov, 2008/02/04
- Re: Polyfit with scaling, Ben Abbott, 2008/02/04
- Message not available
- Re: Polyfit with scaling, Ben Abbott, 2008/02/04
- Re: Polyfit with scaling - Q regarding polyval, Ben Abbott, 2008/02/05
- Re: Polyfit with scaling - Q regarding polyconf, Ben Abbott, 2008/02/13