22EEE059_DSP_01__1_
22EEE059_DSP_01__1_
No :1 Date:30-07-2024
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)
j j n
X (e x(t)e (2)
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)
3
MATLAB CODE:
1.
4
OUTPUT :
5
6
7
8
OUTPUT GRAPH:
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.
ASSESSMENT
Submission
Signature
Conduction 5
Total 10
1
0
1
1