scipy.signal.spectrogram compared to matplotlib.pyplot.specgram

前端 未结 1 1152
暖寄归人
暖寄归人 2021-02-08 00:44

The following code generates a spectrogram using either scipy.signal.spectrogram or matplotlib.pyplot.specgram.

The color contrast of the

相关标签:
1条回答
  • 2021-02-08 01:01

    plt.specgram not only returns Pxx, f, t, but also does the plotting for you automatically. When plotting, plt.specgram plots 10*np.log10(Pxx) instead of Pxx.

    However, signal.spectrogram only returns Pxx, f, t. It does not do plotting at all. That is why you used plt.pcolormesh(t, f[0:20], Sxx[0:20]). You may want to plot 10*np.log10(Sxx).

    0 讨论(0)
提交回复
热议问题