Hello there.

Okay, let's say I have a system of 1st order ODEs to solve. So I create a function file which describes these functions called, say:

Code:

function dy = myfunction(t,y)

.

Now, to solve these ODEs using ODE45, I'd simply write a script file which says:

Code:

[t,y] = ode45(@myfunction, [t0 tf], [y10 y20 y30 y40...yn0])

, and ODE45 will perform the integration and spit out the solution in the vector y.

Now let's say I want to do the same thing again, but rather than use ODE45, I'd like to use my own integration scheme. So I begin to write my function file to perform the integration using, say, a modified Euler method. How would I write the file in such a way that it takes the same inputs as ode45, and produces the same outputs? How to I write my integration scheme to use myfunction(t,y)? I'm rather confused about it, and scanning over the ODE45 code to see how ODE45 does it is a bit beyond my scope.