| Inports
| |
| In | Input In(k) |
| Outports
| |
| Out | Output Out(k) |
| Mask Parameters | ||
| Name | ID | Description |
| method | 1 | Selection between bilinear and matched Z-transform discretization method |
| fn | 2 | Notching frequency in Hz |
| Q | 3 | Defines a quality factor of the filter |
| ts_fact | 4 | Multiplication factor of base sampling time (in integer format) |
Calculates the filter coefficients for a second order notch filter and performs filtering on input signal.
Second order transfer function used:
H(z) = (b0.z2 + b1.z + b2) / (z2 + a1.z + a2)
Calculation:
![]() |
The transfer function H(z) of the filter is
![]() |
with coefficients derived from the transfer function
![]() |
Two methods of discretizing a continuous transfer function are available: bilinear and matching.
Warning: In some cases, the function is very sensitive to the accuracy of the coefficients. Therefore, using a fixed-point implementation can sometimes give inaccurate results.
To illustrate this issue, see step responses in figures 1 and 2 below. Filter settings are fn = 50 Hz, Q = 10, fs = 10 kHz.
| FiP16 | 16 Bit Fixed Point Implementation |
| FiP32 | 32 Bit Fixed Point Implementation |
| Float32 | 32 Bit Floating Point Implementation |
| Float64 | 64 Bit Floating Point Implementation |
16 Bit Fixed Point Implementation
| Inports Data Type
| |
| In | int16 |
| Outports Data Type
| |
| Out | int16 |
32 Bit Fixed Point Implementation
| Inports Data Type
| |
| In | int32 |
| Outports Data Type
| |
| Out | int32 |
32 Bit Floating Point Implementation
| Inports Data Type
| |
| In | float32 |
| Outports Data Type
| |
| Out | float32 |
64 Bit Floating Point Implementation
| Inports Data Type
| |
| In | float64 |
| Outports Data Type
| |
| Out | float64 |