Le 28/08/2016 22:48, Robert Sherry a écrit :
Samuel,

Thanks for the response. While the example, I showed is linear, the equations I want to solve are not. I am thinking I need a third function which returns a vector. Am I on the right track?
.
Then it would have been great to post a non-linear sample with sin(x), etc ;) Only one function -- but vectorized -- is required. Here is an example (non-linear :):
function Z = f(u)
  x = u(1)
  y = u(2)
   Z = [ sin(x)-y+3
         cos(y)+x-2
       ]
endfunction
s = fsolve([0 0]',f)
[ sin(s(1))-s(2)+3  cos(s(2))+s(1)-2]  // Check

--> function Z = f(u)
  >   x = u(1)
  >   y = u(2)
  >    Z = [ sin(x)-y+3
  >          cos(y)+x-2
  >        ]
  > endfunction

--> s = fsolve([0 0]',f)
 s  =
   2.9999999
   3.1411201


--> [ sin(s(1))-s(2)+3  cos(s(2))+s(1)-2]  // Check
 ans  =
   4.441D-16  -1.332D-15

// Samuel

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to