0% found this document useful (0 votes)
3 views6 pages

Exp 3

The document outlines a MATLAB program for performing the Discrete Fourier Transform (DFT) on a given sequence and plotting its magnitude and phase response. It includes theoretical explanations of DFT, its applications in digital signal processing, and details on library functions used in MATLAB. Additionally, it provides sample viva and assignment questions related to DFT, along with a MATLAB code example for calculating DFT.

Uploaded by

Venkatanathan. S
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)
3 views6 pages

Exp 3

The document outlines a MATLAB program for performing the Discrete Fourier Transform (DFT) on a given sequence and plotting its magnitude and phase response. It includes theoretical explanations of DFT, its applications in digital signal processing, and details on library functions used in MATLAB. Additionally, it provides sample viva and assignment questions related to DFT, along with a MATLAB code example for calculating DFT.

Uploaded by

Venkatanathan. S
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
You are on page 1/ 6

FLOWCHART:

START

ENTER THE DISCRETE


TIMEINPUT SEQUENCE

PERFORM THE DFT USING IN-BUILT FFT AND


USING DIRECT FORMULA ON THE GIVEN
INPUT SEQUENCE

PLOT THE MAGNITUDE AND PHASE


RESPONSE

STOP

10
EX. NO : 3
DATE :
CALCULATION OF DFT OF A SIGNAL

AIM:
To write a MATLAB program to perform the Discrete Fourier Transform for the given two
sequences and to plot their magnitude and phase response.

APPARATUS REQUIRED:
Computer with MATLAB software

THEORY:
DISCRETE FOURIER TRANSFORM
Fourier analysis is extremely useful for data analysis, as it breaks down a signal into
constituent sinusoids of different frequencies. For sampled vector data Fourier analysis is
performed using the Discrete Fourier Transform (DFT).

It finds its application in Digital Signal processing including Linear filtering, Correlation
analysis and Spectrum analysis.

Consider a complex series x[n] with N samples of the form x0, x1, x2, x3… xk ... xN-1, Where x
is a complex number xi = xreal + jximag. Further, assume that the series outside the range 0, N-1
is extended N-periodic, that is, xk = xk+N for all k. The FT of this series is denoted as X (k)
and has N samples. The forward transform is defined as

N 1
 j2 n k N
X(k)   x ( n) e , for k  0...N  1
n0

The inverse transform is defined as


N 1
1 j 2 n k N
x(n) 
N
 X (k ) e , for n  0...N  1
k 0
Although the functions here are described as complex series, setting the imaginary part to 0
can represent real valued series. In general, the transform into the frequency domain will be a
complex valued function, that is, with magnitude and phase.
Magnitude  X (k )  ( X real * X real  X imag * X imag ) 0.5

 X imag 
Phase  tan 1 
 X real 

11
LIBRARY FUNCTIONS:
exp: Exponential Function.
exp (X) is the exponential of the elements of X, e to the power X. For complex
Z=X+i*Y, exp (Z) = exp(X)*(COS(Y) +i*SIN(Y)).

disp: Display array.


disp (X) is called for the object X when the semicolon is not used to terminate a
statement.

max: Maximum elements of an array


C = max (A, B) returns an array of the same size as A and B with the largest elements
taken from A or B.

fft: Fast Fourier transform.


fft(x) is the discrete Fourier transform (DFT) of vector x. For the matrices, the FFT
operation is applied to each column. For N-Dimensional arrays, the FFT operation
operates on the first non-singleton dimension.

RESULT:
The program for Discrete Fourier Transform was performed with library functions and
without library functions using MATLAB. The results were verified by manual calculation.

12
SAMPLE VIVA QUESTIONS:
1. Define DFT of a sequence x[n].
2. What are the ‘Twiddle factors’ of FFT?
3. Calculate the DFT of x[n]=δ[n-n0], 0≤n0≤N-1.
4. State the Linearity property and Circular shift property of Discrete Fourier transforms.
5. Prove the Linearity property of DFT.
6. Prove the Circular shift property of DFT.
7. List out the properties of DFT.
8. X[n] is obtained from the inverse DFT of an N-point sequence X(K), where K=0,1,
2,….N-1 is defined as _______________.
9. What is meant by Zero padding? What are its uses?
10. State the relationship between DTFT and Z-transform.
11. State the relationship between Z transform and DFT.
12. State the relationship between DTFT and DFT.
13. The direct computation of the discrete Fourier transform of a sequence x[n] requires
__________ real multiplications and _________ real additions.
14. The direct computation of the Discrete Fourier transform of a sequence x[n] requires
______ complex multiplications and ______ complex additions.

SAMPLE ASSIGNMENT QUESTIONS:


1. Compute DFT of the sequence (sine wave) with N = 8, 16, 32, 50 sample points and
compare the results.
2. Find the spectrum of sum of two sin signals with frequencies f1=100Hz & f2=200Hz.
3. Implement the DFT in MATLAB by matrix method.
4. Perform inverse FFT by using forward FFT for the given complex number.
5. Explore in MATLAB about the following library functions FFT2 & FFTSHIFT.
6. Write a program in MATLAB to find the DFT of a given two sequence in direct
method and FFT method. Plot the error signal
a.x1 [n] = [1 1 11] b. x2[n] = [1 2 3 4]
7. Write a program in MATLAB to Prove that time domain convolution is equal to
frequency domain Multiplication.
a. x1 [n] = [1 1 2 2 ] b. x2[n] = [1 2 3 4 ].

13
Experiment 3 Date: 10/02/2025
Register number: URK23EC1015

Calculation of DFT of a Signal


MATLAB Code:
clc;
clear;
x = input('Enter the sequence (x): ');
N=length(x);
X=zeros(1,N);
subplot(3,3,1);
stem(x);
title('x(n)');
xlabel('n');
ylabel('x[n]');
disp(x);
for k = 0 : N-1
for n = 0 : N-1
X(k+1)=X(k+1)+x(n+1)*exp(-1j*2*pi*k*n/N);
end
end
subplot(3,3,2);
stem(X);
title('X(k)');
xlabel('n');
ylabel('X[k]');
disp(X);
a = fft(x,N);
subplot(3,3,3);
stem(a);
title('FFT');
xlabel('x');
ylabel('N');
disp(a);
Y = abs(a);
subplot(3,3,4);
stem(Y);
title('ABSOLUTE VALUE');
xlabel('x');
ylabel('N');
disp(a);
Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy