How does 'lsqrsolve ' work ?
Maso Ricci
ricci2 at unisi.it
Fri Mar 7 10:13:46 CET 2008
Hi everyone,
I would like to fit the experimental data "DAT" to the function "dx"
(see the script below) by the command "lsqrsolve" in order to obtain the
best value for the parameter "s".
I know how to do it with other softwares but I had some difficulties in
doing it by Scilab. Any suggestion is welcome.
Thanks.
/maso
PS: Here you are the script:
//---S T A R T -----
clear()
DAT = [1.12;
0.9;
0.59;
0.485;
0.36;
0.49;
0.244;
0.19;
0.15;
0.14;
0.12;
0.07647;
0.0729;
0.05777;
0.04;
0.031;
0.0235;
0.02249;
0.011;
0.01008;
0.0172;
0.0135995;
0.0086413;
0.0061709;
0.0054;
0.004953;
0.00399;
0.003279;
0.0024644;
0.0020171;
0.0016510;
0.0013515;
0.0011063;
0.0009056;
0.00074;
0.0006069;
0.0004968;
0.0004067;
0.0003329;
0.0002726;
0.0002231 ];
function dx = chemical(t,x)
dx =x- x*exp(s)
endfunction
s=5
t = 0:0.001:0.04;
x0=[1.2];
x = ode(x0,0,t,chemical) ;
AA=x(1,:);
AA=AA(:);
clf()
plot2d(t,x(1,:), style = 5)
plot2d(t,DAT(:,1), style = -2)
//---E N D -----
--
Maso Ricci Ph.D
Dept. of Chemical and Biosystem Science
University of Siena
Via A. Moro, 2 53100 Siena
ITALY
Tel: +39 0577 234367
Fax: +39 0577 234177
email: ricci2 at unisi.it
More information about the users
mailing list