"Meiyour" wrote in message <email@example.com>... > 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 <firstname.lastname@example.org>... > > "Meiyour" wrote in message <email@example.com>... > > > 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