[Scilab-users] evaluate matrix in a function

Hermes herozigle at gmail.com
Sat Oct 7 13:05:10 CEST 2017


how do I declare the functions to be able to evaluate a matrix
variable(Multiple evaluation of a function). Where the first column
corresponds to the first variable of the function. And so on.
is only possible within a "for" cycle? how to declare the function to be
able to use the operator "dot"

r=[3 1;4 2;3 5;8 2];

function val = H(z)
    x=z(1);
    y=z(2); 
    val=(1.25*y-sqrt(abs(x)))^2+x^2-1; 
endfunction;


function Sys=g(x)
  gx=x(1);
  gy=x(2);  
g1=2*gx-(gx*(1.25*gy-sqrt(abs(gx))))/abs(gx)^(3/2);
g2=2.5*(1.25*gy-sqrt(abs(gx)));
  Sys(:,1)=g1;
  Sys(:,2)=g2;
endfunction

V=g(r)';
disp(V,"g");
J = diffcode_jacobian(H,r);
disp(J, "Jacobian");

Gracias
Hermes



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list