simple_integrator.cpp
Go to the documentation of this file.
1 
34 #include <acado_toolkit.hpp> // Include the ACADO toolkit
35 #include <acado/utils/matlab_acado_utils.hpp> // Include specific Matlab utils
36 
37 USING_NAMESPACE_ACADO // Open the namespace
38 
39 void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) // Start the MEX function. Do NOT change the header of this function.
40  {
41  clearAllStaticCounters( ); // Clear software counters
42 
43 
44  // Define a Right-Hand-Side:
45  // -------------------------
48  TIME t;
49 
50  f << dot(x) == -x + sin(0.01*t);
51 
52 
53 
54  // Define an integrator:
55  // ---------------------
56  IntegratorBDF integrator( f );
57 
58  // Define an initial value:
59  // ------------------------
60 
61  double x_start[1] = { 1.0 };
62 
63  double t_start = 0.0;
64  double t_end = 1000.0;
65 
66 
67  // START THE INTEGRATION
68  // ----------------------
69  integrator.set( INTEGRATOR_PRINTLEVEL, MEDIUM );
70  integrator.set( INTEGRATOR_TOLERANCE, 1.0e-3 );
71  integrator.set( PRINT_INTEGRATOR_PROFILE, YES );
72 
73 
74  integrator.freezeAll();
75  integrator.integrate( t_start, t_end, x_start );
76 
77 
78 
79  clearAllStaticCounters( ); // Clear software counters
80 }
81 
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
Implements the backward-differentiation formula for integrating DAEs.
returnValue set(OptionsName name, int value)
virtual returnValue freezeAll()
#define USING_NAMESPACE_ACADO
#define YES
Definition: acado_types.hpp:51
Expression dot(const Expression &arg)
returnValue clearAllStaticCounters()
const double t_end
const double t_start
USING_NAMESPACE_ACADO void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
returnValue integrate(double t0, double tend, double *x0, double *xa=0, double *p=0, double *u=0, double *w=0)
Definition: integrator.cpp:207
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:04