The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Using the ODE solver in a FOR loop
Replies: 11   Last Post: Jul 18, 2013 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: 108
Registered: 7/2/10
Re: Using the ODE solver in a FOR loop
Posted: Jul 16, 2013 1:09 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Meiyour" wrote in message <ks1376$ot5$>...
> Actually, i am trying to solve 4 coupled partial differential equations by the method of lines. I have discretized the space derivative, leaving me with 4 ODEs to solve.
> However, i am having problems defining the four ODEs within the same for loop.
> The ODE15s loops through the time elements defined. I want to incorporate a for loop which makes the code iterate through the discretized space elements too.
> Basically, i need to use the method of lines for four coupled partial differential equations.
> Hope i'm making a bit of sense. Would really appreciate your help.
> "Torsten" wrote in message <ks0uf0$ba9$>...

> > "Meiyour" wrote in message <ks0rsi$3k3$>...
> > > Hi. I need some help with the ODE15 solver.
> > >
> > > I am trying to use the solver four coupled partial differential equations, using the method of lines. However, i need to include the solver in a for loop, but every attemp i've made so far has proved abortive.
> > >
> > > How do i gi about this? Need something like:
> > >
> > > For i=1:n
> > > u1( t(i), y1(i) ) = ode15(..........);
> > > u2( t(i), y2(i) ) = ode15(...........);
> > > end
> > >
> > > Ant help would be greatly appreciated.

> >
> > What are you trying to do in the above loop ?
> >
> > Best wishes

See Shampine, et al... for Matlab AND MOL. If you set up your function correctly, there should be no need to use a for loop. By setting the time interval, ODE15s is smart enough to find the t and y answers for that interval. If for some reason you think ode15s runs into some issue within that time interval, using a for loop to break up the time span may be appropriate.

Albeit, I have rarely seen this to be the case.

Otherwise, you will need to provide a bit more detail regarding your system and any code that you have attempted for us to be more helpful

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

[Privacy Policy] [Terms of Use]

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