DSP Practical - Experiment 2

To write and perform MATLAB program to calculate N-point DFT

Aim

To write and perform a MATLAB program to calculate the N-point Discrete Fourier Transform (DFT) for a given input sequence.

Problem Statement

Given the input sequence:

          x(n) = [1 2 3 4]
        

Calculate the 4-point DFT along with their amplitude and phase spectrum.

Theory

The Discrete Fourier Transform (DFT) is a mathematical transformation used to analyze the frequency content of a discrete signal. The N-point DFT of a sequence x(n) is given by:

          X(k) = sum (x(n) * exp(-j*2*pi*k*n/N)), where n = 0, 1, 2, ..., N-1
        

The amplitude spectrum represents the magnitude of the DFT coefficients, and the phase spectrum represents the phase of each coefficient.

MATLAB Code

Expected Output

The MATLAB code generates two plots:

  1. Input Sequence (x(n)): The original input sequence is displayed in the first plot.
  2. Amplitude Spectrum of DFT (|X(k)|): The second plot shows the amplitude of the DFT coefficients.
  3. Phase Spectrum of DFT (∠X(k)): The phase of each DFT coefficient is displayed.

The amplitude spectrum indicates the magnitude of each frequency component, while the phase spectrum shows the phase shift of these components.