# FFT and Zero-padding-Spectrum of a truncated cosine wave

Assignment 2: FFT and Zero-padding SUBMISSION DEADLINE Friday 03 March 2020 at 5pm Electronic submission (only) through Brightspace

Task1: Spectrum of a truncated cosine wave

Consider the following analogue sinusoid x(t) = Acos(2πft) where A = 5.0 and f = 2 kHz.

• Starting from t = 0 and assuming the sampling frequency fs = 8 kHz, generate N = 128 samples of the above sine wave. Let x denote the obtained sequence of 128 samples.

• Plotxandcommentontheperiodicityof x. Verifyyourcommentsusingappropriate equations. To plot functions involving digital signals, use the ‘stem’ command in Matlab.

• Compute the FFT of x, and call it X. Note that X is complex.

• Plot the magnitude of X (i.e. the magnitude spectrum) where the zero-frequency component is shifted to the centre of the spectrum. Why do you see the two peaks at the positions they appear?

• Experiment with different number of samples, e.g. N = 127 samples, and comment on the magnitude spectrum plots.
Dr Nam Tran EEEN30050: Signal Processing

Zero Padding In all magnitude spectrum plot sin this task, you need to shift the zero-frequency component to the centre of the spectrum.

• Generate N = 67 samples of a sine wave of frequency f = 330.5 Hz and sampled at fs = 1024 Hz. Call it x.

• Compute the FFT of x, and call it X. • Plot the magnitude of X where the x-axis is the discrete-time frequency. Mark important frequencies of Xon the x-axis (e.g. ±π,±f fs2π).

• Pad zero-valued samples to x so that the resulting signal (called x1) contains M = 128 samples.

• Compute the FFT of x1, and call itX1.

• Inthesamefigureforplottingthemagnitudeof X(use the ‘holdon’ command), plot the magnitude of X1(i.e. the FFT of the zero padded sequence).

• In the same figure as the above,compute and plot the magnitude of the DTFT of x. Comment on what you see.