Changeset 538 for library/doc/html/kalman.html
- Timestamp:
- 08/16/09 18:14:04 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/doc/html/kalman.html
r472 r538 5 5 <link href="doxygen.css" rel="stylesheet" type="text/css"> 6 6 </head><body> 7 <!-- Generated by Doxygen 1.5. 9-->7 <!-- Generated by Doxygen 1.5.8 --> 8 8 <script type="text/javascript"> 9 9 <!-- … … 84 84 <div class="fragment"><pre class="fragment"><span class="preprocessor">#include "<a class="code" href="kalman_8h.html" title="Bayesian Filtering for linear Gaussian models (Kalman Filter) and extensions.">estim/kalman.h</a>"</span> 85 85 <span class="keyword">using namespace </span>bdm; 86 86 87 87 <span class="comment">// estimation of AR(0) model</span> 88 88 <span class="keywordtype">int</span> main() { 89 89 <span class="comment">//dimensions</span> 90 <span class="keywordtype">int</span> dx =3, dy=3, du=1;90 <span class="keywordtype">int</span> dx = 3, dy = 3, du = 1; 91 91 <span class="comment">// matrices</span> 92 mat A = eye (dx);93 mat B = zeros (dx,du);94 mat C = eye (dx);95 mat D = zeros (dy,du);96 mat Q = eye (dx);97 mat R = 0.1 *eye(dy);92 mat A = eye ( dx ); 93 mat B = zeros ( dx, du ); 94 mat C = eye ( dx ); 95 mat D = zeros ( dy, du ); 96 mat Q = eye ( dx ); 97 mat R = 0.1 * eye ( dy ); 98 98 <span class="comment">//prior</span> 99 mat P0 = 100 *eye(dx);100 vec mu0 = zeros (dx);99 mat P0 = 100 * eye ( dx ); 100 vec mu0 = zeros ( dx ); 101 101 <span class="comment">// Estimator</span> 102 102 KalmanCh KF; 103 KF.set_parameters (A,B,C,D,<span class="comment">/*covariances*/</span> Q,R);104 KF.set_statistics (mu0,P0);103 KF.set_parameters ( A, B, C, D,<span class="comment">/*covariances*/</span> Q, R ); 104 KF.set_statistics ( mu0, P0 ); 105 105 <span class="comment">// Estimation loop</span> 106 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<100;i++){107 KF.bayes (randn(dx+du));106 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < 100; i++ ) { 107 KF.bayes ( randn ( dx + du ) ); 108 108 } 109 109 <span class="comment">//print results</span> 110 110 cout << <span class="stringliteral">"Posterior estimate of x is: "</span> << endl; 111 cout << <span class="stringliteral">"mean: "</span> << KF.posterior().mean()<< endl;112 cout << <span class="stringliteral">"variance: "</span> << KF.posterior().variance()<< endl;111 cout << <span class="stringliteral">"mean: "</span> << KF.posterior().mean() << endl; 112 cout << <span class="stringliteral">"variance: "</span> << KF.posterior().variance() << endl; 113 113 } 114 114 </pre></div> </div> 115 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Aug 5 00:06:512009 for mixpp by 115 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 16 17:58:18 2009 for mixpp by 116 116 <a href="http://www.doxygen.org/index.html"> 117 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5. 9</small></address>117 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> 118 118 </body> 119 119 </html>