0% found this document useful (0 votes)
25 views2 pages

DSP4

This document describes MATLAB implementations of the discrete Fourier transform (DFT) and inverse discrete Fourier transform (IDFT). It includes functions for calculating the DFT and IDFT of input sequences. The document then provides examples of using these functions to: 1) Calculate the 8-point DFT of a time domain sequence and plot the magnitude and phase spectrum 2) Calculate the 8-point IDFT of a frequency domain sequence and plot the magnitude and phase spectrum 3) Evaluate and plot the circular convolution of two time domain sequences using the DFT and IDFT functions.

Uploaded by

aaplahs
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

DSP4

This document describes MATLAB implementations of the discrete Fourier transform (DFT) and inverse discrete Fourier transform (IDFT). It includes functions for calculating the DFT and IDFT of input sequences. The document then provides examples of using these functions to: 1) Calculate the 8-point DFT of a time domain sequence and plot the magnitude and phase spectrum 2) Calculate the 8-point IDFT of a frequency domain sequence and plot the magnitude and phase spectrum 3) Evaluate and plot the circular convolution of two time domain sequences using the DFT and IDFT functions.

Uploaded by

aaplahs
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

EXPERIMENT NO: 4

AIM: MATLAB Implementation of Discrete Fourier transform (DFT) and Inverse Discrete Fourier
transform (IDFT). FUNCTION: DFT: function[y,ny]=dft(x,N) w=zeros(N,N); for k=0:N-1 n=0:N-1 s=k.*ones(1,N); w(k+1,:)=exp(-j*((2*pi)/N)*(s.*n)); end y=x*w; ny=0:N-1;

IDFT: function[y,ny]=idft(x,N) w=zeros(N,N); for k=0:N-1 n=0:N-1; s=k.*ones(1,N); w(k+1,:)=exp(1i*((2*pi)/N)*(s.*n)); end y=(x*w)./N; ny=0:N-1;

Activity 1. Determine the 8- point DFT of time domain sequence x (n) = [1 1 2 2 3 3]. Also find and plot the corresponding magnitude and phase spectrum.
PROGRAM: x=input('Enter function x'); N=input('Enter N:'); x=[x zeros(1,N-length(x))]; [y,ny]=dft(x,N); stem(ny,abs(y)); xlabel('discrete time') ylabel('amplitude') title('DFT')

INPUT: Enter function x[1 1 2 2 3 3] Enter N:8

GRAPH:

Activity 2. Determine the 8- point IDFT of frequency domain sequence, X (k) = [3, 2+j, 2-j, -3]. Also find and plot the corresponding magnitude and phase spectrum.
Activity 3. Evaluate and plot the circular convolution of the following time domain sequences using DFT and IDFT. Use functions for DFT and IDFT. x (n) = [1, 2 ,-3, 1] and h (n) = [-4, 3, -2, 1, 2]

You might also like