Author Topic: FFT in MATLAB - Sequence Length?  (Read 869 times)

0 Members and 1 Guest are viewing this topic.

Offline norandTopic starter

  • Contributor
  • Posts: 19
  • Country: gb
FFT in MATLAB - Sequence Length?
« on: January 10, 2020, 04:22:27 pm »
Hi All,

I have a question related to some DSP coursework for my degree (So try not to directly tell me if possible - but I really need to understand). My lecture has asked the following:

 "A discrete time sinusoidal signal can be generated in Matlab as follows:
N = 0:1:100; f = 0.1; x = sin(2*pi* f*n);
where f=0.1 is the normalised frequency of the sinusoidal waveform. Apply,
stem(abs(fft(x))) and discuss the results.
Now generate x as x = x = sin(2*pi* 0.1*n) + 3*sin(2*pi* 0.25*n). Obtain discrete
Fourier transform coeffects and discuss the results. "

So from this, I get two DFT plots, and can make the following conclusions:

  • The amplitude plotted is equal to the amplitude of the sin wave * N/2 (sequence length/2)
  • The Frequency plot is mirrored around the N/2 point
  • The DFT plot gives me multiple frequency points (rather than the 1 or for the second part 2 expected 

I have noticed that if I change the sequence length to N = 0:1:(100-1), then the last point goes away, and hence the DFT plot only gives two Fourier coefficients as expected. This is obviously more correct than what my lecturer has provided, but I am struggling to see why it is making such a big difference.

In conclusion, my question is why do I get more Fourier components with a sequence length of 101 or greater in comparison to 100? I have attached the two plots as JPEG format, and can provide code if necessary.

Thanks in Advance, am happy to direct my question elsewhere, but you guys are always super helpful with my other electronics questions so thought I'd try here first.

 

Online gf

  • Super Contributor
  • ***
  • Posts: 1327
  • Country: de
 
The following users thanked this post: norand

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2120
Re: FFT in MATLAB - Sequence Length?
« Reply #2 on: January 10, 2020, 06:00:38 pm »
You might want to add to your list of conclusions by considering what determines the frequency resolution of your DFT, and then what happens to the energy in the frequencies that are not perfectly resoloved.
 
The following users thanked this post: norand

Offline unitedatoms

  • Frequent Contributor
  • **
  • !
  • Posts: 324
  • Country: us
Re: FFT in MATLAB - Sequence Length?
« Reply #3 on: January 10, 2020, 06:31:03 pm »
To understand it intuitively consider that with different sequence length you form different signal. Fourier treats signal as repeated fragment infinite times over.


If at point of stitching the fragments you have a discontinuity, the spectrum will show it. Try to choose exact amount of samples to have perfect stitching. Or else you need to do a smooth magnitude shaping (windowing) to force stitching at zero magnitude.
Interested in all design related projects no matter how simple, or complicated, slow going or fast, failures or successes
 
The following users thanked this post: Wimberleytech, norand

Offline norandTopic starter

  • Contributor
  • Posts: 19
  • Country: gb
Re: FFT in MATLAB - Sequence Length?
« Reply #4 on: January 10, 2020, 11:13:27 pm »
Thanks all! Sometimes it's just knowing what to type in google - I found this TI video really explained this for me.

TI Precision Labs – ADCs: Fast Fourier Transforms (FFTs) and Windowing:
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf