# DFT in IIR filters

To further summarize, I want to create a function in matlab that finds the time domain signal $y(n)$ and its $n$ time components ($n=0,1,2,...$) given the numerator and denominator of a transfer function (filter) and the input sequence. I want to know if you can use the DFT and circular convolution to convolve $H(\omega)$ and $X(\omega)$ if the former is an IIR filter (there's a feedback).

• Can you please edit the question for clarity? The series of operations mentioned in the post is not entirely clear and a few steps could be considered redundant. Would it be possible to describe what exactly are you trying to achieve? – A_A Nov 27 '16 at 14:00
• Done. Sorry for being a bit confusing. – LeBlanc Lord Nov 27 '16 at 14:27
• If you have the transfer function and the input sequence, if the filter is LTI, what is the issue here? You just have to convolve the two sequences. – Tendero Nov 27 '16 at 14:38
• The catch is that I want the process to be done in the frequency domain, not in the time domain itself. So what should I do after using fourier transform on both the H(z) and x(n)? – LeBlanc Lord Nov 27 '16 at 14:44
• Thank you. There already is such a function in MATLAB. Can I please ask if this is some kind of homework where you have been asked to "emulate" the way that function operates? – A_A Nov 27 '16 at 14:55

You can't apply an IIR filter in the frequency domain, at least not without some approximation. As the name implies, the impulse response of an IIR filter is of infinite length which also means that you need infinitely high resolution in the frequency domain. Any DFT based implementation would require a finite frequency resolution, otherwise your FFT length becomes infinite.

Choosing a finite FFT length is the equivalent to truncating the impulse response.

In practice, of course, you can always come up with a good-enough approximation that's close enough to meet your specific requirements. Most IIRs have exponential decay so it dies off pretty fast. However, why would you? In terms of computational efficiency, memory consumption and latency, a direct IIR implementation will almost always beat any frequency domain algorithm by a wide margin. What's the problem you are trying to solve ?

• Oh that's a clear explanation. Thank you. What I'm trying to solve is how can you implement an IIR filter in the frequency domain. Since filter function in the matlab can actually handle an IIR or FIR system since its contents do time domain filtering (convolution), this rises up to why I'm curious about the IIR filtering in the time domain. So you said that you need to approximate the IIR to FIR right? How can you do that? Thanks for any help. – LeBlanc Lord Nov 27 '16 at 19:18
• So I found this thread stackoverflow.com/questions/20108462/… and I think it answers my questions. But in that thread the OP didn't do any approximation of the IIR filter, so is this really possible? I tried running the function he made but got different outputs compared to the filter function. – LeBlanc Lord Nov 27 '16 at 19:48
• @LeBlancLord My question still stands: WHY do you want to do this in the frequency domain? It's slower, less precise, has higher latency and requires way more memory. I can't think of a case where a direct time domain, when done properly, isn't much better. Another point: IIR filtering in the time domain is NOT convolution. Convolution is only applicable to FIR filters. – Hilmar Nov 27 '16 at 20:00
• I want to prove that multiplication of two DFTs in the frequency domain (the filter being an IIR) would produce the output spectrum which can be Inversed DFT to obtain the output time domain signal. Yes I know it's not practical in real life applications, I just wanted to know the theory behind it by making a function for it. – LeBlanc Lord Nov 27 '16 at 20:10
• @LeBlancLord: What do you mean by lccde ? Anyway, you can't prove this. First: your IIR filter is unstable. The output is unbounded. Even if it were stable (replace 8 with 1/8 for example) the length of the output is infinite. Any DFT needs a finite length, so they can't be the same. – Hilmar Nov 28 '16 at 14:19