我有一些信号,它们位于不同的频率区域,我把它们相加成一个更大的信号。接下来,我使用FFTW对大信号执行FFT操作,并从中截取具体的FFT频段(信号所在的频率区域)。
例如:将1024个采样点的大信号进行FFT变换,信号的采样率为fs=200000
。
我按照以下方式计算给定起始和终止频率所在的具体频段位置:
tIndex.iStartPos = (int64_t) ((tFreqs.i64fstart) / (mSampleRate / uFFTLen));
例如,我得到了第一个信号被切断的16个频率箱。
现在我再次使用FFTW进行IFFT转换,并获得了16个复杂值(因为我为16个频率箱保留了向量)。
但是当我将提取的信号与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中分析数据(目前正在工作中)。