ode with external input?
John Bechhoefer
johnb at sfu.ca
Mon May 4 08:10:42 CEST 2009
I would like to calculate the discrete-analog hybrid output of an ode
with arbitrary input, and I don't see how to pass an arbitrary input
function to odedc(). In particular, I would like to do something like
the following, where I have a list of times t and a list of input
values u at those times t. The function u(t) would then be constant
between those instants. (In the most general case, one would want to
do this for arbitrary times, but in my case, the times will always be
evenly spaced.)
t=0:0.1:10;
l=size(t,2);
u=rand(1,l,'normal'); // this is short for a complicated function
of t determined by a sub-program
// that is not practical to put into the deff statement, I think
nd=1; stdel=1; t0=0;
y=odedc(y0,nd,stdel,t0,t,u,f); // i.e., put an extra input u
here, the continuous part of the function would be ydot = f(y,t,u).
The input to f would be the "staircase" function made from u, whose
values are given at each element of the vector t.
All the examples I see in odedc and ode involve a well-defined
function u(t). In my case, my input ultimately can be put in such a
form, but there is a whole sub-program needed to calculate u(t). I
would like to just use the final result as an input to the ode / odecd
functions.
Hope this is clear. I'm a bit stuck on how to proceed.
Thanks / merci !
John
More information about the users
mailing list