# How to get (frequency response) from this [difference equation]?

1. Dec 7, 2013

### courteous

1. The problem statement, all variables and given/known data
Given this difference equation $y(k)$ (of a bandpass FIR filter) ...
$$y(k) = \frac{1}{K^2} \sum_{m = k-K+1}^k \; \sum_{n = m-K+1}^m x(n) - \frac{1}{L^2} \sum_{m = k-L+1}^k \; \sum_{n = m-L+1}^m x(n)$$

... how does one derive this frequency response $H(f)$?
$$H(f) = \frac{1}{K^2} \left( \frac{\sin{\pi f K}}{\sin{\pi f}} \right)^2 e^{-2j\pi f(K-1)} - \frac{1}{L^2} \left( \frac{\sin{\pi f L}}{\sin{\pi f}} \right)^2 e^{-2j\pi f(L-1)}$$

2. Relevant equations
Usually, I'd do Z-transform on (disregarding general case of IIR filters) $$y(n) = \sum_{k=0}^K b_l x(n-k)$$ to get the transfer function $$H(z) = \frac{Y(z)}{X(z)} = \sum_{k=0}^K b_l z^{-k}X(z)$$ and then evaluate on unit circle (i.e. change $z$ with $e^{jw}$).

3. The attempt at a solution
Don't know how to handle those double-sums in $y(k)$. :shy:

Since the issue is "symmetrical", I've tried solving the 1st half of $y(k)$ (the lowpass filter with a higher cutoff frequency, $K < L$). I've tried expanding the sum, hoping a pattern would emerge:
$$\sum_{m = k-K+1}^k \; \sum_{n = m-K+1}^m x(n) = \\ \left[x(k-2K+2) + x(k-2K+3) + \dots + x(k-K+1) \right] +\\ \left[x(k-2K+3) + x(k-2K+4) + \dots + x(k-K+2) \right] +\\ \cdots +\\ \left[x(k-K+1) + x(k-K+2) + \dots + x(k) \right]$$

So, there's some kind of "triangular/diagonal pattern" since $x(k-2K+2)$ and $x(k)$ (the very first and last x-element) are the only one to appear only once. Now what? Is this even the right approach?

Last edited: Dec 7, 2013
2. Dec 11, 2013

### courteous

I'd appreciate (any) help. Continuing from 1st post:
$$\cdots = \left[ x(k-2K+2) + 2x(k-2K+3) + \cdots + (K-1)x(k-K+1) + \cdots + x(k) \right]$$

Applying $Z$-transform, we get
$$X(z) \left[ z^{-2K+2} + 2z^{-2K+3} + \cdots + (K-1)z^{-K+1} + \cdots + 1 \right]$$

So, the transfer function $H(z)$ of the whole $y(k)$ (from the 1st post) can be written as
$$H(z)=\frac{Y(z)}{X(z)}= \frac{1}{K^2}\left[ z^{-2K+2} + 2z^{-2K+3} + \cdots + (K-1)z^{-K+1} + \cdots + 1 \right] - \frac{1}{L^2}\left[ z^{-2L+2} + 2z^{-2L+3} + \cdots + (L-1)z^{-L+1} + \cdots + 1 \right]$$

If the above is correct, then how can this
$$\left[ z^{-2K+2} + 2z^{-2K+3} + \cdots + (K-1)z^{-K+1} + \cdots + 1 \right]$$
be equal to this, when evaluated on the unit circle $z=e^{j2\pi f}$?
$$\left( \frac{\sin{\pi f K}}{\sin{\pi f}} \right)^2 e^{-2j\pi f(K-1)}$$

Last edited: Dec 11, 2013
3. Dec 15, 2013

### courteous

I haven't made any progress on this ... anybody help me out, please?