|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
polyfit: add a third output argument, mu [PATCH]The following patch adds a third output argument, mu for compatibility with
Matlab. I made an effort to update the documentation, but I'm not familiar with Octave's documentation system. Cheers, Shaun 2008-06-30 Shaun Jackman <sjackman@...> * polynomial/polyfit.m (polyfit): Add a third output argument, mu, for compatibility. If three output arguments are requested, the input argument x is shifted and scaled before fitting. --- /opt/octave-3.0.1/share/octave/3.0.1/m/polynomial/polyfit.m.orig 2008-04-25 09:17:07.000000000 -0700 +++ /opt/octave-3.0.1/share/octave/3.0.1/m/polynomial/polyfit.m 2008-06-30 11:15:46.000000000 -0700 @@ -51,6 +51,10 @@ ## @item yf ## The values of the polynomial for each value of @var{x}. ## @end table +## +## If three output arguments are requested, the input argument @var{x} +## is transformed before fitting by @code{(x - mu(1)) / mu(2)}, +## where @code{mu(1) = mean(x)} and @code{mu(2) = std(x)}. ## @end deftypefn ## Author: KH <Kurt.Hornik@...> @@ -72,6 +76,12 @@ error ("polyfit: n must be a nonnegative integer"); endif + if (nargout > 2) + mu(1) = mean(x); + mu(2) = std(x); + x = (x - mu(1)) / mu(2); + endif + y_is_row_vector = (rows (y) == 1); l = length (x); |
|
|
Re: polyfit: add a third output argument, mu [PATCH]On Mon, Jun 30, 2008 at 1:52 PM, Shaun Jackman <sjackman@...> wrote:
> The following patch adds a third output argument, mu for compatibility with > Matlab. I made an effort to update the documentation, but I'm not familiar > with Octave's documentation system. > There is wpolifit in octave-forge that has this and more. And I still do not understand why it is not in the main octave tree yet... > Cheers, > Shaun Sincerely, Dmitri. -- |
|
|
Re: polyfit: add a third output argument, mu [PATCH]Dmitri A. Sergatskov wrote:
> On Mon, Jun 30, 2008 at 1:52 PM, Shaun Jackman <sjackman@...> wrote: >> The following patch adds a third output argument, mu for compatibility with >> Matlab. I made an effort to update the documentation, but I'm not familiar >> with Octave's documentation system. >> > > There is wpolifit in octave-forge that has this and more. And I still > do not understand > why it is not in the main octave tree yet... Because there aren't that many of us who are porting the octave-forge functions to Octave. I did a bit of this but searched for candidates based on the function name clashes, and as wpolyfit isn't polyfit I didn't identify this as a replacement.. I'm sure if you go over wpolyfit doing the following * Add GPL copyright (but keep Paul's public domain copyright) * Change '' quoted strings to "" quoted strings * Use parenthesis in if statements * Write "length (varargin)" and not "length(varargin)" etc * Other standard Octave style fixes then John would accept this as a replacement if its clearly better. D. |
|
|
Re: polyfit: add a third output argument, mu [PATCH]On Jul 1, 2008, at 2:23 AM, David Bateman wrote: > Dmitri A. Sergatskov wrote: >> On Mon, Jun 30, 2008 at 1:52 PM, Shaun Jackman <sjackman@...> >> wrote: >>> The following patch adds a third output argument, mu for >>> compatibility with >>> Matlab. I made an effort to update the documentation, but I'm not >>> familiar >>> with Octave's documentation system. >>> >> >> There is wpolifit in octave-forge that has this and more. And I still >> do not understand >> why it is not in the main octave tree yet... > > > Because there aren't that many of us who are porting the octave-forge > functions to Octave. I did a bit of this but searched for candidates > based on the function name clashes, and as wpolyfit isn't polyfit I > didn't identify this as a replacement.. I'm sure if you go over > wpolyfit > doing the following > > * Add GPL copyright (but keep Paul's public domain copyright) > * Change '' quoted strings to "" quoted strings > * Use parenthesis in if statements > * Write "length (varargin)" and not "length(varargin)" etc > * Other standard Octave style fixes > > then John would accept this as a replacement if its clearly better. > > D. Hey guys, A changeset was applied back in Feb that includes the third output argument, mu. http://www.nabble.com/Re%3A--changeset--Polyfit-with-scaling-p15834853.html I checked my copy of jwe's default archive, and it is present there. Is it not in yours? Ben |
|
|
Re: polyfit: add a third output argument, mu [PATCH]Ben Abbott wrote:
> Hey guys, > > A changeset was applied back in Feb that includes the third output > argument, mu. > > http://www.nabble.com/Re%3A--changeset--Polyfit-with-scaling-p15834853.html > > > I checked my copy of jwe's default archive, and it is present there. > Is it not in yours? Ok, so what else is in wpolyfit.. It is always better to not have two versions of the same function, as thats just a source of confusion, so it would be better to cut any beneficial code from wpolyfit and port it to Octave. D. |
|
|
Re: polyfit: add a third output argument, mu [PATCH]Ben Abbott wrote:
> On Jul 1, 2008, at 2:23 AM, David Bateman wrote: >> Dmitri A. Sergatskov wrote: >>> On Mon, Jun 30, 2008 at 1:52 PM, Shaun Jackman <sjackman@...> >>> wrote: >>>> The following patch adds a third output argument, mu for >>>> compatibility with >>>> Matlab. I made an effort to update the documentation, but I'm not >>>> familiar >>>> with Octave's documentation system. ... > A changeset was applied back in Feb that includes the third output > argument, mu. > > http://www.nabble.com/Re%3A--changeset--Polyfit-with-scaling-p15834853.html > > > I checked my copy of jwe's default archive, and it is present there. Is > it not in yours? I'm running Octave 3.0.1, which does not include this patch. Any upcoming plans for a stable release? Cheers, Shaun |
|
|
Re: polyfit: add a third output argument, mu [PATCH]On 2-Jul-2008, Shaun Jackman wrote:
| I'm running Octave 3.0.1, which does not include this patch. Any upcoming plans | for a stable release? Is there anyone out there who would like to become the release manager for the stable release series? jwe |
| Free Forum Powered by Nabble | Forum Help |