import scipy.signal as signal
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(1234)
x = np.linspace(-4, 4, 200)
y = np.sinc(x)
n = 200
noise = np.random.normal(loc=0, scale=0.1, size=n)
sig = y + noise
peak = np.fft.fft(sig)
freq, specarr = signal.periodogram(peak, fs=100, window='boxcar', nfft=100,detrend='constant',return_onesided=False, scaling='density', axis=-1)
plt.plot(freq,specarr)
plt.show()
It obvious frequency 0 hz [0,x]
missed in the plot,how to solve this problem?
fftshift
inhelp(signal.periodogram)
.Should I alwaysfftshift
aftersignal.periodogram
? $\endgroup$