help-octave
[Top][All Lists]

## Re: leasqr with bounds

 From: mrodrig Subject: Re: leasqr with bounds Date: Fri, 2 Feb 2018 13:52:35 -0700 (MST)

```Hello,

Again I bother with the following

1) I'm writing a script where I want the file name (excel matrix) as input
and the script read the data.

to access the data I'm using A = xlsread ("filename.xlsx");

I found this on the web but it did not work

arg_list = argv ()

filename = argv {1}

Any suggestions?

2) The script reads the matrix and generates a graph of x and y. The
experimental data can be interpreted as the sum of four peaks, for example
Gaussian.

for this I defined four functions of the style

F1 = @ (x, par) (par (1) ... par (4))
F2 = @ (x, par) (par (5) ... par (8))
F3 = @ (x, par) (par (9) ... par (12))
F4 = @ (x, par) (par (13) ... par (16))

with par = [par (1), par (2), par (3), par (4), par (5), par (6) .... par
(16)]
and then I get the sum function

Fsum = F1 (x, par) + F2 (x, par) + F3 (x, par) + F4 (x, par)

When I plot the experimental data and F1, F2, F3, F4 and Fsum it seems
reasonable.

But when I try to make the following fitting it throws me error

wt = ones (size (x));
iter = 20;
tol = 0.00001;
dFdp = "dfdp";
dp = 0.001 * ones (size (pair));

[f, pfit, kvg, iter] = leasqr (x, y, par, Fsum, tol, iter, wt, dp, dFdp);

error: F (301.01, _): subscripts must be either integers 1 to (2 ^ 31) -1 or
logicals
error: called from
leasqr at line 329 column 9

Any ideas?

The next steps will be useing the bounds to include in the fitting

Thanks very much

Mauricio

--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

```