Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1,577
Registered: 11/8/10
Re: ode45
Posted: Mar 27, 2014 3:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic 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

Date Subject Author
Read ode45
Read Re: ode45
David Stevens
Read Re: ode45

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.