Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qssmoother.h
1
9#ifndef QSIGNAL_SMOOTHER
10#define QSIGNAL_SMOOTHER
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16 #include <stdlib.h>
17 #include <stdint.h>
18 #include "qtdl.h"
19
41
43 #define qSSmootherPtr_t void
44 /*abstract class*/
45 typedef struct _qSSmoother_s //skipcq: CXX-E2000
46 {
47 void *vt;
48 uint8_t init;
49 } _qSSmoother_t; //skipcq: CXX-E2000
55 typedef struct
56 {
58 _qSSmoother_t f;
59 float alpha, y1;
62
66 typedef struct
67 {
69 _qSSmoother_t f;
70 float y1, y2, x1, x2;
71 float k, a1, a2, b1;
74
79 typedef struct
80 {
82 _qSSmoother_t f;
83 float *w;
84 size_t wsize;
87
92 typedef struct
93 {
95 _qSSmoother_t f;
96 qTDL_t tdl;
97 float sum;
100
105 typedef struct
106 {
108 _qSSmoother_t f;
109 float *w, m, alpha;
110 size_t wsize;
113
118 typedef struct
119 {
121 _qSSmoother_t f;
122 qTDL_t tdl;
123 float sum, m, alpha;
126
130 typedef struct
131 {
133 _qSSmoother_t f;
134 float *w, *k;
135 size_t wsize;
138
142 typedef struct
143 {
145 _qSSmoother_t f;
146 float lambda, m, w;
149
153 typedef struct
154 {
156 _qSSmoother_t f;
157 float x; /* state */
158 float A; /* x(n)=A*x(n-1)+u(n),u(n)~N(0,q) */
159 float H; /* z(n)=H*x(n)+w(n),w(n)~N(0,r) */
160 float q; /* process(predict) noise covariance */
161 float r; /* measure noise covariance */
162 float p; /* estimated error covariance */
163 float gain;
166
170 typedef struct
171 {
173 _qSSmoother_t f;
174 float alpha, beta;
175 float lt, bt, n;
178
182 typedef struct
183 {
185 _qSSmoother_t f;
186 float alpha, mu;
187 float *w, *w_1, *x;
188 size_t n;
191
197 int qSSmoother_IsInitialized( const qSSmootherPtr_t * const s );
198
204 int qSSmoother_Reset( qSSmootherPtr_t * const s );
205
213 float qSSmoother_Perform( qSSmootherPtr_t * const s,
214 const float x );
215
310 int qSSmoother_Setup( qSSmootherPtr_t * const s,
311 const qSSmoother_Type_t type,
312 const float * const param,
313 float *window,
314 const size_t wsize );
315
318#ifdef __cplusplus
319}
320#endif
321
322#endif
float qSSmoother_Perform(qSSmootherPtr_t *const s, const float x)
Perform the smooth operation recursively for the input signal x.
Definition qssmoother.c:459
int qSSmoother_Reset(qSSmootherPtr_t *const s)
Reset the the smoother filter.
Definition qssmoother.c:443
int qSSmoother_IsInitialized(const qSSmootherPtr_t *const s)
Check if the smoother filter is initialized.
Definition qssmoother.c:427
qSSmoother_Type_t
Supported Filters by the qSSmoother library.
Definition qssmoother.h:28
int qSSmoother_Setup(qSSmootherPtr_t *const s, const qSSmoother_Type_t type, const float *const param, float *window, const size_t wsize)
Setup an initialize smoother filter.
Definition qssmoother.c:89
@ QSSMOOTHER_TYPE_GMWF
Definition qssmoother.h:35
@ QSSMOOTHER_TYPE_DESF
Definition qssmoother.h:38
@ QSSMOOTHER_TYPE_MWM2
Definition qssmoother.h:32
@ QSSMOOTHER_TYPE_EXPW
Definition qssmoother.h:37
@ QSSMOOTHER_TYPE_LPF2
Definition qssmoother.h:30
@ QSSMOOTHER_TYPE_MOR2
Definition qssmoother.h:34
@ QSSMOOTHER_TYPE_ALNF
Definition qssmoother.h:39
@ QSSMOOTHER_TYPE_KLMN
Definition qssmoother.h:36
@ QSSMOOTHER_TYPE_MWM1
Definition qssmoother.h:31
@ QSSMOOTHER_TYPE_MOR1
Definition qssmoother.h:33
@ QSSMOOTHER_TYPE_LPF1
Definition qssmoother.h:29
Adaptive Filter LMS.
Definition qssmoother.h:183
Double exponential smoothing (Holt’s Method)
Definition qssmoother.h:171
An Exponential weighting filter.
Definition qssmoother.h:143
A Gaussian filter.
Definition qssmoother.h:131
A scalar Kalman filter.
Definition qssmoother.h:154
A 1st order Low-Pass Filter.
Definition qssmoother.h:56
A 2nd order Low-Pass Filter.
Definition qssmoother.h:67
A Moving Outlier Removal filter.
Definition qssmoother.h:106
A Moving Outlier Removal filter.
Definition qssmoother.h:119
A Moving Window Median filter.
Definition qssmoother.h:80
A Moving Window Median filter.
Definition qssmoother.h:93
A Tapped Delay Line (TDL) object.
Definition qtdl.h:35