【发布时间】:2012-12-29 19:22:09
【问题描述】:
我有以下 odeint 程序:
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
using namespace std;
typedef boost::array< double , 1 > state_type;
void eqsystem(const state_type &x, state_type &dxdt, double t) {
dxdt[0] = 3;
}
void write_system( const state_type &x , const double t ) {
cout << t << '\t' << x[0] << endl;
}
int main(){
double t0=0, t1=100;
double tstep0=0.01;
state_type x = {{ 0 }};
cout<<"t\tValue"<<endl;
boost::numeric::odeint::integrate( eqsystem , x , t0 , t1 , tstep0 , write_system );
}
每当t是10的倍数时,我想设置x[0]=0.1。
也就是说,我想要一个循环增量函数。
或者,如果我可以让 delta 函数在有限数量的时间点发生,我将能够近似递归。
很遗憾,我无法在 odeint 中找到关于 delta 函数的文档。有谁知道如何做到这一点?
【问题讨论】: