# How to compute impulse and frequency response of Flanger?

I have to the implementation of a Flanger effect on Matlab, buy previously I have to plot its frequency response and impulse response.

The difference equation is $y[n]=x[n]+a\cdot x[n-d[n]]$ where $a$ is a constant, $|a|<1$, and $d[n]=\frac D2 (1-\cos(2\pi f_s n))$; $D$ and $f \text{ const}$.

I'm having trouble on how to calculate any of DTFT o Z Transform of such difference equation. I can't find how to compute the varying time shifting transform for $x[n-d[n]]$.

Is there any other way to compute impulse and frequency responce?

Only linear time invariant systems are fully characterised by their impulse response. Modulation effects like a flanger break time invariance. While you can still create a momentary impulse response (which is only of very limited use), there is no meaningful frequency response.

As stated in the answer of @Jazzmaniac, the impulse response does not fully characterise your time-variant system: the impulse response of the system depends on the time it is computed.

However, in your case it should be quite easy to get a visual representation of how the impulse response of your system evolves over time. $d[n]$ is a function whose value changes sinusoidally in the interval $(0,D/2)$ at a rate determined by $f_s$.

Thus, I believe it might be useful for you to plot the impulse response (or frequency response) with different values of $d[n]$, spaced regularly over the interval $(0,D/2)$, and to have the plots overlaid.

You can make several plots with different $a$ and $D$ as well, if you want to get an idea on how these affect the behaviour of your system.

• Thanks. I've plotted in Matlab the way you indicate, problem is that, for example, when D=10 and a=0.05, Matlab gives a sample in n=10 ,which is correct, but gives 0 for n=5, which isn't correct. I know this is something about number representation, but I can't solve d[n]=n. If given the case I can solve that equation, is it correct to compute Z-T with those coefficients and then evaluate it at z=exp(j*2*pi*s) so I can get the freq response ? Or is it wrong beacuse freq resp depends on n? (time variant). Thanks a lot.
– Coty
Jul 18, 2018 at 18:09