# Calculating transfer function for a comb filter with low-passed feedback

I'm creating a comb filter bank as part of a project I'm working on, and I need a way to visualize its magnitude response. The project already has FFT-based analyzers that can generate this response, but I'm looking for ways to increase efficiency. I've had great success using the transfer functions of comb filters as defined on Wikipedia, but I've hit a roadblock while trying to extend these definitions to match some of the more idiosyncratic processing done by the filter bank. I'm brand-new to Z-domain math, so I feel like I could be missing something very obvious due to lack of experience.

At current, I'm trying to figure out how to calculate the transfer function when the feedback of the comb filter is itself being filtered (e.g. through a lowpass filter). I'll use a feed-forward comb as an example for this post.

Taking the following definition of a feed-forward comb filter:

$$y[n] = x[n] + \alpha x[n - K]$$

I would assume my setup would be

$$y[n] = x[n] + \alpha w[n - K]$$

where $$w[n]$$ is the signal $$x[n]$$ passed through some filter with transfer function $$H_f(z) = \frac{W(z)}{X(z)}$$

Following the logic laid out on the Wikipedia page, I would assume that my overall transfer function $$H[z]$$ would be defined like so:

$$Y(z) = X(z) + \alpha W(z^{-k}) = X(z)(1 + \alpha H_f(z)z^{-k}))$$ $$H(z) = 1 + \alpha H_f(z)z^{-k}$$

This is where I get a little stuck on account of not really knowing what I'm "allowed" to do here so to speak. I have methods available to me to get the complex response of the filter for any frequency (i.e., I can get the value of $$H(e^{j\omega})$$). In my mind, I could then do the following to find the frequency response:

$$H_f(e^{j\omega}) \overset{\Delta}{=} A_f e^{j \theta_f}\text{ ( A_f and \theta_f are taken constants from the filter class' methods)}$$ $$H(e^{j\omega}) = 1 + \alpha H_f(e^{j\omega})e^{-j{\omega}k} = 1 + \alpha A_f e^{j \theta_f}e^{-j{\omega}K} = 1 + \alpha A_f e^{j (\theta_f-{\omega}K)}$$ $$= 1 + \alpha A_f \cos(\theta_f-\omega K) + j \alpha A_f \sin(\theta_f-\omega K)$$

$$\therefore \: |H(e^{j\omega})| = \sqrt{(1 + \alpha A_f \cos(\theta_f-\omega K))^2 + (\alpha A_f \sin(\theta_f-\omega K))^2}$$ $$= \sqrt{(1 + \alpha^2 A_f^2) + 2 \alpha A_f \cos(\theta_f-\omega K)}$$

Am I correct in my thinking? The solution feels right in that it's somewhat elegant, but as I said I'm brand-new to this, and I'm leveraging only my vague memory of high school calculus to do these calculations. Any guidance would be appreciated, especially if there's places where I'm making things too difficult for myself or where I'm just plain incorrect. Thank you!

Just implemented this math in the DSP code, and it works!

In order to make the math clear to both myself and the other people on my team, I made a fairly exhaustive writeup, which I'll post below for anyone who might find this post while facing a similar issue:

$$y[n] = x[n] + \alpha x[n - K]$$

where $$K$$ is delay time in samples. A comb filter with filtered feedback would be defined as:

$$y[n] = x[n] + \alpha w[n - K]$$

where $$w[n]$$ is the signal $$x[n]$$ passed through some filter with transfer function $$H_f(z) = \frac{W(z)}{X(z)}$$.

The Z transform of this equation is:

$$Y(z) = X(z) + \alpha W(z)z^{-k}$$

And as such, the overall transfer function $$H(z)$$ is defined as:

$$H(z) = \frac{Y(z)}{X(z)} = \frac{X(z) + \alpha W(z)z^{-k}}{X(z)}$$

Given that $$H_f(z) = \frac{W(z)}{X(z)}$$ and thus $$H_f(z)X(z) = W(z)$$, we can factor out $$X(z)$$:

$$Y(z) = X(z) + \alpha H_f(z)X(z)z^{-k} = X(z)(1 + \alpha H_f(z)z^{-k})$$

$$H(z) = \frac{X(z)(1 + \alpha H_f(z)z^{-k})}{X(z)} = 1 + \alpha H_f(z)z^{-k}$$

Finally we can extrapolate the frequency response of the transfer function. By definition, this is done by setting $$z = e^{j\omega}$$. Luckily, we have the amplitude response, $$A_f$$, and phase response, $$\theta_f$$, of the feedback filter, which are taken constants from the filter class' methods: $$H_f(e^{j\omega}) \overset{\Delta}{=} A_f e^{j \theta_f}$$

We can then plug $$z = e^{j\omega}$$ into the rest of the equation, which gives the following:

$$H(e^{j\omega}) = 1 + \alpha H_f(e^{j\omega})e^{-j{\omega}k} = 1 + \alpha A_f e^{j \theta_f}e^{-j{\omega}K} = 1 + \alpha A_f e^{j (\theta_f-{\omega}K)}$$ $$= 1 + \alpha A_f \cos(\theta_f-\omega K) + j \alpha A_f \sin(\theta_f-\omega K)$$

This is our frequency response. To isolate the magnitude response, we need only take the absolute value: $$|H(e^{j\omega})| = \sqrt{(1 + \alpha A_f \cos(\theta_f-\omega K))^2 + (\alpha A_f \sin(\theta_f-\omega K))^2}$$

Using some trig identities such as $$\sin^2(x) = 1 - \cos^2(x)$$ and $$\cos(-x) = \cos(x)$$, we can reduce this down to:

$$\sqrt{(1 + \alpha^2 A_f^2) + 2 \alpha A_f \cos(\theta_f-\omega K)}$$

Most of this proof is taken from the Wikipedia page on comb filters, while the main addition is leveraging $$z_0 z_1 = A_0 A_1 e^{j (\theta_0 + \theta_1)}$$ and the mag + phase from the filter coefficients to integrate the filtration into the transfer function.

• Frequency response of any transfer function $$H(z)$$ is defined as $$H(e^{j\omega})$$, which will give some complex number that we can represent as $$Ae^{j\omega k}$$, using $$K$$ delay samples as a unit of time
• The Z-transform of some delayed sequence $$x[n-K]$$ is equal to $$X(z)z^{-k}$$
• $$z_0 z_1 = A_0 A_1 e^{j (\theta_0 + \theta_1)}$$