【问题标题】:Nonlinear time-varying system inputs with boost::odeint带 bo​​ost::odeint 的非线性时变系统输入
【发布时间】:2014-05-23 07:45:14
【问题描述】:

我正在研究使用最优控制方法(轨迹生成和优化)的无限维优化算法。我想对其进行轨迹优化的系统是非线性的,形式为 $\dot{x}(t) = f(x(t), u(t), t)$。换句话说,我有随时间变化的非线性输入。

是否可以使用 boost::odeint 解决这样的 ODE?我没有在文档中找到任何提示,但我可能只是没有看到它。

【问题讨论】:

    标签: boost odeint


    【解决方案1】:

    是的,您可以使用 odeint 来解决这类问题。显式步进器期望您传递给 odeint 的系统函数(ODE)具有签名

    ode( x , dxdt , t );
    

    其中x 是当前状态的输入参数,dxdt 是r.h.s 的输出参数。 ODE 的 t 是时间。例如,驱动振荡器的实现可能类似于

    typedef std::array< double , 2 > state_type;
    
    struct oscillator
    {
        double driving_strength;
        double dribving_frequency;
    
        void operator()( state_type const &x , state_type &dxdt , double t ) const
        {
            dxdt[0] = x[1];
            dxdt[1] = -x[0] + driving_strength * sin( driving_frequency * t );
        }
    };
    
    state_type x;
    oscillator osc;
    // initialize x and osc 
    runge_kutta4< state_type > stepper;
    integrate_const( stepper , osc , x , t_start , t_end , dt );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-18
      • 2016-06-15
      • 2012-05-20
      • 1970-01-01
      • 2017-03-13
      相关资源
      最近更新 更多