本文整理汇总了C++中GnuplotWindow::addData方法的典型用法代码示例。如果您正苦于以下问题:C++ GnuplotWindow::addData方法的具体用法?C++ GnuplotWindow::addData怎么用?C++ GnuplotWindow::addData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GnuplotWindow
的用法示例。
在下文中一共展示了GnuplotWindow::addData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( ){
USING_NAMESPACE_ACADO
DifferentialState phi, omega; // the states of the pendulum
Parameter l, alpha ; // its length and the friction
const double g = 9.81 ; // the gravitational constant
DifferentialEquation f ; // the model equations
Function h ; // the measurement function
VariablesGrid measurements; // read the measurements
measurements = readFromFile( "data.txt" ); // from a file.
// --------------------------------------
OCP ocp(measurements.getTimePoints()); // construct an OCP
h << phi ; // the state phi is measured
ocp.minimizeLSQ( h, measurements ) ; // fit h to the data
f << dot(phi ) == omega ; // a symbolic implementation
f << dot(omega) == -(g/l) *sin(phi ) // of the model
- alpha*omega ; // equations
ocp.subjectTo( f ); // solve OCP s.t. the model,
ocp.subjectTo( 0.0 <= alpha <= 4.0 ); // the bounds on alpha
ocp.subjectTo( 0.0 <= l <= 2.0 ); // and the bounds on l.
// --------------------------------------
GnuplotWindow window;
window.addSubplot( phi , "The angle phi", "time [s]", "angle [rad]" );
window.addSubplot( omega, "The angular velocity dphi" );
window.addData( 0, measurements(0) );
ParameterEstimationAlgorithm algorithm(ocp); // the parameter estimation
algorithm << window;
algorithm.solve(); // algorithm solves the problem.
return 0;
}