フィルターのクリア

speeding up ifft with conjugate symmetry

16 ビュー (過去 30 日間)
markushatg
markushatg 2012 年 12 月 13 日
コメント済み: ro bader 2020 年 5 月 15 日
In my MATLAB program I convert a time signal to the frequency domain and then back to time domain via the overlap add method.
According to the documentation, ifft(X) is faster if X is conjugate symmetric.
going from frequency to time I've tried
Yn = Xn;
yn = ifft(Yn, N);
versus the following, where I've tried to implement it as I understand the documentation
Yn(1:N) = Xn;
Yn = [Yn(1:N) fliplr(conj(Yn(1:N)))];
yn = ifft(Yn, N);
N = length(Xn), which is the same in both cases.
In both cases I preallocate the needed memory, but the first one is always faster than the second.
What am I doing wrong?
The full code is downloadable from my dropbox: https://dl.dropbox.com/u/51552385/overlap_add.m
Thanks for your help
Full code:
L = 64; %Blocklength/Number of bands
M = L/2; %filterlength/Decimation factor
N = L + M - 1; %fft- and ifft length
fs = 20e3;
x = randn(1, 2*fs); %generate full input signal
y = zeros(1, length(x)); %allocate memory for y
y = [y zeros(1, M-1)]; %add extra space for last overlap, eventually to be cut away
complex = false; %choose ifft method
if(complex)
Yn = [y y];
end
tic
for n = 1:length(x)/L
blockn = [x((n-1)*L+1:n*L) zeros(1,M-1)]; % blockn is equal to nth block
Xn = fft(blockn, N);
if(complex)
Yn(1:N) = Xn;
Yn = [Yn(1:N) fliplr(conj(Yn(1:N)))];
yn = ifft(Yn, N);
else
Yn = Xn;
yn = ifft(Yn, N);
end
%overlap and add current block to output signal y
y((n-1)*L+1:N+(n-1)*L) = y((n-1)*L+1:N+(n-1)*L) + yn;
end
toc
y = y(1:length(x)); %cut away last overlap
error = norm(y-x)

回答 (1 件)

Wayne King
Wayne King 2012 年 12 月 13 日
Have you tried just using the 'symmetric' flag to treat the input as conjugate symmetric?
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
xhat = ifft(xdft,'symmetric');
  1 件のコメント
ro bader
ro bader 2020 年 5 月 15 日
Is there a way other thann the option 'symmetric'?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by