2
$\begingroup$

In python I have used the ode method from scipy.integrate. There I used the vodeintegrator and the zvode integrator to solve some numerical odes. I am happy with the solution provided by these methods and would now like to know what the equivalent methods are in matlab.

Im not familiar with the intricacies of odes (stiffness and which solvers are suitable in each case) I simply want to know if there is an equivalent matlab routine to the above two integrator methods which I can readily use.

Here is an example of how I have defined a function which should march forward in time

def time_march2(y0, x1_max):

   y0 = np.asarray(y0)
   t0 = 0
   tlimit = 100.0 

   backend = 'vode'  
   solver = ode(f2).set_integrator(backend, nsteps=1)
   solver.set_initial_value(y0, t0)
   # suppress Fortran-printed warning
   solver._integrator.iwork[2] = -1

   solution_y = [y0]
   solution_t = [t0]
   warnings.filterwarnings("ignore", category=UserWarning)

   while solver.successful() and solver.y[0] < x1_max and solver.t < tlimit:
      solver.integrate(tlimit, step=True)          
      solution_y.append(solver.y)
      solution_t.append(solver.t)


   warnings.resetwarnings()
   solution_y = np.array(solution_y)
   solution_t = np.array(solution_t)


   return solution_t, solution_y
$\endgroup$
4
$\begingroup$

If you want to use base MATLAB routines, ode15s is the closest analogue (see Shampine's paper), although you have to set options to ensure that it uses a BDF method instead of the default NDF method.

If you just want a MATLAB interface, SUNDIALS has a MATLAB interface to CVODE; CVODE is an updated version of VODE.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.