Electronics > Beginners

FFT in MATLAB - Sequence Length?

(1/1)

norand:
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.

gf:
See https://en.wikipedia.org/wiki/Spectral_leakage and https://en.wikipedia.org/wiki/Window_function.

Andy Watson:
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.

unitedatoms:
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.

norand:
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:

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod