<div dir="ltr"><div><div>Thank you very much,<span name="Samuel Gougeon" class=""> <b>Samuel Gougeon</b> for your kind response. I really want to use the <b>ode</b> function in the "iterated" mode so that a matrix calculated in the function passed to <b>ode</b> function can be reused as input in an iteration until a solution can be found.<br><br></span></div><span name="Samuel Gougeon" class="">I will appreciate any example of how to pass the arguments for the "iterated" mode.<br><br></span></div><div><span name="Samuel Gougeon" class="">In the classic example<br><br></span><br><tt>[y, w, iw] = ode([type,] y0, t0, t [,rtol [,atol]], f [,jac]
      [,w, iw])<br><br><br><br></tt></div><div><tt>(1) should the 2nd and 3rd output arguments be of the same dimensions with y?<br></tt></div><div><tt>(2) should </tt><tt>these 2nd and 3rd output arguments not be passed via a <b>list</b> as in the examples given in SCILAB documentation?<br><br></tt></div><div><tt>I will appreciate any example of use of the "iterated" mode.<br></tt></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Samuel Ogbonna Enibe<br>BEng (Nig), MSc (Reading, England), PhD (Nig)<br>Professor of Mechanical Engineering<br>Dean, Faculty of Engineering<br>University of Nigeria, Nsukka, Nigeria<br>Tel: +2348063646798<br>Email: <a href="mailto:samuel.enibe@unn.edu.ng" target="_blank">samuel.enibe@unn.edu.ng</a><br>  Â Â  <a href="mailto:enibesam@yahoo.com" target="_blank">enibesam@yahoo.com</a></div></div></div></div></div>
<br><div class="gmail_quote">On Sun, Jun 28, 2015 at 11:57 AM, Samuel Gougeon <span dir="ltr"><<a href="mailto:sgougeon@free.fr" target="_blank">sgougeon@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Hello,<span class=""><br>
      <br>
      Le 27/06/2015 23:20, Samuel Enibe a Ã©crit :<br>
    </span></div>
    <blockquote type="cite">
      <pre>I would like to use the SCILAB ode function with the option of second
or more output arguments activated. In the example shown below (also
attached), I would like to pass the variable dd in line 3 of the
function linear.

When the ode function is called without the second output argument as
in line 12, it works, but when the second output argument is included
as in line 13, it does not work.
.</pre>
    </blockquote>
    In normal mode (not for "root" or "discrete" ones), the second and
    third<br>
    output arguments require to provide them also as (last) input
    arguments:<br>
    <tt>[y, w, iw] = ode([type,] y0, t0, t [,rtol [,atol]], f [,jac]
      [,w, iw])</tt><br>
    <br>
    This "iterated" mode is not really documented. It lacks of examples.
    <br>
    Anyway, it does not look to be what you want to do.<br>
    <br>
    In the case that you've posted, the need to define (and provide)
    u()  is unclear. <br>
    Indeed, omega and t are available in linear(), so sin(omega*) can be
    computed in it <br>
    instead of an external u().<br>
    By the way, even keeping u() does not require to provide it in the
    list: <br>
    linear() sees it anyway.<br>
    Finally, A is not modified while ode() is run. Nor dd=cos(A).
    Therefore, cos(A) can be<br>
    computed out of ode(), without being among output arguments.<br>
    <br>
    Hope this helps<br>
    Samuel Gougeon<br>
    <br>
    <blockquote type="cite"><span class="">
      <pre>
Any help in correcting this will be greatly appreciated.

///////////////////////////////////////////////////////////////////
function [xdot, dd] =linear(t, x, A, u, B, omega)
    xdot=A*x+B*u(t,omega);
    dd = cos(A);
endfunction
function ut=u(t, omega)
    ut=sin(omega*t)
endfunction
A=[1 1;0 2];
B=[1;1];
omega=5;
y0=[1;0];
t0=0;
t=[0.1,0.2,0.5,1];
[y] = ode(y0,t0,t,list(linear,A,u,B,omega))
[y1, dd] = ode(y0,t0,t,list(linear,A,u,B,omega))
///////////////////////////////////////////////////////////
</pre>
      <br>
      <fieldset></fieldset>
      <br>
      </span><pre>_______________________________________________
users mailing list
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>