Date: Mar 27, 2014 3:44 AM
Author: Torsten
Subject: Re: ode45

"Matthew" wrote in message <lgvf54$86b$1@newscl01ah.mathworks.com>...
> Hello,
>
> I'm trying to use ode45 to solve a set of differential equations.
> Rp = 5;
> global Rp
> [t, y] = ode45('odefunctions', [.001:.001:.8], V0);
>
> Where odefunctions is a separate m_file:
>
> function [dydt] = odefunctions(t, y)
>
> global Rp
> Qao_current = Rp*t
>
> dydt = ones(2,1)
> dydt(1) = (Qao_current/c) - (y(1)/(Rp*c));
> dydt(1) = (0/c) - (y(2)/(Rp*c));
>
> Within odefunctions I need to define a variable thats dependent on t. This does not seem to work... and putting a loop within odefunctions does not work either... Qao_current should change with every t
>
> Any suggestions?
>
> Thanks!


What are V0 and c ? You did not define these variables.
Initialize dydt as dydt=zeros(2,1).
Why do you set dydt(1) two times ?

Best wishes
Torsten.