<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 28/08/2016 22:48, Robert Sherry a
      écrit :<br>
    </div>
    <blockquote
      cite="mid:15e29e54-d879-60aa-a383-42403f14b58a@comcast.net"
      type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Samuel,<br>
        <br>
        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?<br>
      </div>
    </blockquote>
    . <br>
    Then it would have been great to post a non-linear sample with
    sin(x), etc ;)<br>
    Only one function -- but vectorized -- is required. Here is an
    example (non-linear :):<br>
    <tt>function Z = f(u)</tt><tt><br>
    </tt><tt>  x = u(1)</tt><tt><br>
    </tt><tt>  y = u(2)</tt><tt><br>
    </tt><tt>   Z = [ sin(x)-y+3</tt><tt><br>
    </tt><tt>         cos(y)+x-2</tt><tt><br>
    </tt><tt>       ]</tt><tt><br>
    </tt><tt>endfunction </tt><tt><br>
    </tt><tt>s = fsolve([0 0]',f)</tt><tt><br>
    </tt><tt>[ sin(s(1))-s(2)+3  cos(s(2))+s(1)-2]  // Check</tt><tt><br>
    </tt><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva,
      Helvetica, Arial, sans-serif; font-size: 13.44px; font-style:
      normal; font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: normal; letter-spacing: normal; line-height: normal;
      orphans: 2; text-align: start; text-indent: 0px; text-transform:
      none; white-space: normal; widows: 2; word-spacing: 0px;
      -webkit-text-stroke-width: 0px; display: inline !important; float:
      none; background-color: rgb(255, 255, 255);"><br>
    </span><tt>--> function Z = f(u)</tt><tt><br>
    </tt><tt>  >   x = u(1)</tt><tt><br>
    </tt><tt>  >   y = u(2)</tt><tt><br>
    </tt><tt>  >    Z = [ sin(x)-y+3</tt><tt><br>
    </tt><tt>  >          cos(y)+x-2</tt><tt><br>
    </tt><tt>  >        ]</tt><tt><br>
    </tt><tt>  > endfunction</tt><tt><br>
    </tt><tt><br>
    </tt><tt>--> s = fsolve([0 0]',f)</tt><tt><br>
    </tt><tt> s  = </tt><tt><br>
    </tt><tt>   2.9999999</tt><tt><br>
    </tt><tt>   3.1411201</tt><tt><br>
    </tt><tt><br>
    </tt><tt><br>
    </tt><tt>--> [ sin(s(1))-s(2)+3  cos(s(2))+s(1)-2]  // Check</tt><tt><br>
    </tt><tt> ans  =</tt><tt><br>
    </tt><tt>   4.441D-16  -1.332D-15</tt><tt><br>
    </tt><tt><br>
    </tt>// Samuel<br>
    <br>
  </body>
</html>