June 2015
Beginner
348 pages
8h 44m
English
We will create a signal, transform it, and then shift the signal. Shift the frequencies with the following steps:
30 points:x = np.linspace(0, 2 * np.pi, 30) wave = np.cos(x)
fft() function:transformed = np.fft.fft(wave)
fftshift() function:shifted = np.fft.fftshift(transformed)
ifftshift() function. This should undo the shift. Check with the following code snippet:print(np.all((np.fft.ifftshift(shifted) - transformed) < 10 ** -9))
The result appears as follows:
True
plt.plot(transformed, lw=2, label="Transformed") plt.plot(shifted, '--', lw=3, label="Shifted") ...
Read now
Unlock full access