This example looks at a use for the Simulator class
View output (PDF) | source (python)
- See also
43 alpha = SX.sym(
'alpha')
45 sigma = SX.sym(
'sigma')
48 params = vertcat(eps,mu,alpha,k,sigma)
49 rhs = vertcat(v,-u-eps*(2*mu*v+alpha*u**3+2*k*u*cos(Omega*t)))
53 dae={
'x':states,
'p':params,
't':t,
'ode':rhs}
54 ts = linspace(0, 50, 1000)
55 integrator =
integrator(
'integrator',
'cvodes', dae, {
'grid':ts,
'output_t0':
True})
57 sol =
integrator(x0=[1,0], p=[0.1,0.1,0.1,0.3,0.1])
61 plot(array(sol[
'xf'])[0,:], array(sol[
'xf'])[1,:])
CASADI_EXPORT Function integrator(const std::string &name, const std::string &solver, const SXDict &dae, const Dict &opts=Dict())