Changeset 32 for tests/testKF.cpp

Show
Ignore:
Timestamp:
03/03/08 13:00:32 (16 years ago)
Author:
smidl
Message:

test KF : estimation of R in KF is not possible! Likelihood of y_t is growing when R -> 0

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tests/testKF.cpp

    r28 r32  
    1818        it_file fin( "testKF.it" ); 
    1919 
    20         mat Dt, Xt,Xt2,XtE; 
     20        mat Dt, Xt,Xt2,XtE,Xtf; 
    2121        int Ndat; 
    2222 
     
    4242        Xt=zeros( 2,Ndat ); 
    4343        Xt2=zeros( 2,Ndat ); 
     44        Xtf=zeros( 2,Ndat ); 
    4445        XtE=zeros( 2,Ndat ); 
    4546 
    4647//      cout << KF; 
    47         RV rx("1","{x}","2","0","0"); 
    48         RV ru("2","{u}","1","0","0"); 
    49         RV ry("3","{y}","1","0","0"); 
     48        RV rx("1","{x}","2","0"); 
     49        RV ru("2","{u}","1","0"); 
     50        RV ry("3","{y}","1","0"); 
    5051        // 
    5152        Kalman<ldmat> KF(rx,ry,ru); 
     
    6566        KFE.set_est(mu0,P0); 
    6667 
    67         Xt.set_col( 0,*((enorm<ldmat>*)(KF._epdf()))->_mu() ); 
     68        epdf& KFep = KF._epdf(); 
     69        epdf& KFfep = KFf._epdf(); 
     70        epdf& KFEep = KFE._epdf(); 
     71         
     72        Xt.set_col( 0,KFep.mean() ); 
     73        Xtf.set_col( 0,KFfep.mean() ); 
    6874        Xt2.set_col( 0,KF2.mu ); 
    69         XtE.set_col( 0,*((enorm<ldmat>*)(KFE._epdf()))->_mu() ); 
     75        XtE.set_col( 0,KFEep.mean() ); 
    7076        for ( int t=1;t<Ndat;t++ ) { 
    7177                KFf.bayes( Dt.get_col( t )); 
    7278                KF.bayes( Dt.get_col( t )); 
    7379                KF2.bayes( Dt.get_col( t )); 
    74 //              KFE.bayes( Dt.get_col( t )); 
    75                 Xt.set_col(t,*((enorm<ldmat>*)(KF._epdf()))->_mu()); 
     80                KFE.bayes( Dt.get_col( t )); 
     81                Xt.set_col( t,KFep.mean() ); 
     82                Xtf.set_col( t,KFfep.mean() ); 
    7683                Xt2.set_col(t,KF2.mu); 
    77                 XtE.set_col(t,*((enorm<ldmat>*)(KFE._epdf()))->_mu()); 
     84                XtE.set_col( t,KFEep.mean() ); 
    7885        } 
    7986 
    8087        it_file fou( "testKF_res.it" ); 
    8188        fou << Name("xth") << Xt; 
     89        fou << Name("xthf") << Xtf; 
    8290        fou << Name("xth2") << Xt2; 
    8391        fou << Name("xthE") << XtE;