I am trying to time-shift a signal x, which is a sine wave with 10 sec time-period, by t=2 seconds to get shifted version y using Fourier Transform and Inverse Fourier Transform. I am using the following code in Mathematica:

x := Sin[2*Pi*0.1*t]
fftx := FourierTransform[x, t, ω]
ffty := Exp[I *ω*2]*fftx
y := InverseFourierTransform[ffty, ω, t]

Plot[x, {t, 0, 20}]
Plot[y, {t, 0, 20}]

When I try to plot y, I do not get a shifted version of x, as expected. Instead, y is same as x. What's wrong?

  • 4
    $\begingroup$ This is garbled code. You need to be multiplying fftx by a vector of frequency dependent phase factors, not a scalar, which is what this appears to attempt, $\endgroup$ – John Doty Aug 9 '18 at 18:26
  • $\begingroup$ @JohnDoty I think I'm doing that in ffty. $\endgroup$ – user399146 Aug 9 '18 at 18:39
  • $\begingroup$ Everything in your code is fine in principle. The only thing you did wrong is to use := instead of =. Make that replacement everywhere and it will work. I think @JohnDoty misunderstood, maybe was thinking about discrete FT. $\endgroup$ – Jens Aug 9 '18 at 18:40
  • $\begingroup$ Look up SetDelayed to understand the difference to Set - it's very important... $\endgroup$ – Jens Aug 9 '18 at 18:44
  • 1
    $\begingroup$ @Jens is right. FourierTransform vs Fourier. And you fixed the garble. $\endgroup$ – John Doty Aug 9 '18 at 18:46

Your Answer

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

Browse other questions tagged or ask your own question.