#include #include #include using namespace bdm; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { // Klaman filter mat A, B,C,D,R,Q,P0; vec mu0; mat Mu0;// read from matlab // input from Matlab it_file fin ( "testKF.it" ); mat Dt, XQRt,eR,eQ; int Ndat; bool xxx= fin.seek ( "d" ); if ( !xxx ) { it_error ( "testKF.it not found" );} fin >>Dt; fin.seek ( "A" ); fin >> A; fin.seek ( "B" ); fin >> B; fin.seek ( "C" ); fin >> C; fin.seek ( "D" ); fin >> D; fin.seek ( "R" ); fin >> R; fin.seek ( "Q" ); fin >> Q; fin.seek ( "P0" ); fin >> P0; fin.seek ( "mu0" ); fin >> Mu0; mu0=Mu0.get_col ( 0 ); vec vQ1 = "0.01:0.04:1"; vec vQ2 = "0.01:0.04:1"; mat LL = zeros ( vQ1.length(), vQ2.length() ); Ndat = Dt.cols(); RV rx ( "{x}","2" ); RV ru ( "{u}","1" ); RV ry ( "{y}","2" ); // // Kalman KFtr ( rx,ry,ru ); for ( int i =0; i