我使用 Matlab 执行 FFT-IFFT 以从我的信号中取出 50 Hz 及其谐波。为此,我将信号分解为 1024 个样本的窗口,并对其执行 FFT。我也做了 50% 的重叠。FFT 完成后,我取出那些谐波,并进行 IFFT 以获得过滤数据。我的问题是:如何总结所有重叠的窗口以获得信号?
我的代码如下。如您所见,我对每个窗口执行 FFT-IFFT,但不知道如何将所有窗口重新组合在一起。
[y, Fs, nbits] = wavread([fileName]); %read the data
[noSamples, noChannels] = size(y);
N = 1024; %window length 2^10
winLength=N;
Fres = Fs/N; % resolution frequency
nofWins = floor(noSamples/winLength); % No of full windows
noWins = round((100/50)*nofWins - 1); % rounded no of windows
yPaddedLength = floor(noWins*0.5*winLength + winLength); % padding wth 0
yZeroPadded =[y zeros(1, (yPaddedLength - noSamples))]; % padded signal y
nofWinsPadded = round(yPaddedLength/winLength);
noWinsPadded = round((100/50)*nofWinsPadded - 1); % no of padded windows
odd = true;
for k = 1:(noWinsPadded-1)
j = floor(0.5*k);
at = j*winLength + 1;
overlapWinLength=floor(0.5*winLength);
range = at:(at + winLength - 1);
if odd
data = yZeroPadded(range, 1);
data_sum=sum(data); % from now on - to perform
% DC removal
data_average=data_sum/N;
data=data-data_average;
else
data = yZeroPadded(range+overlapWinLength, 1);
data_sum=sum(data);
data_average=data_sum/N;
data=data-data_average;
end;
odd=~odd;
spectrum = fft(data);
F=length(spectrum);
F=spectrum;
F(10:11)=zeros; % FFT No equals to zero removes harmonics
F(17:18)=zeros % and so on
filtered_signal=IFFT(F);
谢谢你的期待,艾伦车