I'm filtering a real signal with a single complex pole with a complex coefficient (a_re [real part] and a_im [imaginary part]), I also have a gain coefficient but I'm gonna leave it out for the sake of simplicity. The filter has two outputs, one for the real and another for the imaginary part. Here's the filter equation in time for both outputs
Real part output: $$y_1[n] = x_1[0] + a_{R} y_1[-1] - a_{I} y_2[-1]$$ Imaginary part output: $$y_2[n] = a_{I} y_1[-1] + a_{R} y_2[-1]$$
Where $n$ is the sample number, $x_1[0]$ is the real input, $a_{R}$ & $a_{I}$ are, respectively, the real and imaginary part of the coefficient, $y_1[-1]$ is the previous output of "real part output" and $y_2[-1]$ is the previous output of "imaginary part output".
So, I need to plot the frequency response based on the Z transform. I've already succeeded in dealing with the real version of all this (a real pole), and I'm struggling with the complex version. Anyway, the equation for the real pole is:
$$y[n] = x[0] + a y[-1]$$
Where $a$ is the coefficient of the real pole.
Now, the Z-transform of the real pole is:
$$\tag{1}H(z) = \dfrac{1}{ 1 - a z^{-1}}$$
Where, again, $a$ is the coefficient of the real pole.
In my code I am solving it and dealing with the z-transform in this way, the input of the function is the $a$ coefficient and the $\omega$ variable (which is the angular frequency in radians per sample). I'm only interested in getting the magnitude output, so I don't care about the phase response of the filter. Anyway, here is how I get it:
$a \rightarrow$ coefficient
$w \rightarrow$ angular frequency
$f_{R} = \cos(\omega)$; $\;\;\;\;f_{I} = \sin(\omega)$
$\mathbf{R} = 1 - a f_{R}$; $\;\;\mathbf{I} = -a f_{I}$
$\mathbf{Mag} = \sqrt{\mathbf{R}^{2} + \mathbf{I}^{2}}$
$H = \frac{1}{\mathbf{Mag}}$
The whole thing would be:
$$\tag{2}|H(z)| = \dfrac{1}{\sqrt{(1 - a \cos \omega)^2 + (-a \sin \omega)^2)}}$$
Now my trouble is adapting it to the complex version of this z transform, which is supposed to be the same formula as the real pole's z transform in Eq. (1), but I don't know how to adapt the formula/code for the complex pole. Bearing in mind that I want to have the frequency response of the two outputs (the real and imaginary part of the complex filter).
Hopefully, I'd like some help on reaching the frequency response from the coefficient as a function of angular frequency as I've written above for the real pole version of this in Eq.(2)!
Any thoughts, considerations, hints, help is highly welcome.
Thanks a lot