From: Alex on
So I have two seperate programs. The first, solved by ODE45 outputs matrix [t,Q], the second outputs matrix [t,P] also solved by ODE45.

I need to use the results [t,Q] in the right hand side equation that ODE45 solves for [t,P].

Run the first program, obtain [t,Q], now I need to use Q at time t in the program that obtains [t,P]

i.e something like

P(t) = k*Q(t);

what is the syntax for this?
From: Steven Lord on

"Alex " <a.mlw.walker(a)googlemail.com> wrote in message
news:hqi27o$nbh$1(a)fred.mathworks.com...
> So I have two seperate programs. The first, solved by ODE45 outputs matrix
> [t,Q], the second outputs matrix [t,P] also solved by ODE45.
>
> I need to use the results [t,Q] in the right hand side equation that ODE45
> solves for [t,P].
>
> Run the first program, obtain [t,Q], now I need to use Q at time t in the
> program that obtains [t,P]
>
> i.e something like
>
> P(t) = k*Q(t);
>
> what is the syntax for this?

And what if you need to obtain a value for "Q(t)" at a time for which the
first ODE45 call did not return a value?

Specify _one_ output for your first ODE45 call then pass that structure into
your second ODE45 call's ODE function and use DEVAL to evaluate the solution
at desired times.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ