0% found this document useful (0 votes)
9 views13 pages

DSP 05

The document analyzes the frequency-domain characteristics of discrete-time signals and systems using Fourier transforms, emphasizing the importance of convolution, sampling, and aliasing. It provides a comprehensive overview of various methods such as Discrete-Time Fourier Series (DTFS), Discrete-Time Fourier Transform (DTFT), and Discrete Fourier Transform (DFT), along with practical MATLAB examples. The study aims to enhance understanding and design of efficient signal processing systems through theoretical and practical insights.
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)
9 views13 pages

DSP 05

The document analyzes the frequency-domain characteristics of discrete-time signals and systems using Fourier transforms, emphasizing the importance of convolution, sampling, and aliasing. It provides a comprehensive overview of various methods such as Discrete-Time Fourier Series (DTFS), Discrete-Time Fourier Transform (DTFT), and Discrete Fourier Transform (DFT), along with practical MATLAB examples. The study aims to enhance understanding and design of efficient signal processing systems through theoretical and practical insights.
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/ 13

ANALYSIS OF Z-TRANSFORM OPERATIONS

Nishat Jahan
2002012
a Department
of Electrical and Electronics Engineering,
CUET, Chattogram, 4349, Bangladesh

Abstract
Frequency domain analysis of discrete-time (DT) signals and systems provides
essential insights into their behavior under various transformations. This anal-
ysis utilizes Fourier transforms to represent signals in the frequency domain,
revealing critical characteristics such as magnitude and phase spectra. Convo-
lution, a fundamental operation in signal processing, demonstrates significant
effects on the frequency domain representation, emphasizing the relationship
between time-domain operations and their spectral consequences. The study
explores the properties of DT systems, including linearity and time invariance,
and their influence on frequency responses. It also examines the role of sampling
and aliasing in shaping the spectral content of signals. The analysis underscores
the importance of frequency response in evaluating and designing systems for
specific applications, ensuring optimal performance. Practical examples comple-
ment theoretical discussions, offering a clear understanding of frequency domain
principles in DT signal processing. This comprehensive approach supports both
the analysis and design of efficient signal processing systems.
Keywords: Frequency domain, discrete-time signals, Fourier transform,
convolution, time invariance, frequency response, sampling, aliasing, spectral
analysis, MATLAB

1. Objective

To understand and analyze the frequency-domain characteristics of discrete-


time signals and systems using Fourier series, Fourier transform, and Discrete
Fourier Transform (DFT).

2. Introduction

The analysis of discrete-time signals and systems in the frequency domain plays
a vital role in digital signal processing (DSP). Understanding and applying
the Discrete-Time Fourier Series (DTFS), Discrete-Time Fourier Transform
(DTFT), and Discrete Fourier Transform (DFT) are essential for representing
and analyzing discrete-time signals and their frequency-domain characteristics.
These methods facilitate the decomposition of signals into spectral components,
revealing important insights into their frequency behavior.
The Discrete-Time Fourier Series (DTFS) represents periodic discrete-
time signals x[n] with period N as a summation of complex exponentials. The

Preprint submitted to Elsevier January 18, 2025


signal is expressed as:
N −1

X
x[n] = Ck ej N kn , n = 0, 1, . . . , N − 1
k=0

where the Fourier coefficients Ck are determined by:


N −1
1 X 2π
Ck = x[n]e−j N kn , k = 0, 1, . . . , N − 1
N n=0

The distribution of signal power across frequencies is obtained from the Power
Density Spectrum (PDS), given by:
Pk = |Ck |2 , k = 0, 1, . . . , N − 1
The Discrete-Time Fourier Transform (DTFT) generalizes the DTFS to
aperiodic signals, producing a continuous spectrum. It is defined as:

X
X(ω) = x[n]e−jωn , ω ∈ [−π, π]
n=−∞

The original signal can be recovered using the inverse DTFT:


Z π
1
x[n] = X(ω)ejωn dω
2π −π
The Discrete Fourier Transform (DFT) is used for analyzing finite-length
discrete-time signals. For an N -point sequence x[n], the DFT is expressed as:
N −1

X
X[k] = x[n]e−j N kn , k = 0, 1, . . . , N − 1
n=0

The Inverse DFT reconstructs the signal in the time domain:


N −1
1 X 2π
x[n] = X[k]ej N kn , n = 0, 1, . . . , N − 1
N
k=0

Applying these transformations aims to understand and analyze discrete-time


signals and systems. These methods enable a comprehensive investigation of
frequency-domain characteristics, which is crucial for signal processing and sys-
tem analysis applications.

3. Lab Work

3.1. Part A : DTFS Analysis


A periodic rectangular pulse train with a period of T = 1 ms and a duty cycle
of 10% is generated and sampled at 100 kHz. The Discrete-Time Fourier Series
(DTFS) coefficients, Ck , are manually computed using MATLAB to analyze the
signal’s frequency-domain characteristics. Using the computed coefficients, the
signal is reconstructed and compared with the original pulse train to assess the
accuracy of the representation and reconstruction process.

2
3.1.1. MATLAB Code
1 Fs = 100 e3 ; % Sampling frequency
2 T = 1e -3; % Period
3 D = 0.1; % Duty cycle
4 PW = D * T ; % Pulse width
5 t = -T /2 : 1/ Fs : T /2; % Time vector
6 x = ( mod (t , T ) < PW ) ; % Rectangular pulse train
7 % DTFS coefficients
8 N = length ( x ) ;
9 c = zeros (1 , N ) ;
10 for k = 1: N
11 c ( k ) = sum ( x .* exp ( -1 j * 2 * pi * (k -1) * t / T ) ) / N ;
12 end
13 % Recons truction
14 x_recon = zeros ( size ( x ) ) ;
15 for n = 1: N
16 x_recon = x_recon + c ( n ) * exp (1 j * 2 * pi * (n -1) * t / T ) ;
17 end
18 % Plotting Original and Reconstructed Signals
19 figure ;
20 subplot (2 , 1 , 1) ;
21 plot (t , x , ’ LineWidth ’ , 1.5) ;
22 title ( ’ Original ␣ Signal ␣ ( Rectangular ␣ Pulse ␣ Train ) ’) ;
23 xlabel ( ’ Time ␣ ( s ) ’) ;
24 ylabel ( ’ Amplitude ’) ;
25 grid on ;
26 subplot (2 , 1 , 2) ;
27 plot (t , real ( x_recon ) , ’ LineWidth ’ , 1.5) ; % Real part of
reconstructed signal
28 title ([ ’ Reconstructed ␣ Signal ␣ using ␣ ’ , num2str ( N ) , ’␣ Fourier ␣
Coefficients ’ ]) ;
29 xlabel ( ’ Time ␣ ( s ) ’) ;
30 ylabel ( ’ Amplitude ’) ;
31 grid on
32 % Fourier Coefficient Magnitudes
33 figure ;
34 stem (0: N -1 , abs ( c ) , ’ filled ’ , ’ LineWidth ’ , 1.5) ;
35 title ( ’ Fourier ␣ Coefficients ␣ Magnitude ’) ;
36 xlabel ( ’ Harmonic ␣ Index ␣ ( k ) ’) ;
37 ylabel ( ’| c_k | ’) ;
38 grid on ;

3.1.2. Plotted Graph

Figure 1: Original and Reconstructed Figure 2: Fourier Coefficient Magni-


Signal. tude Plot against Harmonic Index.

3.2. Part B: DTFT and Frequency Response


The Discrete-Time Fourier Transform (DTFT) of the rectangular pulse train is
computed to analyze its frequency-domain characteristics. MATLAB’s built-in

3
‘fft()‘ function is utilized to calculate the spectrum of the signal efficiently. The
magnitude and phase response of the spectrum are then plotted to provide a
clear visualization of the signal’s behavior in the frequency domain.

3.2.1. MATLAB Code


1 Fs = 100 e3 ; % Sampling frequency
2 T = 1e -3; % Period
3 D = 0.1; % Duty cycle
4 PW = D * T ; % Pulse width
5 t = -T /2 : 1/ Fs : T /2; % Time vector
6 x = ( mod (t , T ) < PW ) ; % Rectangular pulse train
7 % DTFS coefficients
8 N = length ( x ) ;
9 X = fft ( x ) ; % DFT computation
10 freq = linspace ( - Fs /2 , Fs /2 , N ) ;
11 X_shifted = fftshift ( X ) ; % Centering zero frequency
12 % Plot spectrum
13 figure ;
14 % Magnitude Spectrum
15 subplot (2 ,1 ,1) ;
16 plot ( freq , abs ( X_shifted ) , ’ LineWidth ’ , 1.5 , ’ Color ’ , [0 0.4470
0.7410]) ; % Blue line
17 title ( ’ Magnitude ␣ Spectrum ’ , ’ FontSize ’ , 12 , ’ Color ’ , ’k ’) ;
18 xlabel ( ’ Frequency ␣ ( Hz ) ’ , ’ FontSize ’ , 10 , ’ Color ’ , ’k ’) ;
19 ylabel ( ’ Magnitude ’ , ’ FontSize ’ , 10 , ’ Color ’ , ’k ’) ;
20 grid on ;
21 % Phase Spectrum
22 subplot (2 ,1 ,2) ;
23 plot ( freq , angle ( X_shifted ) , ’ LineWidth ’ , 1.5 , ’ Color ’ , [0.8500
0.3250 0.0980]) ; % Orange line
24 title ( ’ Phase ␣ Spectrum ’ , ’ FontSize ’ , 12 , ’ Color ’ , ’k ’) ;
25 xlabel ( ’ Frequency ␣ ( Hz ) ’ , ’ FontSize ’ , 10 , ’ Color ’ , ’k ’) ;
26 ylabel ( ’ Phase ␣ ( Radians ) ’ , ’ FontSize ’ , 10 , ’ Color ’ , ’k ’) ;
27 grid on ;

3.2.2. Plotted Graph

Figure 3: Magnitude and Phase Spectrum of the Computed DFT Signal.

4
3.3. Part C: DFT Analysis
A sinusoidal signal x[n] = sin(2πf0 nTs ) is generated. The DFT is computed
using MATLAB’s ‘fft()‘ to analyze the spectrum. Zero-padding is applied to
improve frequency resolution. The signal is then reconstructed using the inverse
DFT and compared to the original.

3.3.1. MATLAB Code


1
2 % Parameters
3 Fs = 1000; % Sampling frequency in Hz
4 Ts = 1 / Fs ; % Sampling period in seconds
5 N = 64; % Number of samples
6 f0 = 50; % Frequency of the sinusoidal signal in Hz
7 % Time vector
8 n = 0: N -1; % Sample indices
9 t = n * Ts ; % Time vector in seconds
10 % Generate the sinusoidal signal
11 x = sin (2 * pi * f0 * t ) ;
12 % DFT computation
13 X = fft ( x ) ;
14 % Frequency vector
15 frequencies = (0: N -1) * ( Fs / N ) ;
16 % Magnitude and phase spectrum
17 magnitude = abs ( X ) ;
18 phase = angle ( X ) ;
19 % Plot the original signal
20 figure ;
21 subplot (3 , 1 , 1) ;
22 plot (t , x , ’ -o ’) ;
23 title ( ’ Original ␣ Sinusoidal ␣ Signal ’) ;
24 xlabel ( ’ Time ␣ ( s ) ’) ;
25 ylabel ( ’ Amplitude ’) ;
26 % Plot magnitude spectrum
27 subplot (3 , 1 , 2) ;
28 stem ( frequencies , magnitude , ’r ’ , ’ LineWidth ’ , 1.5) ;
29 title ( ’ Magnitude ␣ Spectrum ’) ;
30 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
31 ylabel ( ’| X [ k ]| ’) ;
32 % Plot phase spectrum
33 subplot (3 , 1 , 3) ;
34 stem ( frequencies , phase , ’b ’ , ’ LineWidth ’ , 1.5) ;
35 title ( ’ Phase ␣ Spectrum ’) ;
36 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
37 ylabel ( ’ Phase ␣ ( radians ) ’) ;
38 % Zero - padding
39 ZP = 256; % Zero - padding length
40 x_padded = [x , zeros (1 , ZP - length ( x ) ) ]; % Add zeros
41 X_padded = fft ( x_padded ) ; % Compute DFT with zero - padding
42 % Frequency vector for zero - padded signal
43 frequ encies_ zp = (0: ZP -1) * ( Fs / ZP ) ;
44 % Plot magnitude spectrum for zero - padded signal
45 figure ;
46 plot ( frequencies_zp , abs ( X_padded ) , ’ LineWidth ’ , 1.5) ;
47 title ( ’ Magnitude ␣ Spectrum ␣ with ␣ Zero ␣ Padding ’) ;
48 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
49 ylabel ( ’| X [ k ]| ’) ;
50 % Reconstruct the signal using IDFT
51 x _r ec on s tr uc te d = ifft ( X ) ;
52 % Plot original and reconstructed signals
53 figure ;
54 plot (t , x , ’ -o ’ , ’ DisplayName ’ , ’ Original ’) ;
55 hold on ;
56 plot (t , real ( x_ re c on st ru c te d ) , ’ - -* ’ , ’ DisplayName ’ , ’ Reconstructed
’) ;
57 title ( ’ Original ␣ vs . ␣ Reconstructed ␣ Signal ’) ;
58 xlabel ( ’ Time ␣ ( s ) ’) ;
59 ylabel ( ’ Amplitude ’) ;
60 legend ;

5
3.3.2. Plotted Graph

Figure 4: Original sinusoidal signal, Magnitude and Phase Spectrum of the DFT
Signal.

Figure 5: Magnitude Spectrum with Figure 6: Original VS Reconstructed


Zero Padding. Signal.

6
4. Post-Lab Questions

1. How does the duty cycle of the pulse train affect its frequency
spectrum?

Solution : We will demonstrate the impact of Duty Cycle on Frequency spec-


trum and reconstructed signals by varying duty cycle to certain values.
1 Fs = 100 e3 ; % Sampling frequency
2 T = 1e -3; % Period
3 D_values = [0.1 , 0.5 , 0.9]; % Different duty cycles to compare
4 PW_values = D_values * T ; % Pulse widths for each duty cycle
5 t = -T /2 : 1/ Fs : T /2; % Time vector
6 % Initialize figures
7 figure (1) ; % For magnitude and phase spectra
8 figure (2) ; % For original and reconstructed signals
9 for i = 1: length ( D_values )
10 D = D_values ( i ) ;
11 PW = PW_values ( i ) ;
12 % Generate rectangular pulse train with current duty cycle
13 x = ( mod (t , T ) < PW ) ;
14 % DTFS coefficients
15 N = length ( x ) ;
16 c = zeros (1 , N ) ;
17 for k = 1: N
18 c ( k ) = sum ( x .* exp ( -1 j * 2 * pi * (k -1) * t / T ) ) / N ;
19 end
20 % Spectrum calculation
21 X = fft ( x ) ; % DFT computation
22 freq = linspace ( - Fs /2 , Fs /2 , N ) ;
23 X_shifted = fftshift ( X ) ; % Center zero frequency
24 magnitude = abs ( X_shifted ) ;
25 phase = angle ( X_shifted ) ;
26 % Plot magnitude and phase spectrum in figure 1
27 figure (1) ;
28 % Magnitude Spectrum
29 subplot (3 , 2 , 2* i -1) ;
30 plot ( freq , magnitude , ’ LineWidth ’ , 1.5 , ’ Color ’ , " b " ) ;
31 title ([ ’ Magnitude ␣ Spectrum , ␣ D ␣ = ␣ ’ , num2str ( D ) ]) ;
32 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
33 ylabel ( ’ Magnitude ’) ;
34 grid on ;
35 % Phase Spectrum
36 subplot (3 , 2 , 2* i ) ;
37 plot ( freq , phase , ’ LineWidth ’ , 1.5 , ’ Color ’ , " r ") ;
38 title ([ ’ Phase ␣ Spectrum , ␣ D ␣ = ␣ ’ , num2str ( D ) ]) ;
39 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
40 ylabel ( ’ Phase ␣ ( radians ) ’) ;
41 grid on ;
42 % Signal reconstr uction
43 x_recon = zeros ( size ( x ) ) ;
44 for n = 1: N
45 x_recon = x_recon + c ( n ) * exp (1 j * 2 * pi * (n -1) * t / T )
;
46 end
47 % Plot original and reconstructed signals in figure 2
48 figure (2) ;
49 subplot (3 , 1 , i ) ;
50 plot (t , x , ’ LineWidth ’ , 1.5) ;
51 hold on ;
52 plot (t , real ( x_recon ) , ’ -- ’ , ’ LineWidth ’ , 1.5) ;
53 hold off ;
54 title ([ ’ Original ␣ and ␣ Reconstructed ␣ Signals , ␣ D ␣ = ␣ ’ , num2str ( D ) ])
;
55 xlabel ( ’ Time ␣ ( s ) ’) ;
56 ylabel ( ’ Amplitude ’) ;
57 legend ( ’ Original ’ , ’ Reconstructed ’) ;
58 grid on ;
59 end

7
Figure 7: Frequency Spectrum with Figure 8: Original VS Reconstructed
Varying Duty cycles. Signal with Varying Duty cycles.

Here’s how the duty cycle influence the frequency spectrum -


1. Main Lobe Width The main lobe’s width is inversely proportional to
the duty cycle. A higher duty cycle (e.g., D = 0.9) produces a narrower main
lobe, concentrating energy at lower frequencies, while a lower duty cycle (e.g.,
D = 0.1) results in a wider main lobe, spreading energy across higher frequen-
cies.
2. Side Lobe Strength Lower duty cycles produce stronger side lobes due to
sharper transitions in the pulse, introducing more high-frequency components.
Higher duty cycles result in weaker side lobes, as the signal becomes smoother
with fewer abrupt transitions.
3. Harmonic Amplitudes At D = 0.5, the spectrum favors strong odd
harmonics due to symmetry. For other duty cycles, the symmetry breaks, lead-
ing to more distributed harmonic amplitudes and reduced dominance of specific
harmonics.
4. Phase Spectrum Symmetric pulses (e.g., D = 0.5) exhibit simpler phase
spectra, while asymmetric pulses (e.g., D = 0.1 or D = 0.9) introduce more
variability and complex phase shifts.

2. What is the relationship between the length of DFT and the fre-
quency resolution?
Solution : The frequency resolution of the Discrete Fourier Transform (DFT)
is determined by the relationship:
Fs
∆f =
N
where:
• Fs is the sampling frequency, and
• N is the length of the DFT (number of points).
This means that the frequency resolution is inversely proportional to the
length of the DFT. As N increases, the frequency resolution improves, allowing
the DFT to distinguish closely spaced frequency components more effectively.
Conversely, a smaller N results in a coarser frequency spectrum, making it
harder to resolve fine frequency details.
1 % Parameters

8
2 Fs = 1000; % Sampling frequency ( Hz )
3 T = 1; % Duration of the signal ( s )
4 t = 0:1/ Fs :T -1/ Fs ; % Time vector
5 f1 = 50; % Frequency of the first sine wave ( Hz )
6 f2 = 60; % Frequency of the second sine wave ( Hz )
7
8 % Signal with two closely spaced frequencies
9 x = sin (2* pi * f1 * t ) + sin (2* pi * f2 * t ) ;
10
11 % DFT lengths
12 N_values = [256 , 512 , 1024]; % Different DFT lengths
13
14 % Plot original signal
15 figure ;
16 plot (t , x , ’ LineWidth ’ , 1.5) ;
17 title ( ’ Original ␣ Signal ’) ;
18 xlabel ( ’ Time ␣ ( s ) ’) ;
19 ylabel ( ’ Amplitude ’) ;
20 grid on ;
21
22 % Frequency analysis with different DFT lengths
23 figure ;
24 for i = 1: length ( N_values )
25 N = N_values ( i ) ; % Current DFT length
26 X = fft (x , N ) ; % Compute DFT with zero - padding to length N
27 freq = linspace (0 , Fs , N ) ; % Frequency vector
28
29 % Plot magnitude spectrum
30 subplot ( length ( N_values ) , 1 , i ) ;
31 plot ( freq , abs ( X ) , ’ LineWidth ’ , 1.5) ;
32 title ([ ’ Magnitude ␣ Spectrum , ␣ DFT ␣ Length ␣ N ␣ = ␣ ’ , num2str ( N ) ]) ;
33 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
34 ylabel ( ’ Magnitude ’) ;
35 grid on ;
36
37 % Display frequency resolution
38 delta_f = Fs / N ; % Frequency resolution
39 text (0.7* Fs , max ( abs ( X ) ) /2 , [ ’\ Deltaf ␣ = ␣ ’ , num2str ( delta_f , ’
%.2 f ’) , ’␣ Hz ’] , ...
40 ’ FontSize ’ , 12 , ’ B ac kg r ou nd Co l or ’ , ’ white ’) ;
41 end

Figure 9: Original sinusoidal signal Figure 10: Magnitude spectrum with


with 2 frequency combined. Varying resolution.

This figure demonstrates how the resolution of the Discrete Fourier Transform
(DFT) affects the spectrum of a signal by comparing three cases with different
DFT lengths: N = 256, N = 512, and N = 1024. The frequency resolution,
denoted by ∆f , is inversely proportional to the DFT length and is calculated
as
fs
∆f = ,
N

9
where fs is the sampling frequency. For N = 256, the resolution is ∆f = 3.91 Hz,
which results in a less detailed spectrum with broader peaks. As the DFT
length increases to N = 512 (∆f = 1.95 Hz), the peaks in the spectrum become
narrower, providing greater clarity. Finally, for N = 1024 (∆f = 0.98 Hz), the
resolution is highest, producing sharp, well-defined peaks that allow for precise
identification of frequency components.
The improvement in resolution as N increases enables the spectrum to represent
the signal more accurately. At lower resolutions (smaller N ), closely spaced fre-
quencies appear merged, and the spectrum lacks detail. In contrast, at higher
resolutions (larger N ), the spectrum reveals finer details, with closely spaced
frequencies clearly distinguishable. This highlights the importance of selecting
an appropriate DFT length to achieve the desired frequency resolution for ana-
lyzing a signal’s spectral characteristics.

3. Compare the results obtained from DTFT and DFT for the same
signal.
Solution : Here’s the Comparison between the outputs obtained from DTFT
and DFT -
Frequency Resolution:
The DTFT provides infinitely fine resolution, offering a continuous frequency
spectrum, while the DFT is limited by ∆f = Fs /N . Zero-padding improves the
DFT’s resolution, making it approximate the DTFT more closely.
Spectral Leakage :
The DTFT avoids spectral leakage due to its exact representation of the signal.
The DFT may suffer from leakage when frequencies do not align with its bins,
but this can be mitigated using zero-padding or windowing.
Computational Efficiency :
The DTFT is computationally expensive as it evaluates a continuous spectrum,
while the DFT, especially with FFT, is efficient and suitable for digital appli-
cations.
Reconstruction :
The DFT can reconstruct the original signal using the inverse DFT (‘ifft‘) with
high accuracy, while the DTFT theoretically enables perfect reconstruction for
infinite-length signals.
4. How does zero-padding influence the spectrum?
Solution : Zero-padding adds extra zeros to a signal or its Fourier transform,
increasing the resolution of the frequency spectrum without changing the signal’s
actual content. It provides a finer frequency resolution, making the spectrum
appear smoother and more continuous, but it doesn’t introduce new frequencies.
While it helps in visualizing small details and improving the appearance of the
spectrum, zero-padding doesn’t alter the fundamental frequency components
of the signal. It essentially fills in the gaps between existing points, offering
better interpolation for easier interpretation, especially when combined with
windowing functions.
1 % Parameters
2 Fs = 1000; % Sampling frequency ( Hz )
3 Ts = 1 / Fs ; % Sampling period ( s )
4 N = 64; % Original number of samples
5 f0 = 50; % Frequency of the sinusoidal signal ( Hz )
6
7 % Time vector and signal generation
8 n = 0: N -1; % Sample indices
9 t = n * Ts ; % Time vector ( s )
10 x = sin (2 * pi * f0 * t ) ; % Sinusoidal signal
11

10
12 % Compute DFT without zero - padding
13 X = fft ( x ) ; % Compute FFT
14 freq_original = (0: N -1) * ( Fs / N ) ; % Frequency vector for original
signal
15
16 % Zero - padding
17 ZP = 256; % Length after zero - padding
18 x_padded = [x , zeros (1 , ZP - N ) ]; % Append zeros
19 X_padded = fft ( x_padded ) ; % Compute FFT with zero - padding
20 freq_padded = (0: ZP -1) * ( Fs / ZP ) ; % Frequency vector for zero -
padded signal
21
22 % Plot the results
23 figure ;
24
25 % Original spectrum ( without zero - padding )
26 subplot (2 , 1 , 1) ;
27 stem ( freq_original , abs ( X ) , ’b ’ , ’ LineWidth ’ , 1.5 , ’ DisplayName ’ , ’
Original ␣ Spectrum ’) ;
28 title ( ’ Spectrum ␣ Without ␣ Zero - Padding ’) ;
29 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
30 ylabel ( ’ Magnitude ’) ;
31 grid on ;
32
33 % Spectrum with zero - padding
34 subplot (2 , 1 , 2) ;
35 plot ( freq_padded , abs ( X_padded ) , ’r ’ , ’ LineWidth ’ , 1.5 , ’
DisplayName ’ , ’ Zero - Padded ␣ Spectrum ’) ;
36 title ( ’ Spectrum ␣ With ␣ Zero - Padding ’) ;
37 xlabel ( ’ Frequency ␣ ( Hz ) ’) ;
38 ylabel ( ’ Magnitude ’) ;
39 grid on ;
40
41 % Add legends
42 legend ( ’ show ’) ;
43
44 % Explanation
45 disp ( ’ Notice ␣ how ␣ zero - padding ␣ improves ␣ the ␣ apparent ␣ frequency ␣
resolution , ␣ making ␣ the ␣ spectrum ␣ smoother ␣ and ␣ more ␣ detailed . ’) ;

Figure 11: Frequency Spectrum with and without zero padding

11
This plot illustrates the effect of zero-padding on the frequency spectrum. In
the top plot, without zero-padding, the frequency resolution is limited by the
number of samples (N = 64), resulting in a discrete and less smooth spectrum.
The frequency bins are sparse, making it harder to pinpoint the exact frequency
of components. In contrast, the bottom plot, with zero-padding (ZP = 256),
shows a smoother and more continuous spectrum due to the increased frequency
bins. While zero-padding does not add new frequency content, it interpolates
the existing spectrum, improving the apparent resolution and making the peaks,
such as the one at 50 Hz, sharper and more distinct. This enhances the clarity
and interpretability of the spectrum.

5. DISCUSSION

The report investigates the frequency-domain characteristics of discrete-time


signals and systems using Fourier series, Fourier transform, and Discrete Fourier
Transform (DFT). Initially, the Discrete Fourier Series (DFS), Discrete-Time
Fourier Transform (DTFT), and DFT signals were generated, forming the foun-
dation for the analysis. The effects of varying duty cycle on signal periodicity
were observed, noting how different duty cycles influence signal frequency com-
ponents. As the duty cycle changed, it was found that a shorter duty cycle
broadens the frequency spectrum due to sharper transitions between high and
low states, introducing higher-frequency components. A longer duty cycle nar-
rows the spectrum, with fewer high-frequency components appearing as the
signal remains active for longer periods. Additionally, the impact of frequency
resolution variation was analyzed, demonstrating how finer resolution enhances
frequency detail but requires more computational resources. Zero padding was
examined to study its role in improving frequency resolution, highlighting how
it fills the gaps in the DFT output, though it doesn’t add new information about
the signal. A key comparison was made between the DFT and DTFT outputs,
showing the discrete nature of DFT versus the continuous, idealized nature of
the DTFT. The findings emphasize the importance of each transform in signal
analysis and its trade-offs regarding resolution, computational complexity, and
accuracy.

References

[1] Alan V Oppenheim. A document preparation system, Pearson Education,


India, 3rd edition, 1999.
[2] John G Proakis. Digital signal processing: principles, algorithms, and ap-
plications 4/E, Pearson Education India, 2007.

12
Nishat Jahan
Student ID : 2002012

Student

Department of EEE, CUET

Nishat Jahan is currently pursuing a Bachelor of Science in Electrical and Elec-


tronic Engineering at the Chittagong University of Engineering and Technology
(CUET). Her strong interest in technology and its applications has led her to
embark on a career path in the field of engineering, where she aims to contribute
to advancements in her chosen areas of study.
She has a particular focus on Biomedical Engineering and Genetics, fields in
which she seeks to explore innovative solutions at the intersection of technology
and healthcare.

13

You might also like