Why does the 21 Point DFT in MATLAB produce so many zero values?

  • Thread starter Thread starter impervious
  • Start date Start date
  • Tags Tags
    Dft Matlab Point
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 5K views
impervious
Messages
2
Reaction score
0
Hello, I was trawling through some MATLAB work, and came across a question that bugged me, and I hope that someone might be able to give a suitable explanation.

The question was explain why the 21 point DFT has so many values equal to zero. Both DFT's are sinc functions where:

sinc(L)= sin(L * theta)/sin(L)

Heres my MATLAB code :

>> nn=0:20;
>> x=zeros(21,1);
>> x(1:7)=boxcar(7);
>> X=fft(x);
>> subplot(2,2,1),stem(nn,x);
>> subplot(2,2,2),stem(nn,abs(X));
>> subplot(2,2,3),stem(nn,angle(X));

The output of this is attached.

I understand that the basic sinc function is widely used in signals due to its zero crossings, however neither the input of the output look much like sinc functions I have seen before.

Any suggestions much appreciated.
 

Attachments

  • fft.jpg
    fft.jpg
    13.6 KB · Views: 622
Physics news on Phys.org
Your boxcar isn't centered, so it's introducing a complex phase. Try setting x to {1,1,1,1,0,...,0,1,1,1}. You'll then find the imaginary parts of X are essentially 0. Plot the real part of X, and it'll look like a sinc function.
 
Unfortunately I think I am using the boxcar they want me to use, and are talking in relation to the six zero points in my DFT.
Since they occur at sampling integers of 3, I can't help but feel this is somehow an important point that I don't understand.
 
Your first plot of X isn't of the plain sinc function; it's a plot of its absolute value. Can you see why your plot looks the way it does now?

On the phase plot, you might notice that the phase of every third element is essentially ±π. If you ignore those, you can see the remaining phases follow a nice pattern. That pattern arises because your boxcar isn't centered in the time domain.