Exploring the 21 Point DFT in MATLAB

In summary, the conversation discusses a question about why the 21 point DFT has so many values equal to zero. It is explained that the boxcar used in the DFT is not centered, leading to complex phase and a different plot than a plain sinc function. The suggestion is made to try using a boxcar that is centered, which should result in a plot closer to a sinc function. The importance of understanding the phase plot is also mentioned.
  • #1
impervious
2
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: 528
Physics news on Phys.org
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5


Hi there,

Thank you for sharing your MATLAB code and question. As a fellow scientist, I am happy to help provide an explanation for why there are so many values equal to zero in the 21 point DFT.

First, let's define what the 21 point DFT is. The Discrete Fourier Transform (DFT) is a mathematical algorithm that converts a time-domain signal into its frequency-domain representation. The 21 point DFT means that we are taking a signal with 21 data points and converting it into its frequency-domain representation. This is commonly used in signal processing and analysis.

Now, onto the question of why there are so many values equal to zero in the 21 point DFT. This can be explained by the properties of the DFT and the input signal that you have chosen. The DFT is a complex-valued function, meaning that it has both real and imaginary components. In your code, you have defined the input signal as a boxcar function, which is a rectangular pulse. When we take the DFT of a rectangular pulse, it results in a sinc function in the frequency domain. This is because the DFT of a rectangular pulse is a series of sinc functions with different frequencies.

In your code, you can see that the output of the DFT (X) has both magnitude and phase components, as shown in the third subplot. The magnitude component shows the amplitude of each frequency component, while the phase component shows the phase shift of each frequency component. Since the input signal is a rectangular pulse, which has a flat frequency spectrum, the DFT of this signal will also have a flat magnitude spectrum. This means that most of the values in the DFT will be close to zero, with only a few non-zero values representing the sinc function peaks.

In conclusion, the reason for so many values being equal to zero in the 21 point DFT is due to the properties of the DFT and the input signal being a rectangular pulse. I hope this explanation helps to clarify your question. If you have any further questions or need more clarification, please don't hesitate to ask. Happy exploring!
 

1. What is the 21 Point DFT?

The 21 Point DFT, also known as the 21-point discrete Fourier transform, is a mathematical tool used to analyze the frequency components of a discrete-time signal. It is a type of Fourier transform that decomposes a signal into its individual frequency components, allowing for further analysis and processing.

2. How is the 21 Point DFT calculated in MATLAB?

In MATLAB, the 21 Point DFT can be calculated using the built-in function fft(x,21), where x is the input signal. This function returns a 21-point complex vector containing the frequency components of the signal.

3. What are the benefits of using the 21 Point DFT in MATLAB?

The 21 Point DFT is a powerful tool for analyzing signals in the frequency domain. It allows for the identification of specific frequency components, which can be useful in applications such as signal processing, filtering, and spectral analysis. Additionally, MATLAB provides convenient and efficient functions for performing the 21 Point DFT, making it a valuable tool for scientists and engineers.

4. Can the 21 Point DFT be used for real-world applications?

Yes, the 21 Point DFT is commonly used in a variety of real-world applications. Some examples include audio and video processing, digital communications, and biomedical signal analysis. It is a fundamental tool for understanding and manipulating signals in many fields of science and engineering.

5. Are there any limitations to using the 21 Point DFT in MATLAB?

Like any mathematical tool, the 21 Point DFT has its limitations. It requires a discrete-time signal as input, and the number of points used in the calculation can affect the accuracy of the results. Additionally, the 21 Point DFT assumes that the signal is periodic, and any non-periodic components may not be accurately represented. It is important to understand these limitations and use appropriate techniques for signal processing and analysis.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Electrical Engineering
2
Replies
43
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Differential Equations
Replies
1
Views
662
  • Engineering and Comp Sci Homework Help
Replies
11
Views
12K
Back
Top