Changeset 1158 for library/tests
- Timestamp:
- 08/17/10 22:06:50 (14 years ago)
- Location:
- library/tests/stresssuite
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/stresssuite/kalman_stress.cpp
r1064 r1158 51 51 RV ry ( "{y }", vec_1 ( C.rows() ) ); 52 52 53 // // LDMAT 54 // Kalman<ldmat> KF(rx,ry,ru); 55 // KF.set_parameters(A,B,C,D,ldmat(R),ldmat(Q)); 56 // KF.set_est(mu0,ldmat(P0) ); 57 // epdf& KFep = KF.posterior(); 58 // mat Xt(2,Ndat); 59 // Xt.set_col( 0,KFep.mean() ); 53 // LDMAT 54 EKF_UD KFu; 55 KFu.set_rv(rx); 56 KFu.set_yrv(ry); 57 KFu.set_rvc(ru); 58 shared_ptr<bilinfn> f=new bilinfn; f->set_parameters(A,B); 59 shared_ptr<bilinfn> h=new bilinfn; h->set_parameters(C,D); 60 KFu.set_parameters(f,h,Q,diag(R)); 61 KFu.prior()._mu()=mu0; 62 KFu.prior()._R()=ldmat(P0); 63 const epdf& KFuep = KFu.posterior(); 64 mat Xtu(dimx,Ndat); 65 Xtu.set_col( 0,KFuep.mean() ); 60 66 61 67 //Chol … … 99 105 for ( int t = 1; t < Ndat; t++ ) { 100 106 dt = Dt.get_col ( t ); 101 KF .bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) );102 Xt .set_col ( t, KFep.mean() );107 KFu.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 108 Xtu.set_col ( t, KFuep.mean() ); 103 109 } 104 110 exec_times ( 0 ) = tt.toc(); … … 122 128 123 129 it_file fou ( "kalman_stress_res.it" ); 124 fou << Name ( "xth " ) << Xt;130 fou << Name ( "xthu" ) << Xtu; 125 131 fou << Name ( "xth2" ) << Xt2; 126 132 fou << Name ( "xthE" ) << XtE; -
library/tests/stresssuite/kalman_stress.m
r721 r1158 60 60 Mu(1:2,t)=mu; 61 61 62 [Oxt,OPt,ll(t)] = Kalman(Oxt,y(:,t),A,C,Q,R,OPt);62 % [Oxt,OPt,ll(t)] = Kalman(Oxt,y(:,t),A,C,Q,R,OPt); 63 63 % [oxt,oPt,oll(t)] = KalmanSq(oxt,y(:,t),A,C,sQ,sR,oPt); 64 MuK(1:2,t) = Oxt;64 % MuK(1:2,t) = Oxt; 65 65 % MuS(1:2,t) = oxt; 66 66 end … … 68 68 %keyboard 69 69 70 ! cd ../;./tests/testKF71 itload(' testKF_res.it');70 !./stresssuite kalman_stress 71 itload('kalman_stress_res.it'); 72 72 73 73 hold off … … 77 77 plot(xth2','+'); 78 78 plot(xthE','o'); 79 plot([zeros(size(xth,1),1) MuK]','d'); % shift the predictions79 %plot([zeros(size(xth,1),1) MuK]','d'); % shift the predictions 80 80 81 81 exec_times