[Scilab-users] Command datafit for a bivarate model function z=f(x, y)

Serge Steer serge.steer at inria.fr
Tue Dec 16 13:39:52 CET 2014


Here is a working code

function z=!z(x,y,p)
  z=p(1)*x.^2 + p(2)*y.^2
endfunction
pg=[5;6]//parameter of fictitious data
X=0:5;Y=0:5; Z=!z(X,Y,pg)
M=[X;Y;Z];//measurement matrix, 3 rows, 6 colomns      
function e=!e(p,m),
  x=m(1), y=m(2); z=m(3),
  e=z-!z(x,y,p)
endfunction
p0=[2;3];
[p,err]=datafit(1,!e,M,p0)
z=!z(X,Y,p)

Serge Steer
----- Mail original -----
> De: "Jens" <j.s.strom at hslmg.de>
> À: users at lists.scilab.org
> Envoyé: Lundi 15 Décembre 2014 23:00:43
> Objet: [Scilab-users] Command datafit for a bivarate model function z=f(x,	y)
> 
> I tried to follow the pattern for data fit given in the thread
> http://mailinglists.scilab.org/Convert-x-y-z-data-into-a-z-f-x-y-function-td4026897.html#a4026925
> for the simple bivariate function
>  z=p(1)*x.^2 + p(2)*y.^2
> by this script:
> 
>     mode(0),   lines(0),   clc(), clear
>     deff( 'z=!z(x,y,p)','z=p(1)*x.^2 + p(2)*y.^2')//model function
>     pg=[5;6]//parameter of fictitious data
>     X=[0:5];Y=[0:5]; Z=!z(X,Y,pg)
>     M=[X;Y;Z];//measurement matrix, 3 rows, 6 colomns
>     deff(' e=!e(p,m)','x=M(1), y=M(2); z=M(3),e=z-!z(x,y)')//defect
> (critereon- , error-,) function
>     p0=[2;3];
>     [p,err]=datafit(1,!e,M,p0)
>     err,
>     z=!z(X,Y,p)
> 
> However the script just returns p0 as solution. Would anyone kindly help me
> to find the flaw?
> 
> Kind regards
> Jens
> 
> 
> 
> 
> --
> View this message in context:
> http://mailinglists.scilab.org/Command-datafit-for-a-bivarate-model-function-z-f-x-y-tp4031533.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at
> Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
> 



More information about the users mailing list