[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: leasqr question (again)
From: |
Olaf Till |
Subject: |
Re: leasqr question (again) |
Date: |
Sat, 15 Sep 2012 16:33:40 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Fri, Sep 14, 2012 at 11:10:48PM +0200, Olaf Till wrote:
> On Fri, Sep 14, 2012 at 12:44:08PM -0700, seektime wrote:
> > Hi,
> >
> > I'd like to run leasqr.m in its simplest form, ie without any options (just
> > bare bones) but I'm getting the following error message (variables pasted
> > below if you want to test it on your system):
> >
> > octave:3> [f,p]=leasqr(V,I,pin,F)
> > error: Invalid call to options. Correct usage is:
> >
> > -- Function File: OPT = options ("KEY1", VALUE1, "KEY2", VALUE2, ...)
> >
> > error: called from:
> > error:
> > C:\octave\Octave3.6.1_gcc4.6.2\share\octave\3.6.1\m\help\print_usage.m at
> > line 87, column 5
> > error:
> > C:\octave\Octave3.6.1_gcc4.6.2\share\octave\packages\control-2.3.52\options.m
> > at line 68, column 5
> > error: evaluating argument list element number 1
> > error:
> > C:\octave\Octave3.6.1_gcc4.6.2\share\octave\packages\optim-1.2.0\leasqr.m at
> > line 574, column 5
> >
> > Code and variables are:
> >
> >
> > V=[
> > -159.88
> > -149.27
> > -139.1
> > -129.08
> > -118.97
> > -113.9
> > -108.86
> > -103.82
> > -98.762
> > -93.748
> > -88.717
> > -83.669
> > -78.658
> > -68.557
> > -58.494
> > -48.459];
> >
> > I=[
> > 1
> > 1.0079
> > 0.97652
> > 0.87318
> > 0.81173
> > 0.72704
> > 0.66648
> > 0.57694
> > 0.39872
> > 0.29661
> > 0.18571
> > 0.094664
> > 0.047699
> > 0.035285
> > 0.021977
> > 0.017704];
> >
> > pin=([-100 -10]);
> > F = @(V,p) 1 ./ (1 + exp((p(1) - V) / p(2)));
> >
> > Besides that fact that it doesn't return the parameters I'm wondering about
> > the message since I'm not passing any options? Any hints, explanations or
> > suggestions would be highly appreciated.
> >
> > Michael
>
> Oh, this is a bug ... I put in some testing code some time ago and was
> not careful enough.
>
> The line 574 in leasqr.m
>
> if (isfield (options, 'testing'))
>
> should acutally be
>
> if (nargin > 9)
>
> As it is now, if no argument 'options' is given, the test is also
> positive if some function 'options' is provided anywhere --- in your
> case within the control package. This function is then erroneously
> called and gives the error message you have seen.
>
> Sorry. I'll correct this in SVN, and I think a bugfix release of
> 'optim' is justified in this case. In the meantime, you could make the
> above change in line 574 yourself, or just delete the whole block
> commented as %% only preliminary, for testing.
>
> Olaf
I should also say that if you can't wait for the fixed package you
could use a different function. With the variables given by you and
global "verbose" not set,
[f, p] = leasqr (V, I, pin, F)
is equivalent to (same core algorithm):
[p, f] = nonlin_curvefit (F2, pin.', V, I)
if F2 is defined as F but with different order of arguments:
F2 = @ (p, V) 1 ./ (1 + exp ((p(1) - V) / p(2)));
Note that nonlin_curvefit requires the initial values to be a column
vector (if they are given as a vector).
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature