[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## leasqr with bounds

**From**: |
mrodrig |

**Subject**: |
leasqr with bounds |

**Date**: |
Thu, 25 Jan 2018 20:09:11 -0700 (MST) |

Hello,
I am new to the use of octave and I have tried to use the leasqr function
for the adjustment of some experimental data. Given the characteristics of
the adjustment function, some of the parameters to be adjusted must be
within certain limits (since they have a certain physical meaning). I wanted
to use the "bounds" option to limit the possible values that these
parameters can have.
In order to test the operation of the leasqr function I tried with the
following
x=[1:10]
y= [10,8,5.5,3.5,0,1.2,2.5,4.6,7.5,9.8]
F=@(x, p) (p (1) * x .^ 2 + p (2) * x + p (3))
a=1
b=1
c=1
p = [a,b,c];
wt=ones(size(x));
iter=400;
tol=0.000000001;
dFdp="dfdp";
dp=0.001*ones(size(p));
[f, pfit, kvg, iter, corp, covp, stdresid, Z, r2] = leasqr (Temp_bkg,
Int_Prom_bkg, par, F,tol, iter,wt, dp, dFdp);
and gives this results;
f =
10.8900
7.2773
4.5502
2.7086
1.7527
1.6824
2.4977
4.1986
6.7852
10.2573
pfit =
0.44280
-4.94114
15.38833
kvg = 1
iter = 6
Assuming I want parameter 3 to be within the limit -1 and 1
bounds =[-5,5; -5,5; -1,1 ]
it gives me
[f, pfit, kvg, iter, corp, covp, stdresid, Z, r2] = leasqr (x, y, p, F,tol,
iter,wt, dp, dFdp, bounds)
CONVERGENCE NOT ACHIEVED!
f =
10.8516
7.2616
4.5519
2.7225
1.7732
1.7041
2.5153
4.2067
6.7783
10.2302
pfit =
0.44011
-4.91026
15.32171
kvg = 0
iter = 6
As I said, this is a function invented to test the operation.
I have tried with my experimental data and it does not work either.
I expected that by limiting the possible values of parameter 3, the
iterations would give a function that may not be the best, but that has the
parameter 3 with values within the allowed ones
Somebody could help me?
Thanks in advance
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

**leasqr with bounds**,
*mrodrig* **<=**