Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
rms.hpp
1
9
10#ifndef QLIBS_RMS
11#define QLIBS_RMS
12
13#include <include/qlibs_types.hpp>
14#include <include/smoother.hpp>
15
16
20namespace qlibs {
21
26
30 class rms : public smootherEXPW, public smootherMWM2, public smootherLPF1 {
31 public:
32 virtual ~rms() noexcept = default;
33 rms() = default;
34
46 real_t update( const real_t x ) noexcept;
47
56 bool setup( real_t * const window,
57 const size_t wsize ) noexcept;
58
65 template <size_t windowSize>
66 bool setup( real_t (&win)[ windowSize ] ) noexcept
67 {
68 return setup( win, windowSize );
69 }
70
76 explicit operator bool() const noexcept {
77 return smootherLPF1::isInitialized(); // controls truthiness
78 }
79
92 bool setParams( const real_t l,
93 const real_t a ) noexcept;
94 };
95
97}
98
99
100#endif /*QLIBS_RMS*/
bool setup(real_t *const window, const size_t wsize) noexcept
Initialize the RMS instance by setting the default optimal parameters.
Definition rms.cpp:7
rms()=default
real_t update(const real_t x) noexcept
Computes the moving root mean square (RMS) of the input signal. The object uses both the exponential ...
Definition rms.cpp:22
virtual ~rms() noexcept=default
bool setParams(const real_t l, const real_t a) noexcept
Change the recursive parameters for the moving RMS estimator.
Definition rms.cpp:33
An Exponential weighting filter.
Definition smoother.hpp:379
bool isInitialized(void) const
Check if the smoother filter has been initialized using setup().
Definition smoother.hpp:44
A 1st order Low-Pass Filter.
Definition smoother.hpp:81
A Moving Window Median filter.
Definition smoother.hpp:188
The qLibs++ library namespace.
Definition mat.hpp:18
float real_t
A type to instantiate a real variable double-precision of 64-bits IEEE 754.
Definition qlibs_types.hpp:43