# Approximate a System Frequency Response with a Filter in MATLAB

suppose I know the frequency response of a (linear) model approximating a real physical system but only at a specific frequency $f_0$ (so basically I have a complex number whose module is the magnitude response and the phase is the phase response).

In Matlab I want to filter a sinusoidal signal whose frequency is $f_0$ by a filter that approximates the response of my system at $f_0$ without altering the other frequencies. The filtering process must be done simulating the on-line behaviour, assuming that the next samples of the signal are unknown.

In other words my question is this: how can I build a filter whose behaviour at $f_0$ is the same of my system and does not modify the other frequency components?

The motivation I am asking this is that I need to perform some transformations on the frequency response at $f_0$ of the real system exploiting the results of the Singular Value Decomposition performed on the frequency response at $f_0$ of the identified (linear MIMO) model that approximates the real system.

Thanks in advance

• Your question is not clear to me. You say that you want to filter a sinusoidal signal, but then you require that the system must not modify other frequency components. Which other components if the input is sinusoidal? – Matt L. Jul 27 '14 at 19:14
• Be careful: I did not say frequency components of my signal. I meant if I would have another signal with more frequency components, I would like to modify the behaviour at $f_0$ only. – Francesco Boi Jul 27 '14 at 19:47
• Your signal is the total input signal, and you have to design the filter according to this total input signal if you care about what happens to other frequency components. – Matt L. Jul 27 '14 at 20:31

## 1 Answer

Convolve the input signal with (Real Part) harmonic signal $\alpha {e}^{-2 \pi i {f}_{0} t + \phi}$.
Let's call this output as ${y}_{1}$.
The parameters $\alpha$ and $\phi$ are from your reference system response.

This will give you the output of the reference system on your input signal only at your desired frequency.

Now convolve the input signal with (Real Part) harmonic signal $1 {e}^{-2 \pi i {f}_{0} t}$.
Let's call this output as ${y}_{2}$.
This will extract this component of your input signal.

Calculate ${y}_{3} = {y}_{1} - {y}_{2}$ and all you need is to add ${y}_{3}$ to your signal.

There are trickier and more efficient way to do so.
Yet I wanted to keep it simple and intuitive.

• -1: But that won't pass all the components NOT at $f_0$, will it? – Peter K. Aug 2 '14 at 1:24
• @PeterK., I thought what I wrote was enough to infer the rest. I now made it clearer. I think you can undo the -1 :-). – Royi Aug 22 '18 at 6:14
• Yes, that's much clearer. Thank-you! – Peter K. Aug 22 '18 at 11:53