Changeset 28 for tests/testKF.cpp
- Timestamp:
- 02/22/08 16:40:12 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tests/testKF.cpp
r22 r28 22 22 23 23 bool xxx= fin.seek( "d" ); 24 if (!xxx){ it_error("testKF.it not found");} 24 25 fin >>Dt; 25 26 fin.seek( "A" ); … … 43 44 XtE=zeros( 2,Ndat ); 44 45 45 Kalman<fsqmat> KF( A,B,C,D,fsqmat(R),fsqmat(Q),fsqmat(P0),mu0 );46 46 // cout << KF; 47 KalmanFull KF2( A,B,C,D,R,Q,P0,mu0 );48 47 RV rx("1","{x}","2","0","0"); 49 48 RV ru("2","{u}","1","0","0"); 50 49 RV ry("3","{y}","1","0","0"); 50 // 51 Kalman<ldmat> KF(rx,ry,ru); 52 KF.set_parameters(A,B,C,D,ldmat(R),ldmat(Q)); 53 KF.set_est(mu0,ldmat(P0) ); 54 // 55 Kalman<fsqmat> KFf(rx,ry,ru); 56 KFf.set_parameters(A,B,C,D,fsqmat(R),fsqmat(Q)); 57 KFf.set_est(mu0,fsqmat(P0) ); 58 // 59 KalmanFull KF2( A,B,C,D,R,Q,P0,mu0 ); 60 // 51 61 bilinfn fxu(rx,ru,A,B); 52 62 bilinfn hxu(rx,ru,C,D); 53 EKF<fsqmat> KFE(&fxu,&hxu,Q,R,mu0,P0); 63 EKF<ldmat> KFE(rx,ry,ru); 64 KFE.set_parameters(&fxu,&hxu,Q,R); 65 KFE.set_est(mu0,P0); 54 66 55 Xt.set_col( 0, KF.mu);56 Xt2.set_col( 0,KF .mu );57 XtE.set_col( 0, KF.mu);67 Xt.set_col( 0,*((enorm<ldmat>*)(KF._epdf()))->_mu() ); 68 Xt2.set_col( 0,KF2.mu ); 69 XtE.set_col( 0,*((enorm<ldmat>*)(KFE._epdf()))->_mu() ); 58 70 for ( int t=1;t<Ndat;t++ ) { 71 KFf.bayes( Dt.get_col( t )); 59 72 KF.bayes( Dt.get_col( t )); 60 73 KF2.bayes( Dt.get_col( t )); 61 KFE.bayes( Dt.get_col( t ));62 Xt.set_col(t, KF.mu);74 // KFE.bayes( Dt.get_col( t )); 75 Xt.set_col(t,*((enorm<ldmat>*)(KF._epdf()))->_mu()); 63 76 Xt2.set_col(t,KF2.mu); 64 XtE.set_col(t,KFE.mu); 65 // Kmu = KF.mu; 66 // cout << "t:" <<t<< " " << dt<<" "<<Kmu <<endl; 77 XtE.set_col(t,*((enorm<ldmat>*)(KFE._epdf()))->_mu()); 67 78 } 68 79