[Scilab-users] Output Argument from the SCILAB ode function

Samuel Enibe samuel.enibe at unn.edu.ng
Mon Jun 29 07:24:46 CEST 2015


Thank you very much, *Samuel Gougeon* for your kind response. I really want
to use the *ode* function in the "iterated" mode so that a matrix
calculated in the function passed to *ode* function can be reused as input
in an iteration until a solution can be found.

I will appreciate any example of how to pass the arguments for the
"iterated" mode.

In the classic example


[y, w, iw] = ode([type,] y0, t0, t [,rtol [,atol]], f [,jac] [,w, iw])



(1) should the 2nd and 3rd output arguments be of the same dimensions with
y?
(2) should these 2nd and 3rd output arguments not be passed via a *list* as
in the examples given in SCILAB documentation?

I will appreciate any example of use of the "iterated" mode.

Samuel Ogbonna Enibe
BEng (Nig), MSc (Reading, England), PhD (Nig)
Professor of Mechanical Engineering
Dean, Faculty of Engineering
University of Nigeria, Nsukka, Nigeria
Tel: +2348063646798
Email: samuel.enibe at unn.edu.ng
     enibesam at yahoo.com

On Sun, Jun 28, 2015 at 11:57 AM, Samuel Gougeon <sgougeon at free.fr> wrote:

>  Hello,
>
> Le 27/06/2015 23:20, Samuel Enibe a écrit :
>
> 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.
> .
>
>  In normal mode (not for "root" or "discrete" ones), the second and third
> output arguments require to provide them also as (last) input arguments:
> [y, w, iw] = ode([type,] y0, t0, t [,rtol [,atol]], f [,jac] [,w, iw])
>
> This "iterated" mode is not really documented. It lacks of examples.
> Anyway, it does not look to be what you want to do.
>
> In the case that you've posted, the need to define (and provide) u()  is
> unclear.
> Indeed, omega and t are available in linear(), so sin(omega*) can be
> computed in it
> instead of an external u().
> By the way, even keeping u() does not require to provide it in the list:
> linear() sees it anyway.
> Finally, A is not modified while ode() is run. Nor dd=cos(A). Therefore,
> cos(A) can be
> computed out of ode(), without being among output arguments.
>
> Hope this helps
> Samuel Gougeon
>
>
> 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))
> ///////////////////////////////////////////////////////////
>
>
>
> _______________________________________________
> users mailing listusers at lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150629/06b5d2f7/attachment.htm>


More information about the users mailing list