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

22EEE059_DSP_01__1_

Uploaded by

aashwhazazaz
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)
25 views11 pages

22EEE059_DSP_01__1_

Uploaded by

aashwhazazaz
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/ 11

Expt.

No :1 Date:30-07-2024

Implementation of DFT and IDFT


Aim
1. To find frequency domain representation of a discrete-time signal using DFT.
2. To find the time domain sequence from the spectrum of the signal using IDFT

Theory
Frequency content in a continuous-time signal can be obtained using continuous-
time Fouriertransform(CTFT).
Let, x(t) be a continuous-time signal and its CTFT is given by

j t
X(j ) x(t)e dt (1)

where and t are continuous variables.


Let, x(n) be a discrete-time signal and its discrete-time Fourier transform(DTFT) is
given by

j j n
X (e x(t)e (2)

where is continuous variable and time n is discrete .

Discrete Fourier Transform (DFT)


The discrete Fourier transform(DFT) of a length-N time-domain seqeuence x(n) is
given by
N 1
X [k] 0 k N 1 (3)
n0

where
N1
j j 2 nk / N
X [k] X (e ) | 2 nk / N x[n]e 0 k N 1 (4)
n 0

Comparing Eq.(2) and Eq.(4) it is observed that the N-point DFT sequence X(k) is
precisely the set of frequency samples of the Fourier transform X(e ) of the length-N
sequence x(n) at N equally spaced frequencies k = 2 /N, 0 K N 1. Hence Eq.(3) is the
frequency domain representation of the sequence x(n).

1
Algorithm
1. Fix the N-point DFT of the sequence
2. Fix the time index n and frequency index k to run from 0 to N-1.
3. For each value of n allow k to run from 0 to N-1 and sum the product given by
Eq.(3).
4. Repeat step 3 for all values of n.

Amplitude Spectrum
The discrete Fourier transform(DFT) of a length-N time-domain seqeuence x(n) is
given by

N 1
j 2 nk / N
X [k ] x[n] e 0 k N 1 (5)
n0

Since each calculated DFT value is a complex number, it is not convenient to plot
it versus its frequency index. Hence, after evaluating Eq.(3), the magnitude of each DFT
value (referred as the amplitude spectrum ) can be determined and plotted versus its
frequency index. The amplitude spectrum is defined as
1
Ak (6)
N N
The amplitude spectrum can be modified to a one sided amplitude spectrum by
doubling theamplituded in Eq.(6), keeping the original DC term at k = 0. Thus

1
X [0] , k 0
N
Ak (7)
2
N

2
X [k ] , k 0,1, 2, ..... N / 2

Matlab Programs

1. Given a sequence, write a matlab program to find its DFT and IDFT
(a) without using matlab function.
(b) with matlab function
2. A continuous-time signal is given by
x(t) = 100sin(100 ) + 20sin(300 ) + 3sin(500 ) (8)

(c) write a matlab program to obtain the frequency components of the


signal with minimum number of samples.
(d) Write a matlab program to plot the amplitude spectrum using fft showing the
frequen- cies present in the signal.

Matlab Syntax and Description


Y = fft(x) computes the discrete Fourier transform (DFT) of X using a fast Fourier
transform (FFT) algorithm.

3
MATLAB CODE:

1.

4
OUTPUT :

5
6
7
8
OUTPUT GRAPH:

Results and Inference:

 The code begins by plotting the original input sequence, providing a reference
for the time-domain signal. This is followed by computing the Discrete Fourier
Transform (DFT) using both a direct method and the Fast Fourier Transform
(FFT) function, ensuring the accuracy of the DFT computation.

 The direct method calculates the DFT by summing the product of the input
sequence and a complex exponential factor for each frequency index
 k. This approach, while computationally less efficient than the FFT algorithm,
offers a detailed insight into the DFT computation process.

 The FFT function computes the DFT using an optimized algorithm. The result
should closely match the DFT obtained via the direct method, confirming the
transformation's correctness.

 To verify the consistency between the two methods, the code calculates and
displays the error
 e between the direct method DFT and the FFT result. Ideally, this error should
be close to zero, indicating that both methods yield consistent results.

 The DFT results are then converted from Cartesian coordinates (real and
imaginary parts) to polar coordinates, specifically magnitude
r and angle. This conversion helps in understanding the amplitude and phase
9
 The magnitude and phase of the DFT are plotted, offering a visual
representation of the frequency spectrum of the input sequence. These plots are
crucial for identifying the frequencies present and understanding the
corresponding phase shifts.

 The code proceeds to compute the inverse DFT (IDFT) to reconstruct the
original sequence from the DFT coefficients. The reconstructed sequence x(11)
 is displayed and should ideally match the original input sequencex, verifying the
accuracy of the DFT and IDFT processes.

 Lastly, the error


 𝑒1 between the original sequence and the reconstructed sequence is computed
and displayed. A near-zero error confirms that the IDFT has accurately
restored the original sequence, validating the overall process.

Name: ___AKSHIT GHUNAWAT ____ _ ____ __ Reg. No.: ____CB.EN.U4EEE22059 ___ _

ASSESSMENT

Submission

Signature

Student Task Max. Marks Graded Marks

Conduction 5

Results & Conclusion 5

Total 10

1
0
1
1

You might also like