【发布时间】:2015-04-30 11:40:51
【问题描述】:
我有一些信号,我将它们加起来形成一个更大的信号,其中每个信号位于不同的频率区域。 现在,我用 FFTW 对大信号进行 FFT 运算,并切出具体的 FFT bin(信号所在的位置)。
例如:大信号经过1024个点的FFT变换,
信号的采样率为fs=200000。
我通过以下方式计算给定开始和停止频率的具体 bin 位置:
tIndex.iStartPos = (int64_t) ((tFreqs.i64fstart) / (mSampleRate / uFFTLen));
例如我得到第一个信号被切掉 16 个箱子。 现在我再次使用 FFTW 进行 IFFT 转换并返回 16 个复数值(因为我为 16 个 bin 保留了向量)。
但是当我将提取的信号与 MATLAB 中的原始小信号进行比较时,我可以看到原始信号(是 wav 文件)具有 xxxxx 数据,而我的信号(我保存为原始二进制文件)只有16 个复数值。
那么如何获取要正确转换的IFFT操作的长度呢?这里有什么问题?
编辑 逻辑本身分为 3 个程序,每行都在多线程环境中。出于这个原因,我在这里发布了一些伪代码:
ReadWavFile(); //returns the signal data and the RIFF/FMT header information
CalculateFFT_using_CUFFTW(); //calculates FFT with user given parameters, like FFT length, polyphase factor, and applies polyphased window to reduce leakage effect
GetFFTData(); //copy/get FFT data from CUDA device
SendDataToSignalDetector(); //detects signals and returns center frequency and bandwith for each sigal
Freq2Index(); // calculates positions with the returned data from the signal detector
CutConcreteBins(position);
AddPaddingZeroToConcreteBins(); // adds zeros till next power of 2
ApplyPolyphaseAndWindow(); //appends the signal itself polyphase-factor times and applies polyphased window
PerformIFFT_using_FFTW();
NormalizeFFTData();
Save2BinaryFile();
-->然后在MATLAB中分析数据(目前正在工作中)。
【问题讨论】:
-
能否请您发布您的代码?这将使您的描述更清晰,也可能是代码没有正确遵循您的描述。
-
你有什么wav文件,采样率为200000?疯了。
-
IFFT 的输入长度必须与您想要输出的长度相同(例如 1024,与您放入第一个 FFT 的数据长度相同),而不是更短(例如16 而不是 1024)。如果您想要真正的结果,IFFT 的输入也必须是共轭对称的。
标签: c++ matlab fft fftw frequency-analysis