00001 00034 #include <acado_toolkit.hpp> // Include the ACADO toolkit 00035 #include <acado/utils/matlab_acado_utils.hpp> // Include specific Matlab utils 00036 00037 USING_NAMESPACE_ACADO // Open the namespace 00038 00039 void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) // Start the MEX function. Do NOT change the header of this function. 00040 { 00041 clearAllStaticCounters( ); // Clear software counters 00042 00043 00044 // Define a Right-Hand-Side: 00045 // ------------------------- 00046 DifferentialState x; 00047 DifferentialEquation f; 00048 TIME t; 00049 00050 f << dot(x) == -x + sin(0.01*t); 00051 00052 00053 00054 // Define an integrator: 00055 // --------------------- 00056 IntegratorBDF integrator( f ); 00057 00058 // Define an initial value: 00059 // ------------------------ 00060 00061 double x_start[1] = { 1.0 }; 00062 00063 double t_start = 0.0; 00064 double t_end = 1000.0; 00065 00066 00067 // START THE INTEGRATION 00068 // ---------------------- 00069 integrator.set( INTEGRATOR_PRINTLEVEL, MEDIUM ); 00070 integrator.set( INTEGRATOR_TOLERANCE, 1.0e-3 ); 00071 integrator.set( PRINT_INTEGRATOR_PROFILE, YES ); 00072 00073 00074 integrator.freezeAll(); 00075 integrator.integrate( t_start, t_end, x_start ); 00076 00077 00078 00079 clearAllStaticCounters( ); // Clear software counters 00080 } 00081