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 ]
Torsten

Posts: 1,457
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
Torsten.


Date Subject Author
3/26/14
Read ode45
Matthew
3/26/14
Read Re: ode45
David Stevens
3/27/14
Read Re: ode45
Torsten

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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.