I'm having difficulties understanding some basics regarding FFT. I was hoping you could answer a few questions I have. These questions will probably seem silly to you, sorry for that. I'm a complete beginner in DSP.
Let's consider the following script:
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, np.pi * 2, 256)
y = np.sin(x) + np.sin(2*x + 1)
Y = np.fft.fft(y)
freq = np.fft.fftfreq(x.shape[-1])
plt.plot(freq, Y.real)
plt.savefig('Y_real.png')
plt.close()
plt.plot(freq, Y.imag)
plt.savefig('Y_imag.png')
plt.close()
y2 = np.fft.ifft(Y)
plt.plot(x, y2.real)
plt.savefig('y2_real.png')
plt.close()
The signal in time domain (y2_real.png):
The signal in frequency domain, real part (Y_real.png):
Imaginary part (Y_imag.png):
I was expecting that the real part will represent amplitudes of two sinusoidal signals and the imaginary part will represent a phase shift of them. However the amplitude 109 doesn't make much sense to me, nor does the phase shift of +/-128.
Where did these numbers came from? Also I'm not sure whether everything is right with OX axises in the frequency domain. How exactly can I figure out which frequency represents one peak or another?