[scilab-Users] lsqrsolve
vinsz
vincent.guffens at googlemail.com
Wed Mar 31 23:09:41 CEST 2010
On 31/03/2010 11:18, Maso Ricci wrote:
> Hi,
>
> I am using the lsqrsolve function to fit some data.
> I wonder whether lsqrsolve accepts contrains in order to force the
> solution to be positive.
>
> thanks in advance for any comments and suggestions
A common trick to force a parameter to remain positive is to use the
exp() function in the solver, for instance:
function er = to_fit(X, m)
a = exp( X(1) )
b = X(2)
[...]
endfunction
x = lsqrsolve([log(a0), b0], to_fit, N)
a_fit = exp(x(1))
hope it helps,
Best regards,
More information about the users
mailing list