60 f <<
dot(phi ) == omega;
61 f <<
dot(omega) == -(g/l)*
sin(phi) - alpha*omega;
79 S(0,0) = 1.0/
pow(0.1,2);
86 measurements =
readFromFile(
"parameter_estimation_data.txt" );
89 printf(
"The file \"parameter_estimation_data.txt\" can't be opened.");
100 ocp.subjectTo( 0.0 <= alpha <= 4.0 );
101 ocp.subjectTo( 0.0 <= l <= 2.0 );
103 ocp.subjectTo( g == 9.81 );
110 window.
addSubplot( phi,
"The angle phi",
"time [s]",
"angle [rad]" );
111 window.
addSubplot( omega,
"The angular velocity omega" );
112 window.
addSubplot( l,
"The length of the pendulum l" );
113 window.
addSubplot( alpha,
"Frictional constant alpha" );
144 printf(
"\n\nResults for the parameters: \n");
145 printf(
"-----------------------------------------------\n");
146 printf(
" l = %.3e +/- %.3e \n", parameters(0,0),
sqrt( var(0,0) ) );
147 printf(
" alpha = %.3e +/- %.3e \n", parameters(0,1),
sqrt( var(1,1) ) );
148 printf(
" g = %.3e +/- %.3e \n", parameters(0,2),
sqrt( var(2,2) ) );
149 printf(
"-----------------------------------------------\n\n\n");
156 window.addData( 0, measurements(0) );
157 window.addLine( 2, parameters(0,0) +
sqrt( var(0,0) ) );
158 window.addLine( 2, parameters(0,0) -
sqrt( var(0,0) ) );
159 window.addLine( 3, parameters(0,1) +
sqrt( var(1,1) ) );
160 window.addLine( 3, parameters(0,1) -
sqrt( var(1,1) ) );
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
Allows to setup and evaluate a general function based on SymbolicExpressions.
IntermediateState sqrt(const Expression &arg)
returnValue getPlotWindow(uint idx, PlotWindow &_window) const
#define USING_NAMESPACE_ACADO
Provides a time grid consisting of vector-valued optimization variables at each grid point...
IntermediateState pow(const Expression &arg1, const Expression &arg2)
BooleanType isEmpty() const
returnValue getParameters(VariablesGrid &u_) const
returnValue getParameterVarianceCovariance(DMatrix &pVar)
returnValue addSubplot(PlotWindowSubplot &_subplot)
returnValue readFromFile(real_t *data, int nrow, int ncol, const char *datafilename)
User-interface to formulate and solve parameter estimation problems.
returnValue minimizeLSQ(const DMatrix &S, const Function &h, const DVector &r)
Grid getTimePoints() const
Data class for defining optimal control problems.
Expression dot(const Expression &arg)
Provides an interface to Gnuplot for plotting algorithmic outputs.
virtual returnValue solve()
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.