I'm implementing a Python script that calculates the response of a system given an input. The system is $y(t) = x(t-2)$, i.e. it delays the signal by $2$, and the signal is $x(t) = \sin(3t)u(t)$.

As I'm learning the discrete Fourier transform (and it's inverse), I'm doing all the calculation in frequency domain. The procedure is very simple:

  1. Sample $x(t)$ between $[-10, 10]$ where the interval between each sample is $0.01$
  2. Calculate the DFT of $x(t)$ sampled (the result is $X(j\omega)$)
  3. Multiply the $X(j\omega)$ by $e^{-j2\omega}$ to shift the signal (the result is $Y(j\omega)$)
  4. Calculate the inverse DFT to obtain $y(t)$ sampled

In the end, the result is plotted and it's straightforward to check its correctness for $t > 0$. However, for $t < 0$, the output has some kind of strange behavior, as you can see below:


zoom at the beginning

Am I missing something? Can someone please explain me what causes this?


That's not strange – that's expected!

The DFT is a circular operation – by shifting to the right, your signal "wrapped" around.

What you need to do is called fast convolution based on the DFT/FFT. The Wikipedia has a nice article on the Overlap-Add and the Overlap-Save methods, so I'd recommend starting with these, and then going for the literature that suits your understanding best.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.