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

Lab_4

The document outlines a laboratory report on Z-transform conducted by students at the International University, detailing the objectives, procedures, and results of various experiments related to digital signal processing. It includes a grading checklist, team contributions, and a structured table of contents covering fundamental discussions, experimental procedures, and results. The report emphasizes the mathematical foundation of the Z-transform and its applications in system analysis and filter design.

Uploaded by

ngannguyen999xxx
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 views21 pages

Lab_4

The document outlines a laboratory report on Z-transform conducted by students at the International University, detailing the objectives, procedures, and results of various experiments related to digital signal processing. It includes a grading checklist, team contributions, and a structured table of contents covering fundamental discussions, experimental procedures, and results. The report emphasizes the mathematical foundation of the Z-transform and its applications in system analysis and filter design.

Uploaded by

ngannguyen999xxx
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/ 21

International University

School of Electrical Engineering

Digital Signal Processing Laboratory


EE093IU

Z TRANSFORM

Submitted by

Student name Student ID


Lê Tiến Phát ITITIU21273
Nguyễn Ngọc Ngân SESEIU21025

Date Performed: 25/04/2025


Date Submitted: 06/06/2025
Lab Section: Lab 4
Course Instructor: M. Eng Nguyen Minh Thien

International University EE093IU1 1


School of CSE
GRADING CHECKLIST

Number Content Satisfied? Score Comment


Format (max 9%)
- Font type Yes No
1
- Font size Yes No

- Lab title Yes No

- Page number Yes No

- Table of contents Yes No

- Header/Footer Yes No

- List of figures (if exists) Yes No

- List of tables (if exists) Yes No

- Lab report structure Yes No

2 English Grammar and Spelling (max 6%)


- Grammar Yes No

- Spelling Yes No

3 Data and Result Analysis (max 85%)

Total Score

Date:

Signature

International University EE093IU1 2


School of CSE
TEAM CONTRIBUTION
Task Le Tien Phat Nguyen Ngoc Ngan
Collaborated on all coding tasks, participated in problem-solving
Collaboration
discussions, and jointly tested MATLAB implementations
Lab preparation
Answer in-class questions
and experiment
Data analysis Jointly analyzed & verified the results for all problems
Write fundamental background & Write experiment procedure &
Report writing
Conclusion Results

International University EE093IU1 3


School of CSE
Table of Contents
DISCUSSION OF FUNDAMENTALS ......................................................................................... 5
EXPERIMENTAL PROCEDURE ................................................................................................. 6
EXPERIMENTAL RESULTS........................................................................................................ 8
CONCLUSION ............................................................................................................................. 21

List of Figures
Figure 1. Console output of Problem 1 10

Figure 2. Problem 1 discrete-time sequences plotting 11

Figure 3. Console output Problem 2 Program 13

Figure 4. Signal plotting problem 2 15

Figure 5. Problem 4 plotting 16

Figure 6. Plotting of Problem 4 program. 20

International University EE093IU1 4


School of CSE
Discussion of Fundamentals
Z-transform Theory
The Z-transform is a mathematical tool that converts discrete-time signals from the time domain
to the z-domain, providing a powerful method for analyzing discrete-time systems and solving
difference equations. It serves as the discrete-time counterpart to the Laplace transform for
continuous-time systems.
Mathematical Foundation
The Z-transform of a discrete-time signal x[n] is defined as:

𝑋(𝑧) = ∑ 𝑥 [𝑛]𝑧 −𝑛
𝑛=−∞

where z is a complex variable. For causal sequences where x[n] = 0 for n < 0, this becomes:

𝑋(𝑧) = ∑ 𝑥 [𝑛]𝑧 −𝑛
𝑛=0

Region of Convergence (ROC)


The ROC is the set of values of z for which the Z-transform converges. Key properties include:
• For finite duration sequences: ROC is the entire z-plane except possibly z = 0 and z = ∞
• For right-sided sequences: ROC is exterior to a circle |z| > R
• For left-sided sequences: ROC is interior to a circle |z| < R
• The ROC cannot contain any poles of X(z)
Frequency Domain Relationship
The Z-transform relates to the Discrete-Time Fourier Transform (DTFT) when z is restricted to
the unit circle: 𝑋(𝑒 𝑗𝜔 ) = 𝑋(𝑧)|𝑧=𝑒 𝑗𝜔

This relationship allows frequency domain analysis of discrete-time systems using the unit circle
in the z-plane.

International University EE093IU1 5


School of CSE
System Analysis Applications
The Z-transform is particularly useful for:
1. Solving difference equations: Converting differential equations to algebraic equations
2. System stability analysis: Poles inside the unit circle indicate stability
3. Filter design: Designing digital filters by placing poles and zeros
4. Convolution: Multiplication in z-domain corresponds to convolution in time domain
Inverse Z-Transform Methods
Several methods exist for finding the inverse Z-transform:
• Partial fraction expansion: Most common method for rational functions
• Power series expansion: Direct expansion for simple cases
• Residue method: Using complex analysis techniques
• Inspection method: Recognizing standard transform pairs

Experimental Procedure
Problem 1: Partial Fraction Expansion
Objective: Express rational Z-transform functions in partial fraction form to facilitate inverse
transformation.
Given Functions:
12𝑧 −1 +38𝑧 −2+11𝑧 −3+54𝑧 −4
• 𝑋1 (𝑧) = 1−5𝑧 −1 +6𝑧 −2
2𝑧 2 +𝑧−1
• 𝑋2 (𝑧) = 𝑧 2−3𝑧+2
5−11𝑧 −1
• 𝑋3 (𝑧) = 1−5𝑧 −1+6𝑧 −2

Procedure:
1. Convert to positive powers of z when necessary
2. Factor the denominator polynomial
3. Use MATLAB's residue function for partial fraction decomposition
4. Verify results using symbolic computation
5. Apply inverse Z-transform to obtain time-domain sequences
Problem 2: Z-Transform Computation
Objective: Compute Z-transforms of various discrete-time sequences using MATLAB's
symbolic toolbox.
Test Sequences:
• ℎ1 [𝑛] = 0.8𝑛 𝑢[𝑛]
• ℎ2 [𝑛] = 𝑢[𝑛] − 𝑢[𝑛 − 10]

International University EE093IU1 6


School of CSE
• ℎ3 [𝑛] = cos(𝜔0 𝑛)𝑢[𝑛]
• ℎ4 [𝑛] = ℎ1 [𝑛] ⋅ ℎ3 [𝑛]
Algorithm Implementation:
1. Define symbolic variables z and n
2. Use ztrans function for forward transformation
3. Verify results against standard Z-transform pairs
4. Analyze ROC for each transform

Problem 3: FIR Filter Analysis


Objective: Analyze an FIR filter using Z-transform techniques and verify results through
convolution.
Filter Specification:
• Impulse response: ℎ[𝑛] = 𝛿[𝑛] + 𝛿[𝑛 − 1] + 𝛿[𝑛 − 2]
2𝜋𝑛
• Input signal: 𝑥[𝑛] = cos( )[𝑢[𝑛] − 𝑢[𝑛 − 14]]
3

Implementation Steps:
1. Compute the Z-transform of the impulse response
2. Determine the system transfer function H(z)
3. Calculate output using both convolution and Z-transform methods
4. Compare results for verification

Problem 4: Difference Equation Solutions


Objective: Solve difference equations using Z-transform techniques.
Equations:
• Part a: 𝑦[𝑛] + 1.5𝑦[𝑛 − 1] + 0.5𝑦[𝑛 − 2] = 𝑥[𝑛] + 𝑥[𝑛 − 1], where 𝑥[𝑛] = 0.8𝑛 𝑢[𝑛]
• Part b: 𝑦[𝑛] − 𝑦[𝑛 − 1] = 𝑥[𝑛] + 𝑥[𝑛 − 1], where 𝑥[𝑛] = 0.8𝑛 𝑢[𝑛]
Solution Process:
1. Apply Z-transform to both sides of the difference equation
2. Use linearity and time-shifting properties
3. Solve for Y(z) algebraically
4. Apply inverse Z-transform to obtain y[n]
5. Verify solution by substitution back into original equation

International University EE093IU1 7


School of CSE
Experimental Results

Problem 1:
clear all; syms z n;

% Part 1: X(z) = (12 - 38z^-1 + 11z^-2 + 3z^-3 + 54z^-4) / (1 - 5z^-1 + 6z^-2)


fprintf('=== Part 1 ===\n');
num1 = [12 -38 11 3 54]; den1 = [1 -5 6];
[Q1, R1_poly] = deconv(num1, den1);
fprintf('Quotient (direct terms): '); disp(Q1);
fprintf('Remainder: '); disp(R1_poly);

if length(R1_poly) < length(den1)


R1_poly = [R1_poly, zeros(1, length(den1) - length(R1_poly))];
end

num1_proper = [R1_poly(3) R1_poly(2) R1_poly(1)];


den1_proper = [6 -5 1];
[R1, P1, K1] = residue(num1_proper, den1_proper);
fprintf('Partial Fraction Coefficients (R1): '); disp(R1');
fprintf('Poles (P1): '); disp(P1');

n_vals = 0:20;
x1_num = zeros(size(n_vals));

for k = 1:length(n_vals)
n_val = n_vals(k);
for i = 1:length(Q1)
if n_val == (i-1)
x1_num(k) = x1_num(k) + Q1(i);
end
end
if n_val >= 0
for i = 1:length(R1)
x1_num(k) = x1_num(k) + R1(i) * (P1(i))^n_val;
end
end
end

fprintf('x1[n] = ');
for i = 1:length(R1)
if i == 1
fprintf('%.0f·%.0f^n', R1(i), P1(i));
else
if R1(i) >= 0
fprintf(' + %.0f·%.0f^n', R1(i), P1(i));
else
fprintf(' %.0f·%.0f^n', R1(i), P1(i));
end
end
end
if Q1(1) ~= 0
fprintf(' + %.0f·δ[n]', Q1(1));
end

International University EE093IU1 8


School of CSE
fprintf('\n');

% Part 2: X(z) = (2z^2 + z - 1) / (z^3 - 3z + 2)


fprintf('\n=== Part 2 ===\n');
num2 = [2 1 -1 0]; den2 = [1 0 -3 2];
[R2, P2, K2] = residue(num2, den2);
fprintf('Partial Fraction Coefficients (R2): '); disp(R2');
fprintf('Poles (P2): '); disp(P2');

x2_num = zeros(size(n_vals));
for k = 1:length(n_vals)
n_val = n_vals(k);
if n_val == 0 && ~isempty(K2)
x2_num(k) = x2_num(k) + sum(K2);
end
if n_val >= 0
for i = 1:length(R2)
if abs(P2(i)) < 1e-10
if n_val == 0
x2_num(k) = x2_num(k) + R2(i);
end
else
x2_num(k) = x2_num(k) + R2(i) * (P2(i))^n_val;
end
end
end
end

% Part 3: X(z) = (5 - 11z^-1) / (1 - 5z^-1 + 6z^-2)


fprintf('\n=== Part 3 ===\n');
num3 = [5 -11 0]; den3 = [1 -5 6];
[R3, P3, K3] = residue(num3, den3);
fprintf('Partial Fraction Coefficients (R3): '); disp(R3');
fprintf('Poles (P3): '); disp(P3');

x3_num = zeros(size(n_vals));
for k = 1:length(n_vals)
n_val = n_vals(k);
if n_val == 0 && ~isempty(K3)
x3_num(k) = x3_num(k) + sum(K3);
end
if n_val >= 0
for i = 1:length(R3)
x3_num(k) = x3_num(k) + R3(i) * (P3(i))^n_val;
end
end
end

fprintf('x3[n] = ');
for i = 1:length(R3)
if i == 1
fprintf('%.0f·%.0f^n', R3(i), P3(i));
else
if R3(i) >= 0
fprintf(' + %.0f·%.0f^n', R3(i), P3(i));

International University EE093IU1 9


School of CSE
else
fprintf(' %.0f·%.0f^n', R3(i), P3(i));
end
end
end
fprintf('\n');

% Plot results
figure('Position', [100, 100, 1200, 400]);

subplot(1,3,1);
stem(n_vals, x1_num, 'b', 'filled', 'LineWidth', 1.5);
title('x_1[n] = 2·2^n + 12·3^n + 29·δ[n]');
xlabel('n'); ylabel('Amplitude'); grid on;

subplot(1,3,2);
stem(n_vals, real(x2_num), 'r', 'filled', 'LineWidth', 1.5);
title('x_2[n] = 5·(-2)^n/9 + 19/9');
xlabel('n'); ylabel('Amplitude'); grid on;

subplot(1,3,3);
stem(n_vals, real(x3_num), 'g', 'filled', 'LineWidth', 1.5);
title('x_3[n] = -1·2^n + 6·3^n');
xlabel('n'); ylabel('Amplitude'); grid on;

sgtitle('Problem 1: Partial Fraction Expansion Results');


Result

Figure 1. Console output of Problem 1

International University EE093IU1 10


School of CSE
Figure 2. Problem 1 discrete-time sequences plotting

Problem 2:
clear all; close all;
syms n z w0;

% Part 1: h1[n] = 0.8 u[n]


h1 = 0.8;
H1 = ztrans(h1, n, z);
disp('Z-Transform of h1[n] = 0.8 u[n]:');
pretty(H1);

% Part 2: h2[n] = u[n] - u[n-10]


h2 = 1 - heaviside(n-10);
H2 = ztrans(h2, n, z);
disp('Z-Transform of h2[n] = u[n] - u[n-10]:');
pretty(H2);

% Part 3: h3[n] = cos(w0*n) u[n]


h3 = cos(w0*n);
H3 = ztrans(h3, n, z);
disp('Z-Transform of h3[n] = cos(w0*n) u[n]:');

International University EE093IU1 11


School of CSE
pretty(H3);

% Part 4: h4[n] = h1[n] * h3[n] = 0.8 * cos(w0*n) u[n]


h4 = 0.8 * cos(w0*n);
H4 = ztrans(h4, n, z);
disp('Z-Transform of h4[n] = 0.8 * cos(w0*n) u[n]:');
pretty(H4);

% Numerical evaluation for plotting


n_vals = 0:20;
w0_val = pi/4;

h1_num = double(subs(h1, n, n_vals));


h2_num = double(subs(h2, n, n_vals));
h3_num = double(subs(h3, {n, w0}, {n_vals, w0_val}));
h4_num = double(subs(h4, {n, w0}, {n_vals, w0_val}));

% Plot all sequences


figure('Position', [100, 100, 1200, 800]);

subplot(2, 2, 1);
stem(n_vals, h1_num, 'b', 'filled', 'LineWidth', 1.5);
title('h_1[n] = 0.8 u[n]');
xlabel('n'); ylabel('h_1[n]'); grid on; ylim([0, 1]);

subplot(2, 2, 2);
stem(n_vals, h2_num, 'r', 'filled', 'LineWidth', 1.5);
title('h_2[n] = u[n] - u[n-10]');
xlabel('n'); ylabel('h_2[n]'); grid on; ylim([0, 1.5]);

subplot(2, 2, 3);
stem(n_vals, h3_num, 'g', 'filled', 'LineWidth', 1.5);
title('h_3[n] = cos(\omega_0 n) u[n], \omega_0 = \pi/4');
xlabel('n'); ylabel('h_3[n]'); grid on; ylim([-1.5, 1.5]);

subplot(2, 2, 4);
stem(n_vals, h4_num, 'm', 'filled', 'LineWidth', 1.5);
title('h_4[n] = 0.8 cos(\omega_0 n) u[n], \omega_0 = \pi/4');
xlabel('n'); ylabel('h_4[n]'); grid on; ylim([-1, 1]);

sgtitle('Time-Domain Sequences');

International University EE093IU1 12


School of CSE
Result

Figure 3. Console output Problem 2 Program

International University EE093IU1 13


School of CSE
International University EE093IU1 14
School of CSE
Figure 4. Signal plotting problem 2

International University EE093IU1 15


School of CSE
Problem 3:
syms n z;

% Define impulse response h(n) = delta[n] + delta[n-1] + delta[n-2]


h = [1 1 1];

% Define input x(n) = cos(2*pi*n/3) * (u[n] - u[n-14])


n_num = 0:20;
x = cos(2*pi*n_num/3) .* (n_num < 14);

% Convolution method
y_conv = conv(x, h, 'full');
y_conv = y_conv(1:length(n_num));

% Z-Transform method
H = 1 + z^-1 + z^-2;
x_sym = cos(2*pi*n/3) * (heaviside(n) - heaviside(n-14));
X = ztrans(x_sym, n, z);
Y = H * X;
y_ztrans = iztrans(Y, n);
y_ztrans_num = double(subs(y_ztrans, n, n_num));

% Plot comparison
figure;
stem(n_num, y_conv, 'b', 'filled'); hold on;
stem(n_num, y_ztrans_num, 'r--');
title('FIR Filter Output: Convolution vs Z-Transform');
xlabel('n'); ylabel('y[n]');
legend('Convolution', 'Z-Transform');
grid on;

% Verify results
disp('Difference between Convolution and Z-Transform outputs:');
disp(max(abs(y_conv - y_ztrans_num)));

Result

Figure 5. Problem 4 plotting

International University EE093IU1 16


School of CSE
Problem 4:
fprintf('\n=== PROBLEM 4: Difference Equation Solutions ===\n');

% Input: x[n] = (0.8)^n u[n]


n_vals = 0:20;
x_input = (0.8).^n_vals;

% Part a: y[n] + 1.5y[n-1] + 0.5y[n-2] = x[n] + x[n-1]


fprintf('Part a: y[n] + 1.5y[n-1] + 0.5y[n-2] = x[n] + x[n-1]\n');
num_a = [1 1]; den_a = [1 1.5 0.5];
y_a = filter(num_a, den_a, x_input);

syms z;
X_z = z/(z - 0.8);
H_a = (1 + z^(-1)) / (1 + 1.5*z^(-1) + 0.5*z^(-2));
Y_a_z = simplify(H_a * X_z);
fprintf('Y_a(z) = '); disp(Y_a_z);

% Part b: y[n] - y[n-1] = x[n] + x[n-1]


fprintf('\nPart b: y[n] - y[n-1] = x[n] + x[n-1]\n');
num_b = [1 1]; den_b = [1 -1];
y_b = filter(num_b, den_b, x_input);

H_b = (1 + z^(-1)) / (1 - z^(-1));


Y_b_z = simplify(H_b * X_z);
fprintf('Y_b(z) = '); disp(Y_b_z);

% Plot solutions
figure('Position', [100, 400, 1200, 600]);

subplot(2,2,1);
stem(n_vals, x_input, 'k', 'filled', 'LineWidth', 1.5);
title('Input: x[n] = (0.8)^n u[n]');
xlabel('n'); ylabel('x[n]'); grid on;

subplot(2,2,2);
stem(n_vals, y_a, 'b', 'filled', 'LineWidth', 1.5);
title('Solution (a): y_a[n]');
xlabel('n'); ylabel('y_a[n]'); grid on;

subplot(2,2,3);
stem(n_vals, y_b, 'r', 'filled', 'LineWidth', 1.5);
title('Solution (b): y_b[n]');
xlabel('n'); ylabel('y_b[n]'); grid on;

subplot(2,2,4);
plot(n_vals, x_input, 'k-', 'LineWidth', 2); hold on;
plot(n_vals, y_a, 'b--', 'LineWidth', 2);
plot(n_vals, y_b, 'r:', 'LineWidth', 2);
title('Comparison of Input and Outputs');
xlabel('n'); ylabel('Amplitude');
legend('x[n]', 'y_a[n]', 'y_b[n]'); grid on;

sgtitle('Problem 4: Difference Equation Solutions');

International University EE093IU1 17


School of CSE
% Verification
fprintf('\nVerification:\n');
n_check = 3:length(y_a);
left_a = y_a(n_check) + 1.5*y_a(n_check-1) + 0.5*y_a(n_check-2);
right_a = x_input(n_check) + x_input(n_check-1);
error_a = max(abs(left_a - right_a));
fprintf('Part a verification error: %.2e\n', error_a);

n_check = 2:length(y_b);
left_b = y_b(n_check) - y_b(n_check-1);
right_b = x_input(n_check) + x_input(n_check-1);
error_b = max(abs(left_b - right_b));
fprintf('Part b verification error: %.2e\n', error_b);

Result

International University EE093IU1 18


School of CSE
International University EE093IU1 19
School of CSE
Figure 6. Plotting of Problem 4 program.

International University EE093IU1 20


School of CSE
Conclusion
Summary of Work
This laboratory successfully demonstrated the fundamental concepts and practical applications of
the Z-transform in digital signal processing. We explored Z-transform computation using
MATLAB's symbolic toolbox, performed partial fraction expansions for inverse transformation,
analyzed FIR filter systems, and solved difference equations using Z-transform techniques.
Key Findings
Theoretical Validation: The experiments confirmed fundamental Z-transform properties
including linearity, time-shifting, and the convolution theorem. The relationship between time-
domain operations and z-domain representations was clearly established through multiple
verification methods.
Computational Methods: MATLAB's symbolic toolbox proved highly effective for Z-
transform computations, with functions like ztrans, iztrans, and residue providing accurate
results that matched theoretical expectations. The partial fraction expansion method
demonstrated its utility for inverse Z-transform calculations.

System Analysis: Z-transform analysis of the FIR filter revealed important frequency domain
characteristics, with the transfer function providing insights into system behavior that
complemented time-domain convolution results.

Difficulties and Solutions


The main challenges encountered were managing symbolic expressions in MATLAB and
ensuring proper handling of initial conditions in difference equations. We addressed these by
carefully structuring symbolic computations and systematically applying Z-transform properties.
Region of convergence considerations required attention when dealing with bilateral sequences.
Key Points

The fundamental relationship between poles, zeros, and system stability was consistently
observed throughout all experiments. Poles inside the unit circle corresponded to stable systems,
while the location of zeros determined frequency response characteristics. The Z-transform's
ability to convert convolution operations into simple multiplication greatly simplified system
analysis.
The Z-transform principles demonstrated in this lab are essential for digital filter design, system
stability analysis, and real-time signal processing applications. Understanding these concepts is
crucial for designing digital controllers, implementing recursive filters, and analyzing discrete-
time system performance.
The systematic approach to problem-solving using Z-transform techniques enhanced our
understanding of both theoretical foundations and practical implementation strategies essential
for advanced digital signal processing applications.

THE END

International University EE093IU1 21


School of CSE

You might also like