在 python 中,我使用了ode来自scipy.integrate. 在那里,我使用vode积分器和zvode积分器来解决一些数字颂歌。我对这些方法提供的解决方案很满意,现在想知道 matlab 中的等效方法是什么。
我不熟悉 odes 的复杂性(刚度以及在每种情况下都适合哪些求解器)我只是想知道是否有与上述两种积分器方法等效的 matlab 例程,我可以轻松使用。
这是我如何定义一个应该及时前进的函数的示例
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