| 8 | <script type="text/javascript"> |
| 9 | <!-- |
| 10 | function changeDisplayState (e){ |
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
| 12 | var button=this.firstChild; |
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
| 15 | sectionDiv.style.display='block'; |
| 16 | button.src='open.gif'; |
| 17 | }else{ |
| 18 | sectionDiv.style.display='none'; |
| 19 | button.src='closed.gif'; |
| 20 | } |
| 21 | } |
| 22 | function initDynSections(){ |
| 23 | var divs=document.getElementsByTagName('div'); |
| 24 | var sectionCounter=1; |
| 25 | for(var i=0;i<divs.length-1;i++){ |
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
| 27 | var header=divs[i]; |
| 28 | var section=divs[i+1]; |
| 29 | var button=header.firstChild; |
| 30 | if (button!='IMG'){ |
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
| 32 | button=document.createElement('img'); |
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
| 34 | } |
| 35 | header.style.cursor='pointer'; |
| 36 | header.onclick=changeDisplayState; |
| 37 | header.id='dynheader'+sectionCounter; |
| 38 | button.src='closed.gif'; |
| 39 | section.id='dynsection'+sectionCounter; |
| 40 | section.style.display='none'; |
| 41 | section.style.marginLeft='14px'; |
| 42 | sectionCounter++; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | window.onload = initDynSections; |
| 47 | --> |
| 48 | </script> |
36 | | <p><center><img src="classbdm_1_1KalmanCh__inherit__graph.png" border="0" usemap="#bdm_1_1KalmanCh__inherit__map" alt="Inheritance graph"></center> |
37 | | <map name="bdm_1_1KalmanCh__inherit__map"> |
38 | | <area shape="rect" href="classbdm_1_1EKFCh.html" title="Extended Kalman Filter in Square root." alt="" coords="103,423,201,449"><area shape="rect" href="classbdm_1_1Kalman.html" title="bdm::Kalman\< chmat \>" alt="" coords="64,263,240,289"><area shape="rect" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities." alt="" coords="89,87,167,113"><area shape="rect" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form." alt="" coords="149,167,315,193"><area shape="rect" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects." alt="" coords="72,7,184,33"><area shape="rect" href="classbdm_1_1EKFCh__cond.html" title="Extended Kalman filter with unknown parameters in IM." alt="" coords="5,503,141,529"><area shape="rect" href="classbdm_1_1EKFCh__unQ.html" title="Extended Kalman filter in Choleski form with unknown Q." alt="" coords="165,503,296,529"></map> |
39 | | <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div> |
| 76 | |
| 77 | <p><center><img src="classbdm_1_1KalmanCh.png" usemap="#bdm::KalmanCh_map" border="0" alt=""></center> |
| 78 | <map name="bdm::KalmanCh_map"> |
| 79 | <area href="classbdm_1_1Kalman.html" alt="bdm::Kalman< chmat >" shape="rect" coords="74,112,213,136"> |
| 80 | <area href="classbdm_1_1BM.html" alt="bdm::BM" shape="rect" coords="74,56,213,80"> |
| 81 | <area href="classbdm_1_1bdmroot.html" alt="bdm::bdmroot" shape="rect" coords="74,0,213,24"> |
| 82 | <area href="classbdm_1_1EKFCh.html" alt="bdm::EKFCh" shape="rect" coords="74,224,213,248"> |
| 83 | <area href="classbdm_1_1EKFCh__cond.html" alt="bdm::EKFCh_cond" shape="rect" coords="0,280,139,304"> |
| 84 | <area href="classbdm_1_1EKFCh__unQ.html" alt="bdm::EKFCh_unQ" shape="rect" coords="149,280,288,304"> |
| 85 | </map> |
| 86 | </div> |
43 | | <a class="el" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a> filter in square root form. <table border="0" cellpadding="0" cellspacing="0"> |
| 90 | <a class="el" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a> filter in square root form. |
| 91 | <p> |
| 92 | Trivial example: <div class="fragment"><pre class="fragment"><span class="preprocessor">#include <<a class="code" href="libKF_8h.html" title="Bayesian Filtering for linear Gaussian models (Kalman Filter) and extensions.">estim/libKF.h</a>></span> |
| 93 | <span class="keyword">using namespace </span>bdm; |
| 94 | |
| 95 | <span class="comment">// estimation of AR(0) model</span> |
| 96 | <span class="keywordtype">int</span> main() { |
| 97 | <span class="comment">//dimensions</span> |
| 98 | <span class="keywordtype">int</span> dx=3, dy=3, du=1; |
| 99 | <span class="comment">// matrices</span> |
| 100 | mat A = eye(dx); |
| 101 | mat B = zeros(dx,du); |
| 102 | mat C = eye(dx); |
| 103 | mat D = zeros(dy,du); |
| 104 | mat Q = eye(dx); |
| 105 | mat R = 0.1*eye(dy); |
| 106 | <span class="comment">//prior</span> |
| 107 | mat P0 = 100*eye(dx); |
| 108 | vec mu0 = zeros(dx); |
| 109 | <span class="comment">// Estimator</span> |
| 110 | <a class="code" href="classbdm_1_1KalmanCh.html#830486554e1a2c7652541dbc9dcd3fb3" title="Default constructor.">KalmanCh</a> KF; |
| 111 | KF.set_parameters(A,B,C,D,<span class="comment">/*covariances*/</span> Q,R); |
| 112 | KF.set_statistics(mu0,P0); |
| 113 | <span class="comment">// Estimation loop</span> |
| 114 | <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0;i<100;i++){ |
| 115 | KF.bayes(randn(dx+du)); |
| 116 | } |
| 117 | <span class="comment">//print results</span> |
| 118 | cout << <span class="stringliteral">"Posterior estimate of x is: "</span> << endl; |
| 119 | cout << <span class="stringliteral">"mean: "</span><< KF.posterior().mean()<< endl; |
| 120 | cout << <span class="stringliteral">"variance: "</span><< KF.posterior().variance()<< endl; |
| 121 | } |
| 122 | </pre></div> <table border="0" cellpadding="0" cellspacing="0"> |
50 | | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ab3a87ba1831e53f193a9dfbaf56a879"></a><!-- doxytag: member="bdm::KalmanCh::set_parameters" ref="ab3a87ba1831e53f193a9dfbaf56a879" args="(const mat &A0, const mat &B0, const mat &C0, const mat &D0, const chmat &R0, const chmat &Q0)" --> |
51 | | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1KalmanCh.html#ab3a87ba1831e53f193a9dfbaf56a879">set_parameters</a> (const mat &A0, const mat &B0, const mat &C0, const mat &D0, const <a class="el" href="classchmat.html">chmat</a> &R0, const <a class="el" href="classchmat.html">chmat</a> &Q0)</td></tr> |
| 129 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="20a4d4c664e8ac8a3f1bb7b0d11c6d87"></a><!-- doxytag: member="bdm::KalmanCh::set_parameters" ref="20a4d4c664e8ac8a3f1bb7b0d11c6d87" args="(const mat &A0, const mat &B0, const mat &C0, const mat &D0, const chmat &Q0, const chmat &R0)" --> |
| 130 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1KalmanCh.html#20a4d4c664e8ac8a3f1bb7b0d11c6d87">set_parameters</a> (const mat &A0, const mat &B0, const mat &C0, const mat &D0, const <a class="el" href="classchmat.html">chmat</a> &Q0, const <a class="el" href="classchmat.html">chmat</a> &R0)</td></tr> |
54 | | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f559387dd38bd6002be490cc62987290"></a><!-- doxytag: member="bdm::KalmanCh::set_est" ref="f559387dd38bd6002be490cc62987290" args="(const vec &mu0, const chmat &P0)" --> |
55 | | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1KalmanCh.html#f559387dd38bd6002be490cc62987290">set_est</a> (const vec &mu0, const <a class="el" href="classchmat.html">chmat</a> &P0)</td></tr> |
| 133 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6e169272657ed101f3d128b49c59b890"></a><!-- doxytag: member="bdm::KalmanCh::set_statistics" ref="6e169272657ed101f3d128b49c59b890" args="(const vec &mu0, const chmat &P0)" --> |
| 134 | void </td><td class="memItemRight" valign="bottom"><b>set_statistics</b> (const vec &mu0, const <a class="el" href="classchmat.html">chmat</a> &P0)</td></tr> |
| 135 | |
| 136 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1KalmanCh.html#b41fe5540548100b08e1684c3be767b6">bayes</a> (const vec &dt)</td></tr> |
| 137 | |
| 138 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Here dt = [yt;ut] of appropriate dimensions. <a href="#b41fe5540548100b08e1684c3be767b6"></a><br></td></tr> |
| 139 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9264fc6b173ecb803d2684b883f32c68"></a><!-- doxytag: member="bdm::KalmanCh::set_est" ref="9264fc6b173ecb803d2684b883f32c68" args="(const vec &mu0, const chmat &P0)" --> |
| 140 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1Kalman.html#9264fc6b173ecb803d2684b883f32c68">set_est</a> (const vec &mu0, const <a class="el" href="classchmat.html">chmat</a> &P0)</td></tr> |
58 | | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1KalmanCh.html#b41fe5540548100b08e1684c3be767b6">bayes</a> (const vec &dt)</td></tr> |
59 | | |
60 | | <tr><td class="mdescLeft"> </td><td class="mdescRight">Here dt = [yt;ut] of appropriate dimensions. <a href="#b41fe5540548100b08e1684c3be767b6"></a><br></td></tr> |
61 | | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="93b5936ba397f13c05f52885c545f42d"></a><!-- doxytag: member="bdm::KalmanCh::_epdf" ref="93b5936ba397f13c05f52885c545f42d" args="() const " --> |
62 | | const <a class="el" href="classbdm_1_1epdf.html">epdf</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1Kalman.html#93b5936ba397f13c05f52885c545f42d">_epdf</a> () const </td></tr> |
| 143 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f75e487ff6c129d7012d702030f8c890"></a><!-- doxytag: member="bdm::KalmanCh::posterior" ref="f75e487ff6c129d7012d702030f8c890" args="() const " --> |
| 144 | const <a class="el" href="classbdm_1_1epdf.html">epdf</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classbdm_1_1Kalman.html#f75e487ff6c129d7012d702030f8c890">posterior</a> () const </td></tr> |
234 | | <p>References <a class="el" href="chmat_8h-source.html#l00067">chmat::_Ch()</a>, <a class="el" href="libKF_8h-source.html#l00095">bdm::Kalman< chmat >::_K</a>, <a class="el" href="libKF_8h-source.html#l00101">bdm::Kalman< chmat >::_mu</a>, <a class="el" href="libKF_8h-source.html#l00103">bdm::Kalman< chmat >::_P</a>, <a class="el" href="libKF_8h-source.html#l00099">bdm::Kalman< chmat >::_Ry</a>, <a class="el" href="libKF_8h-source.html#l00097">bdm::Kalman< chmat >::_yp</a>, <a class="el" href="libKF_8h-source.html#l00077">bdm::Kalman< chmat >::A</a>, <a class="el" href="libKF_8h-source.html#l00079">bdm::Kalman< chmat >::B</a>, <a class="el" href="libKF_8h-source.html#l00081">bdm::Kalman< chmat >::C</a>, <a class="el" href="libKF_8h-source.html#l00083">bdm::Kalman< chmat >::D</a>, <a class="el" href="libKF_8h-source.html#l00075">bdm::Kalman< chmat >::dimu</a>, <a class="el" href="libKF_8h-source.html#l00071">bdm::Kalman< chmat >::dimx</a>, <a class="el" href="libKF_8h-source.html#l00073">bdm::Kalman< chmat >::dimy</a>, <a class="el" href="libBM_8h-source.html#l00583">bdm::BM::evalll</a>, <a class="el" href="libEF_8h-source.html#l00049">bdm::eEF::evallog()</a>, <a class="el" href="libKF_8h-source.html#l00092">bdm::Kalman< chmat >::fy</a>, <a class="el" href="libBM_8h-source.html#l00581">bdm::BM::ll</a>, <a class="el" href="libKF_8h-source.html#l00138">postA</a>, and <a class="el" href="libKF_8h-source.html#l00136">preA</a>.</p> |
| 319 | <p>References <a class="el" href="chmat_8h-source.html#l00067">chmat::_Ch()</a>, <a class="el" href="libKF_8h-source.html#l00095">bdm::Kalman< chmat >::_K</a>, <a class="el" href="libKF_8h-source.html#l00101">bdm::Kalman< chmat >::_mu</a>, <a class="el" href="libKF_8h-source.html#l00103">bdm::Kalman< chmat >::_P</a>, <a class="el" href="libKF_8h-source.html#l00099">bdm::Kalman< chmat >::_Ry</a>, <a class="el" href="libKF_8h-source.html#l00097">bdm::Kalman< chmat >::_yp</a>, <a class="el" href="libKF_8h-source.html#l00077">bdm::Kalman< chmat >::A</a>, <a class="el" href="libKF_8h-source.html#l00079">bdm::Kalman< chmat >::B</a>, <a class="el" href="libKF_8h-source.html#l00081">bdm::Kalman< chmat >::C</a>, <a class="el" href="libKF_8h-source.html#l00083">bdm::Kalman< chmat >::D</a>, <a class="el" href="libKF_8h-source.html#l00075">bdm::Kalman< chmat >::dimu</a>, <a class="el" href="libKF_8h-source.html#l00071">bdm::Kalman< chmat >::dimx</a>, <a class="el" href="libKF_8h-source.html#l00073">bdm::Kalman< chmat >::dimy</a>, <a class="el" href="libBM_8h-source.html#l00603">bdm::BM::evalll</a>, <a class="el" href="libEF_8h-source.html#l00049">bdm::eEF::evallog()</a>, <a class="el" href="libKF_8h-source.html#l00092">bdm::Kalman< chmat >::fy</a>, <a class="el" href="libBM_8h-source.html#l00601">bdm::BM::ll</a>, <a class="el" href="libKF_8h-source.html#l00142">postA</a>, and <a class="el" href="libKF_8h-source.html#l00140">preA</a>.</p> |