[Scilab-users] datafit( ): gradient option at complex valued model function with real variables and parameters

Jens j.s.strom at hslmg.de
Sun Dec 21 11:41:47 CET 2014


datafit is capable of fitting a complex valued function provided the gradient
option ist not used, see script below.
Does anyone see a way to modify the script so that the gradient option
works?
    
    mode(0),   lines(0),   clc(), clear 
    function z=!z(x,y,p)// complex valued model function   
      z=p(1)*x.^2 + %i*p(2)*y.^2 + %i*p(3)*x.*y
    endfunction
    
//    function grad=!grad(p,m)// complex valued gradient
//        x=m(1)
//        y=m(2)
//        grad=-[x.^2, %i*y.^2, %i*x.*y]
//    endfunction
   
    function e=!e(p,m)//defect function
      e=abs( m(3)-!z( m(1),m(2),p ) )    
    endfunction
   
    pf=[3;4;5];//parameters of fictitious measurements
    X=[0:5]; Y=X+1;Z=!z(X,Y,pf);
    M=[X;Y;Z];//measurement matrix, 3 rows
     
    p0=[0;0;0];//Startparameter
    [p,err]=datafit(1,!e,M,'b',[0;0;0],[8;8;8],p0)
    //[p,err]=datafit(1,!e,!grad,M,p0)
    err


Kind regards, Jens



--
View this message in context: http://mailinglists.scilab.org/datafit-gradient-option-at-complex-valued-model-function-with-real-variables-and-parameters-tp4031558.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list