我有以下代码:
sampling_rate=128
N = sampling_rate
_f, t, Sxx = signal.spectrogram(_signal, sampling_rate, nperseg=N, nfft=N, noverlap=N-1, mode="complex")
cm = plt.pcolormesh(t, _f, np.log(np.abs(Sxx)), cmap="viridis")
plt.savefig('Spectogram.png', dpi=300, frameon='false') 这给了我以下的情节:

定义正确参数的正确方法是什么,即: nperseg、nfft和noverlap以获得正确和平滑的绘图?
谢谢!
输入信号的图:

发布于 2022-05-09 15:25:18
我能够通过标准化输入信号来解决这个问题,并做:
t, f, Sxx = signal.spectrogram(filt_signal[sampleIDX], fs=128,
nperseg=200, noverlap=180, return_onesided=True)
Sxx = np.log(Sxx)
Sxx = (Sxx - np.min(Sxx)) / (np.max(Sxx) - np.min(Sxx))
image_Sxx = Image.fromarray(np.uint8(cm.viridis(Sxx)*255))https://stackoverflow.com/questions/72134163
复制相似问题