Complete the code to import the FFT function from the numpy library.
from numpy.fft import [1]
The fft function computes the Fast Fourier Transform of a signal.
Complete the code to compute the FFT of the signal stored in variable 'signal'.
spectrum = [1](signal)The np.fft.fft function computes the FFT of the input signal.
Fix the error in the code to correctly compute the magnitude spectrum from FFT output.
magnitude = [1](spectrum)The magnitude of the FFT output is obtained using np.abs, which calculates the absolute value of complex numbers.
Fill both blanks to create a frequency array matching the FFT output length.
freqs = np.fft.[1](len(signal)) * [2]
np.fft.fftfreq generates frequency bins for FFT output. Multiplying by the sampling rate converts to actual frequency values.
Fill all three blanks to compute the inverse FFT and retrieve the original signal.
recovered_signal = np.fft.[1]( [2] ) real_signal = np.[3](recovered_signal)
The inverse FFT is computed with np.fft.ifft on the spectrum. The result is complex, so np.real extracts the real part as the original signal.
