scipy.signal.spectrogram nfft参数 [英] scipy.signal.spectrogram nfft parameter

查看:623
本文介绍了scipy.signal.spectrogram nfft参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此功能中的nfft参数是什么意思?请参考此链接以获取文档 https://docs.scipy.org/doc/scipy-0.19.0/reference/generation/scipy.signal.spectrogram.html

What does nfft parameter mean in this function? Please refer to this link for the documentation https://docs.scipy.org/doc/scipy-0.19.0/reference/generated/scipy.signal.spectrogram.html

推荐答案

scipy.signal.spectrogram works by splitting the signal into (partially overlapping) segments of time, and then computing the power spectrum from the Fast Fourier Transform (FFT) of each segment. The length of these segments can be controlled using the nperseg argument, which lets you adjust the trade-off between resolution in the frequency and time domains that arises due to the uncertainty principle. Making nperseg larger gives you more resolution in the frequency domain at the cost of less resolution in the time domain.

除了改变进入每个段的样本数量外,有时还需要在进行FFT之前对每个段应用零填充.这就是nfft参数的用途:

In addition to varying the number of samples that go into each segment, it's also sometimes desirable to apply zero-padding to each segment before taking its FFT. This is what the nfft argument is for:

nfft :int,可选

如果需要零填充FFT,则使用FFT的长度.如果为 None ,则FFT长度为 nperseg .默认为.

Length of the FFT used, if a zero padded FFT is desired. If None, the FFT length is nperseg. Defaults to None.

默认情况下为nfft == nperseg,表示将不使用零填充.

By default, nfft == nperseg, meaning that no zero-padding will be used.

  • One reason is that this makes the FFT result longer, meaning that you end up with more frequency bins and a spectrogram that looks "smoother" over the frequency dimension. However, note that this doesn't actually give you any more resolution in the frequency domain - it's basically an efficient way of doing sinc interpolation on the FFT result (see here for a more detailed explanation).
  • From a performance perspective it might make sense to pad the segments so that their length is a power of 2, since radix-2 FFTs can be significantly faster than more general methods.

这篇关于scipy.signal.spectrogram nfft参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆