多行的傅里叶变换

Fourier transform of multiple rows

我想对 10 次测量进行 FFT。这意味着我的数据中有 10 行,每行的维度为 [1*2000]。在下面的代码中,我做错了。谁能告诉我我犯了什么错误?

load('fb2010');                                   % loading the data
x = fb2010(3:1:15,:);
y_filt = filter(b,a,x);                           % filtering the received signal
%%%%%%%  Fourier transform
nfft = length(y_filt);
for i = 1:10
res(i,:) = fft(y_filt(i,:),nfft)/ nfft;         %%%% Taking first fft and normalizing it
end
res2 = res(:,1:nfft/2+1);                   %%%% taking single sided spectrum
f = fs/2*linspace(0,1,nfft/2+1);            % choosing correct frequency axes
figure, plot(f,abs(res2));

doc fft:

Y = fft(X,n,dim) 其中 dim 是维度。我想你想要 dim = 2。 这将摆脱循环并且应该工作。我自己用过。

函数filter默认沿第一个维度应用传递函数。所以你过滤你的列而不是你的行。要获得正确的结果,请使用以下行:

filter(b,a,x,[],2);

然后您可以通过使用 fft 和第三个参数来指定它运行的维度来省略循环。这将是以下行:

res = fft(y_filt,nfft,2);