0

I got this from here, using the fft, we can obtain the frequency of the input signals. My simple (but maybe ignorant) question is, apart from retrieving the frequencies of the individual signals, can we also retrieve the amplitude and phase shift information of the individual input components ? So we can fully reconstruct the individual signals ?

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack

# Number of samplepoints
N = 600
# sample spacing
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = scipy.fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N/2)

fig, ax = plt.subplots()
ax.plot(xf, 2.0/N * np.abs(yf[:N//2]))
plt.show()
Ayan Mitra
  • 497
  • 1
  • 8
  • 20
  • `yf` is complex-valued. The magnitude of each value is the amplitude of the corresponding sine wave. The phase of the each value is the phase shift of the corresponding sine wave. – Cris Luengo Apr 19 '20 at 08:13
  • Hi, can you please show, based on the above code, how to extract the amplitude and phase shift like you mention. thanks – Ayan Mitra Apr 19 '20 at 08:56

0 Answers0