# Difference equation with complex zero

Let's assume I have the following transfer function:

$$H(z)=\frac{z-\left(\frac{1}{\sqrt{2}}+i \cdot \frac{1}{\sqrt{2}}\right)}{z}$$

It looks like a first order highpass-filter with a complex zero at $\frac{1}{\sqrt{2}} + i \cdot \frac{1}{\sqrt{2}}$.

If I do the inverse $z$-transform, I get the following difference equation:

$$y(k)=x(k) - \frac{1}{\sqrt{2}} \cdot x(k-1) - i \cdot \frac{1}{\sqrt{2}} \cdot x(k-1)$$ with $k$ as time step variable. My input signal is real valued and my output should be real valued as well.

• How do I implement that filter e.g. in C?
• How do I deal with that complex numbers in that case?
• Your output signal will be complex-valued, even if the input signal is real-valued, because you have a filter with complex coefficients. Are you sure about that transfer function? – Matt L. Jun 6 '16 at 13:31
• yes I am sure. I want to have put my zero at certain frequencies and I wondered if that is possible with a structure like that – c-a Jun 6 '16 at 13:52
• You also need to put a zero at the corresponding negative frequencies in order to get a real-valued filter. See my answer below. – Matt L. Jun 6 '16 at 14:06

## 1 Answer

What you actually want to do is the following: you need a zero at $\omega=\pi/4$, but you also need to place a zero at $\omega=-\pi/4$ in order to get real-valued filter coefficients. So your transfer function becomes

\begin{align}H(z)&=\frac{(z-e^{j\pi/4})(z-e^{-j\pi /4})}{z^2}\\&=\frac{z^2-2z\cos(\pi/4)+1}{z^2}\\&=1-\sqrt{2}z^{-1}+z^{-2}\tag{1}\end{align}

The corresponding difference equation is

$$y[n]=x[n]-\sqrt{2}x[n-1]+x[n-2]\tag{2}$$

• ok, thanks for your reply! So the cut-off frequency of a first oder highpass with transfer fcn $\frac{z-1}{z}$ is basically only determined by it's sample frequency, is that right? – c-a Jun 6 '16 at 14:54
• @c-a: Yes, given the coefficients, the ratio of the cut-off frequency and the sampling frequency is fixed. – Matt L. Jun 6 '16 at 15:08