help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: non-linear fitting with bounds


From: Stefan Neumann
Subject: Re: non-linear fitting with bounds
Date: Sun, 14 Mar 2010 13:15:18 +0100



2010/3/13 Olaf Till <address@hidden>

 
bounds are not implemented in such a way that you can keep a parameter less than zero, you only can keep it less than or equal to zero.

Of course, that is what I meant, sorry :-)

In the last version (in package optim-1.0.12) bounds and linear
inequality constraints are implemented.

Thanks Olaf.

Yes, there is a 'bounds'-option, bounding variable between a min and a max, as well as a 'inequc'-option which allows specifying linear constraints via a matrix and a vector.
I assume that the 'bounds'-option is a subset of the 'inequc'-option.

I installed the packages by downloading from http://octave.sourceforge.net/optim/index.html and http://octave-miscellaneous.sourcearchive.com/
then 'sudo octave'
then 'pkg install xxx.tar.gz'  for both packages.
(This only an info for not-so-octave-experienced people like me)

On SuSE 11.2 that is quite a job, having to resolve several dependency-issues. Still working on that  :-/

On Ubuntu 9.10 it is much easier. Only optim-1.0.12 needs to be installed. No issues.





Good so far: afterwards  'help leasqr' shows the bounds-option.

So i modified the script according to the help in 2 different ways, both of which gave results I did not understand

Only the relevant lines of the script are shown, I can also post the whole script.

# test 1:
# ------------------------------------ #
# function with 2 parameters
bounds=[1,2;1,2]
[f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]=leasqr(x,y,pin,F,bounds);
# ------------------------------------ #

This worked but gave wrong results (not fitting the pregenerated test-data) AND the results were not within the bounds.


# test 2:
# ------------------------------------ #
# function with 2 parameters
options.bounds=[1,2;1,2]
[f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]=leasqr(x,y,pin,F,options);

# output:
error: binary operator `-' not implemented for `scalar' by `struct' operations
error: evaluating binary operator `-' near line 316, column 13
error: evaluating binary operator `*' near line 316, column 19
error: evaluating assignment _expression_ near line 316, column 10
error: evaluating for command near line 305, column 3
error: called from `leasqr' in file `/usr/share/octave/packages/3.0/optim-1.0.12/leasqr.m'
error: near line 20 of file `tmp/non-lin.02.scr'
error: Permission denied
# ------------------------------------ #

This did not work at all, as you can see.

Probably a syntax-error.


Thanks
stn

reply via email to

[Prev in Thread] Current Thread [Next in Thread]