Digital notch filter function with specific external storage, so it can be used in multiple calls.
Syntax |
real filter_notch_st (real val, real omega, real valQ, real storage[2], real period, i32 flagInit) |
---|---|
val |
Is the value (or a generic mathematical expression) to be filtered |
omega |
Value of the cut filter omega in radians per second (omega = 2 * K_PI * cut frequency (Hz)). It can be a generic mathematical expression |
valQ |
Value of the filter Q coefficient (Q must be >= 0.75). Can be a generic mathematical expression |
storage |
Storage variable for mathematical processing of the filter function |
period |
Sampling interval, if <= 0 si is assumed |
flagInit |
Variable for filter initialization request; imposing a value different than 0 will reset the filter and the flagInit variable will be written to 0. The first time the function is called this variable must have a value different than 0 |
Result |
Returns the filtered value |
Validity |
Rule |
Note |
Automatic omega limitation: (omega_max = 0.15 / si * 2 * K_PI) -> i.e. no more than 15% of omega value corresponding to rule sampling time. (e.g. if Freq = 200Hz -> filter cut frequency <= 30 Hz) |
The parameters are as for filter_notch(), but in addition it allows you to specify a storage variable used for mathematical processing of the filter function.
In this way, filters can also be used with multiple calls (e.g., within for loops).
Example of use:
|