Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: ode45
Replies: 2   Last Post: Mar 27, 2014 3:44 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Torsten Posts: 1,709 Registered: 11/8/10
Re: ode45
Posted: Mar 27, 2014 3:44 AM
 Plain Text Reply

"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.

Date Subject Author
3/26/14 Matthew
3/26/14 David Stevens
3/27/14 Torsten

© The Math Forum at NCTM 1994-2017. All Rights Reserved.