DigitalFilter2FrequencyResponse
Compute amplitude-, phase-, group delay and frequency response of a digitalFilter cascade. The outputfileResponse is a matrix with following columns: freq $[Hz]$, ampl, phase $[rad]$, group delay $[-]$, real, imag.
When unwrapPhase is set to true, $2\pi$ jumps of the phase response are removed before writing the output to file.
The response of the filter cascade is given by the product of each individual frequency response: \[ H(f) = \prod_f H_j(f). \]Amplitude and phase response are computed from the frequency response via \[ A(f) = |H(f)| \hspace{5pt}\text{and}\hspace{5pt} \Phi(f) = \arctan \frac{\mathcal{I}(H(f))}{\mathcal{R}(H(f))}. \]The group delay is computed by numerically differentiating the phase response \[ \tau_g(f_k) = \frac{1}{2} \left[\frac{\Phi(f_k) - \Phi(f_{k-1})}{2\pi(f_k-f_{k-1})} + \frac{\Phi(f_{k+1}) - \Phi(f_{k})}{2\pi(f_{k+1}-f_{k})}\right] \approx \frac{d\Phi}{df}\frac{df}{d\omega}. \]The frequency vector for a length $N$ and a sampling $\Delta t$ is given by \[ f_k = \frac{k}{N \Delta t}, \hspace{15pt} k \in \{0, \dots, \left\lfloor\frac{N+2}{2}\right\rfloor-1\}. \] See also DigitalFilter2ImpulseResponse.
Name | Type | Annotation |
---|---|---|
outputfileResponse | filename | columns: freq [Hz], ampl, phase [rad], group delay [-], real, imag |
digitalFilter | digitalFilter | |
length | uint | length of the data series in time domain |
sampling | double | sampling to determine frequency [seconds] |
skipZeroFrequency | boolean | omit zero frequency when writing to file |
unwrapPhase | boolean | unwrap phase response |