# Given input and output time series, obtaining filter design

Say I have 5 minutes of input and output audio. One method I know is to do FFT on windows from input and output. Then divide FFT output into bins and find average energy in various bands for all the windows. After this, take ratio of energy bands from output windows with corresponding energy bands from input windows. And then take average of all these ratios. This will give an approximation to FFT(Y)/FFT(X) i.e. transfer function of the filter.

Are there any other methods to find transfer function given input and output time series?

If your system is linear, then you can find the impulse response $h(n)$ of the system using the convolution sum $y(n)=\sum_{k=0}^{N} h(k)x(n-k)$, which can be written in matrix-vector form as $y=Xh$, where $X$ is a convolution matrix of the input data and $N$ is the order of the system, say $N=10$ for example. Since you know $X$ and $y$, you can find $h$ via the Pseudo inverse, assuming you have created an over-determined system $y=Ah$. The pseudo-inverse is $h=(X^T X)^{-1}X^T y$. After finding $h$, find the FFT of $h$ or take the Laplace transform of $h$ to get the transfer function. I hope this helps you.

• The approach is good, but just two details: for this approach to work the system must not only be linear but also time-invariant (LTI). And second, for discrete-time filters the transfer function is obtained by applying the Z-transform instead of the Laplace transform. – Matt L. Apr 4 '14 at 8:15
• There may be some practical problems with this approach. 5 minutes of audio is about 13 million samples so the convolution matrix is gigantic. You may have to break this into smaller chunks or to do some iterative method to plow through the data. It also requires a good estimate of the filter order. For many (LTI) audio systems the filter order is very large. A typical speaker will have a order in the thousands – Hilmar Apr 4 '14 at 15:58
• Yes i agree with you points. – Oliver Apr 5 '14 at 1:36