Hello Heinz,

You can have a look at pages 45-49 of my slides on least Squares :

http://www.utc.fr/~mottelet/mt94/leastSquares.pdf

Page 48 you have an example where the Covariance matrix is approximated for a fitting problem with an ode defined page 42.

S.

Quoting Heinz Nabielek <[email protected]>:

Scilab friends: the power of Scilab is amazing and I have used it recently for non-linear least-squares fitting, below example from Scilab help function for "datafit". On occasions, I have also used "leastsq".
   
Question: how do I derive the 1sigma standard error in the three parameters p(1), p(2), and p(3)? And, if it is not too complicated, covariances?
   
I know this is written in dozens of textbooks, but I am always getting lost.
  Please provide a simple recipe written in Scilab.
  Best greetings
  Heinz
   
   
   
// -- 04/04/2020 14:57:30 -- ////generate the datafunction y=FF(x, p) y=p(1)*(x-p(2))+p(3)*x.*xendfunctionX=[]; Y=[]; pg=[34;12;14] //parameter used to generate datafor x=0:.1:3 Y=[Y,FF(x,pg)+100*(rand()-.5)]; X=[X,x]; endZ=[Y;X]; //The criterion functionfunction e=G(p, z), y=z(1),x=z(2); e=y-FF(x,p), endfunction//Solve the problemp0=[3;5;10][p,err]=datafit(G,Z,p0); scf(0);clf()plot2d(X,FF(X,pg),5) //the curve without noiseplot2d(X,Y,-1) // the noisy dataplot2d(X,FF(X,p),12) //the solutionxgrid();legend("the curve without noise"," the noisy data", "THE FINAL SOLUTION.....",4); title("solution set 39.868419 10.312053 11.482521","fontsize",4);
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to