Main MRPT website > C++ reference for MRPT 1.5.6
filters.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "base-precomp.h" // Precompiled headers
11 
12 #include <mrpt/math/filters.h>
13 
14 using namespace mrpt::math;
15 
16 LowPassFilter_IIR1::LowPassFilter_IIR1(double _alpha, double y_k_minus_1) :
17  alpha(_alpha),
18  m_y_km1(y_k_minus_1)
19 {
20 }
21 
23 {
24  // y[k] = alpha*y[k - 1] + (1 - alpha)*x[k]
25  const double y = alpha*m_y_km1 + (1 - alpha)*x;
26  m_y_km1 = y;
27  return y;
28 }
29 
31 {
32  return m_y_km1;
33 }
GLclampf GLclampf GLclampf alpha
Definition: glext.h:3510
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
LowPassFilter_IIR1(double alpha=0.5, double y_k_minus_1=.0)
Definition: filters.cpp:16
double filter(double x)
Processes one input sample, updates the filter state and return the filtered value.
Definition: filters.cpp:22
double alpha
See equation in LowPassFilter_IIR1.
Definition: filters.h:33
GLenum GLint GLint y
Definition: glext.h:3516
GLenum GLint x
Definition: glext.h:3516
double getLastOutput() const
Definition: filters.cpp:30



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019