0% found this document useful (0 votes)
8 views3 pages

DSP Lab Exp6

The document outlines an experiment to compute the N-point Direct Fourier Transform (DFT) and Inverse Direct Fourier Transform (IDFT) of a given sequence using MATLAB. It includes a MATLAB program that calculates the DFT and IDFT, displays their magnitudes and phases, and plots the input sequence along with the DFT and IDFT responses. The expected output and graphs are provided, demonstrating the results of the computations.

Uploaded by

me.rithvika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

DSP Lab Exp6

The document outlines an experiment to compute the N-point Direct Fourier Transform (DFT) and Inverse Direct Fourier Transform (IDFT) of a given sequence using MATLAB. It includes a MATLAB program that calculates the DFT and IDFT, displays their magnitudes and phases, and plots the input sequence along with the DFT and IDFT responses. The expected output and graphs are provided, demonstrating the results of the computations.

Uploaded by

me.rithvika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Experiment: 06

N-POINT DFT AND IDFT OF A SEQUENCE USING BUILT IN


FUNCTIONS
Aim :

To compute the N-point Direct Fourier Transform (DFT) and Inverse Direct Fourier Transform (IDFT) of a
given sequence using built-in functions.

Apparatus: PC having MATLAB software.

Theory:

MATLAB Program:

% To compute the DFT and IDFT for the given sequence


% using built in functions
clc;
clear all;
close all;
xn=input('enter the input sequence:');
N=length(xn);
xk=fft(xn,N); % DFT using built in function
y=ifft(xk); % IDFT using built in function

xkm=abs(xk); % Find the magnitudes of individual DFT points


phase=angle(xk); % Find the phases of individual DFT points
ym=abs(y); % Find the magnitudes of individual IDFT points
disp('DFT is:'); disp(xk);
disp('DFT magnitude is:'); disp(xkm);
disp('DFT phase is:'); disp(phase);
disp('IDFT is:'); disp(y);
disp('IDFT magnitude is:'); disp(ym)
%code block to plot the input sequence
n=0:N-1;
subplot(221);
stem(n,xn);
grid
ylabel 'Amplitude');
xlabel('Time samples');
title('Input Sequence');

%code block to plot the DFT magnitude response


k=0:N-1;
subplot(222);
stem(k,xkm);
grid
ylabel('Amplitude');
xlabel('Frquency Samples');
title('FFT Magnitude Response');

%code block to plot the DFT phase sequence


subplot(223);
stem(k,phase);
grid
ylabel('Phase');
xlabel('Frquency Samples');
title('FFT Phase Response');

%code block to plot the IDFT Magnitude Response


subplot(224);
stem(n,ym);
grid;
ylabel('Amplitude');
xlabel('Time samples');
title('IDFT Magnitude Response');

Expected Output:
Enter the input sequence:[0 1 2 3 4 5 6 7]
DFT is:
Columns 1 through 6
28.0000 + 0.0000i -4.0000 + 9.6569i -4.0000 + 4.0000i -4.0000 + 1.6569i -4.0000 + 0.0000i -4.0000 - 1.6569i
Columns 7 through 8
-4.0000 - 4.0000i -4.0000 - 9.6569i
DFT magnitude is:
28.0000 10.4525 5.6569 4.3296 4.0000 4.3296 5.6569 10.4525
DFT phase is:
0 1.9635 2.3562 2.7489 3.1416 -2.7489 -2.3562 -1.9635
IDFT is:
0 1 2 3 4 5 6 7
IDFT magnitude is:
0 1 2 3 4 5 6 7
Expected Graphs:

Input Sequence FFT Magnitude Response


7 30

6 25
5
20
Amplitude)

Amplitude
4
15
3
10
2

1 5

0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Time samples Frquency Samples

FFT Phase Response IDFT Magnitude Response


4 7

3 6

2 5

Amplitude
1 4
Phase

0 3

-1 2

-2 1

-3 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Frquency Samples Time samples

Result:
The DFT and IDFT of a sequence are obtained using built in functions of MATLAB. DFT Magnitude and
phase responses are plotted. IDFT Magnitude response is plotted.

Exercise:
1. Find the DFT for the sequence x(n)={0,1,2,3,4,5,6,7} and find IDFT for its response.

You might also like