dft

No instance of overloaded function when resizing

谁说胖子不能爱 提交于 2021-02-05 09:19:13
问题 I got an error of "No instance of overloaded function" when I used resize(). I'm aware that what's inside of resize() might be wrong as well. I'm trying to resize x, an array of floats to all zeros. Not sure if std::vector>(0, 0) would be the right syntax for it as I am very new to C++. How do I solve the existing error? void IDFT(const std::vector<std::complex<float>> &Xf, std::vector<float> &x) { // allocate space for the vector holding the frequency bins // initialize all the values in the

Getting the frequencies associated with STFT in Librosa

青春壹個敷衍的年華 提交于 2021-01-27 12:52:14
问题 When using librosa.stft() to calculate a spectrogram, how does one get back the associated frequency values? I am not interested in generating an image as in librosa.display.specshow , but rather I want to have those values in hand. y, sr = librosa.load('../recordings/high_pitch.m4a') stft = librosa.stft(y, n_fft=256, window=sig.windows.hamming) spec = np.abs(stft) spec gives me the 'amplitude' or 'power' of each frequency, but not the frequencies bins themselves. I have seen that there is a

Discrete Fourier transform

你离开我真会死。 提交于 2020-05-24 10:11:43
问题 I am currently trying to write some fourier transform algorithm. I started with a simple DFT algorithm as described in the mathematical definition: public class DFT { public static Complex[] Transform(Complex[] input) { int N = input.Length; Complex[] output = new Complex[N]; double arg = -2.0 * Math.PI / (double)N; for (int n = 0; n < N; n++) { output[n] = new Complex(); for (int k = 0; k < N; k++) output[n] += input[k] * Complex.Polar(1, arg * (double)n * (double)k); } return output; } } So

一幅图弄清DFT与DTFT,DFS的关系

南笙酒味 提交于 2020-04-24 22:43:55
很多同学学习了数字信号处理之后,被里面的几个名词搞的晕头转向,比如DFT,DTFT,DFS,FFT,FT,FS等,FT和FS属于信号与系统课程的内容,是对连续时间信号的处理,这里就不过多讨论,只解释一下前四者的关系。   首先说明一下,我不是数字信号处理专家,因此这里只站在学生的角度以最浅显易懂的性质来解释问题,而不涉及到任何公式运算。   学过卷积,我们都知道有 时域卷积定理 和 频域卷积定理 ,在这里只需要记住两点:1.在一个域的相乘等于另一个域的卷积;2.与脉冲函数的卷积,在每个脉冲的位置上将产生一个波形的镜像。(在任何一本信号与系统课本里,此两条性质有详细公式证明)   下面,就用这两条性质来说明DFT,DTFT,DFS,FFT之间的联系:   先看图片:   首先来说图(1)和图(2),对于一个模拟信号,如图(1)所示,要分析它的频率成分,必须变换到频域,这是通过傅立叶变换即 FT(Fourier Transform) 得到的,于是有了模拟信号的频谱,如图(2); 注意1:时域和频域都是连续的 !   但是,计算机只能处理数字信号,首先需要将原模拟信号在 时域离散化 ,即在时域对其进行采样,采样脉冲序列如图(3)所示,该采样序列的频谱如图(4),可见它的频谱也是一系列的脉冲。所谓时域采样,就是在时域对信号进行相乘,(1)×(3)后可以得到离散时间信号x[n],如图(5

only integers, slices (`:`), ellipsis (`…`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

六月ゝ 毕业季﹏ 提交于 2020-04-05 08:07:44
问题 I am implementing fft as part of my homework. My problem lies in the implemention of shuffling data elements using bit reversal. I get the following warning: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future. data[x], data[y] = data[y], data[x] And the auto grading system (provided by university) returns the following: error: only integers, slices ( : ), ellipsis ( ... ), numpy.newaxis ( None ) and integer or boolean arrays are valid

only integers, slices (`:`), ellipsis (`…`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

让人想犯罪 __ 提交于 2020-04-05 08:07:29
问题 I am implementing fft as part of my homework. My problem lies in the implemention of shuffling data elements using bit reversal. I get the following warning: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future. data[x], data[y] = data[y], data[x] And the auto grading system (provided by university) returns the following: error: only integers, slices ( : ), ellipsis ( ... ), numpy.newaxis ( None ) and integer or boolean arrays are valid