📄 average1_8hpp-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Bayes++ Bayesian Filtering Classes: average1.hpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>average1.hpp</h1><a href="average1_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef _BAYES_FILTER_AVERAGE1</span>00002 <span class="preprocessor"></span><span class="preprocessor">#define _BAYES_FILTER_AVERAGE1</span>00003 <span class="preprocessor"></span>00004 <span class="comment">/*</span>00005 <span class="comment"> * Bayes++ the Bayesian Filtering Library</span>00006 <span class="comment"> * Copyright (c) 2002 Michael Stevens</span>00007 <span class="comment"> * See accompanying Bayes++.htm for terms and conditions of use.</span>00008 <span class="comment"> *</span>00009 <span class="comment"> * $Header: /cvsroot/bayesclasses/Bayes++/BayesFilter/filters/average1.hpp,v 1.7.2.1 2004/02/11 21:06:42 mistevens Exp $</span>00010 <span class="comment"> * $NoKeywords: $</span>00011 <span class="comment"> */</span>00012 00013 <span class="comment">/*</span>00014 <span class="comment"> * Predefined filter: Average1_filter</span>00015 <span class="comment"> * A single state averager</span>00016 <span class="comment"> */</span>00017 00018 <span class="comment">/* Filter namespace */</span>00019 <span class="keyword">namespace </span>Bayesian_filter00020 {00021 00022 <span class="keyword">template</span> <<span class="keyword">class</span> Filter_base><a name="l00023"></a><a class="code" href="classBayesian__filter_1_1Average1__filter.html">00023</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter_1_1Average1__filter.html">Average1_filter</a>00024 {00025 Filter_base ksf; <span class="comment">// Kalman State Filter</span>00026 00027 <span class="keyword">typedef</span> <span class="keyword">typename</span> Filter_base::Float Float;00028 <span class="keyword">class </span>Cpredict : <span class="keyword">public</span> <a class="code" href="classBayesian__filter_1_1Linear__predict__model.html">Linear_predict_model</a>00029 <span class="comment">// Constant predict model</span>00030 {00031 <span class="keyword">public</span>:00032 Cpredict(<a class="code" href="classBayesian__filter_1_1Bayes__base.html#w0">Float</a> qq) : <a class="code" href="classBayesian__filter_1_1Linear__predict__model.html">Linear_predict_model</a>(1, 1)00033 {00034 <a class="code" href="classBayesian__filter_1_1Linrz__predict__model.html#o0">Fx</a>(0,0) = 1.;00035 <a class="code" href="classBayesian__filter_1_1Addative__predict__model.html#o0">q</a>[0] = qq;00036 <a class="code" href="classBayesian__filter_1_1Addative__predict__model.html#o1">G</a>(0,0) = 1.;00037 }00038 };00039 00040 <span class="keyword">class </span>Cobserve : <span class="keyword">public</span> <a class="code" href="classBayesian__filter_1_1Linear__correlated__observe__model.html">Linear_correlated_observe_model</a>00041 <span class="comment">// Constant observe model</span>00042 {00043 <span class="keyword">public</span>:00044 Cobserve(<a class="code" href="classBayesian__filter_1_1Bayes__base.html#w0">Float</a> ZZ) : <a class="code" href="classBayesian__filter_1_1Linear__correlated__observe__model.html">Linear_correlated_observe_model</a>(1,1)00045 {00046 <a class="code" href="classBayesian__filter_1_1Jacobian__observe__model.html#o0">Hx</a>(0,0) = 1.;00047 <a class="code" href="classBayesian__filter_1_1Correlated__addative__observe__model.html#o0">Z</a>(0,0) = ZZ;00048 }00049 };00050 00051 <span class="keyword">public</span>:00052 <a class="code" href="classBayesian__filter_1_1Average1__filter.html#a0">Average1_filter</a> (Float iQ, Float iZ, Float z);00053 <a class="code" href="classBayesian__filter_1_1Average1__filter.html#a0">Average1_filter</a> (Float iQ, Float iZ);00054 Float <a class="code" href="classBayesian__filter_1_1Average1__filter.html#a2">observe</a> (Float zz);<a name="l00055"></a><a class="code" href="classBayesian__filter_1_1Average1__filter.html#a3">00055</a> <a class="code" href="classBayesian__filter_1_1Average1__filter.html#a3">operator Float </a>() <span class="keyword">const</span>00056 <span class="comment">/* Returns filtered estimate</span>00057 <span class="comment"> */</span>00058 { <span class="keywordflow">if</span> (!bInit)00059 ksf.error (<a class="code" href="classBayesian__filter_1_1Logic__exception.html">Logic_exception</a>(<span class="stringliteral">"Average1 not init"</span>));00060 <span class="keywordflow">return</span> ksf.x[0];00061 }00062 00063 <span class="keyword">private</span>:00064 Cpredict f;00065 Cobserve h;00066 00067 <span class="keywordtype">bool</span> bInit;00068 FM::Vec z;00069 };00070 00071 00072 00073 <span class="keyword">template</span> <<span class="keyword">typename</span> Filter_base><a name="l00074"></a><a class="code" href="classBayesian__filter_1_1Average1__filter.html#a0">00074</a> <a class="code" href="classBayesian__filter_1_1Average1__filter.html">Average1_filter<Filter_base>::Average1_filter</a> (Float iQ, Float iZ, Float zz) :00075 ksf(1), f(iQ), h(iZ), z(1)00076 <span class="comment">/* Initialise noises and set sizes</span>00077 <span class="comment"> * include first observation zz */</span>00078 {00079 bInit = <span class="keyword">false</span>;00080 00081 <a class="code" href="classBayesian__filter_1_1Average1__filter.html#a2">observe</a> (zz);00082 }00083 00084 <span class="keyword">template</span> <<span class="keyword">typename</span> Filter_base><a name="l00085"></a><a class="code" href="classBayesian__filter_1_1Average1__filter.html#a1">00085</a> <a class="code" href="classBayesian__filter_1_1Average1__filter.html">Average1_filter<Filter_base>::Average1_filter</a> (Float iQ, Float iZ) :00086 ksf(1), f(iQ), h(iZ), z(1)00087 <span class="comment">// Initialise noises and set sizes</span>00088 {00089 bInit = <span class="keyword">false</span>;00090 }00091 00092 <span class="keyword">template</span> <<span class="keyword">typename</span> Filter_base><a name="l00093"></a><a class="code" href="classBayesian__filter_1_1Average1__filter.html#a2">00093</a> <span class="keyword">typename</span> <a class="code" href="classBayesian__filter_1_1Average1__filter.html">Average1_filter<Filter_base></a>::Float <a class="code" href="classBayesian__filter_1_1Average1__filter.html">Average1_filter<Filter_base>::observe</a>(Float zz)00094 <span class="comment">/* Observe z, first call set initial state to z</span>00095 <span class="comment"> * Returns filtered estimate</span>00096 <span class="comment"> */</span>00097 {00098 z[0] = zz;00099 00100 <span class="keywordflow">if</span> (!bInit) {00101 ksf.init_kalman (z, h.<a class="code" href="classBayesian__filter_1_1Correlated__addative__observe__model.html#o0">Z</a>);00102 bInit = <span class="keyword">true</span>;00103 }00104 00105 ksf.predict(f);00106 ksf.observe(h, z);00107 ksf.update ();00108 00109 <span class="keywordflow">return</span> ksf.x[0];00110 }00111 00112 }<span class="comment">//namespace</span>00113 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Feb 16 11:20:37 2004 for Bayes++ Bayesian Filtering Classes by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -