Your code has the solution (for the matrix function output).

Do the same for input:


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;



Regards,

Rafael



-----Original Message-----
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Hermes
Sent: Saturday, October 07, 2017 1:05 PM
To: users@lists.scilab.org
Subject: [Scilab-users] evaluate matrix in a function



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


_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to