Why the ifft of a constant signal does not give a delta function with zero DC?

2 views (last 30 days)
Hi.
Suppose the frequency response is flat (that means a vector of a single constant which I named it 'AAA' or 'BBB' in the code). I am trying to take the ifft of this signal and convert it to the time domain, let's name it 'aaa' or 'bbb' in time domain. In theory I should get a delta function if the constant in frequency domain is from -Inf to +Inf. However the frequency domain signal is limited number of samples . Because of that, when I get the ifft of the constant signal, I see a sinc shape in the time domain instead of a delta function, which is as expected. However, this sinc function does not have a 0 DC value. By that, I mean if you look at the tails of the sinc function, the average is not 0 (it seems they are a bit shifted up and not centered at 0). I know I can control this effect by manipulating the DC component (that is the first sample) in the frequency domain, however that's not a right way to do it. I wanted to know the reason behind this effect and a right way to generate the ifft of a constant signal such that the tails of a generated sinc function in time domain are centered at 0. Any suggestion, idea, or help is really appreciated.
Thanks, ss
AAA = 2*[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ]; % or 2*ones(1,8)
BBB = 1*[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % or ones(1,16)
Nfft = 2^14;
aaa = Nfft * ifft(AAA, Nfft);
bbb = Nfft * ifft(BBB, Nfft);
aaa = fftshift(aaa);
bbb = fftshift(bbb);
mean(real(aaa(1:6000))) %taking average of the tail.
mean(real(bbb(1:6000)))
figure(2)
plot(real(aaa), 'b')
hold on
plot(real(bbb), 'r')
plot([0,Nfft],[0,0], 'k') % draw a line at 0

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!