0% found this document useful (0 votes)
48 views

ECE402 Lab4

This document provides instructions for a lab on signal processing using the z-transform in MATLAB/Octave. It includes 5 sections that cover: [1] convolving z-transform polynomials; [2] deconvolving polynomials; [3] using partial fraction expansion and inverse z-transform; [4] plotting poles and zeros; and [5] loading, saving, and playing audio signals as wav files. Students are directed to implement examples using provided MATLAB/Octave code.

Uploaded by

EDUARD VI DANDA
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)
48 views

ECE402 Lab4

This document provides instructions for a lab on signal processing using the z-transform in MATLAB/Octave. It includes 5 sections that cover: [1] convolving z-transform polynomials; [2] deconvolving polynomials; [3] using partial fraction expansion and inverse z-transform; [4] plotting poles and zeros; and [5] loading, saving, and playing audio signals as wav files. Students are directed to implement examples using provided MATLAB/Octave code.

Uploaded by

EDUARD VI DANDA
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/ 4

Ateneo de Zamboanga University

Engineering Department

ECE 402 – Signals, Spectra & Signal Processing

Z-transform and Loading signals


LABORATORY 4

Note:
-Read this Laboratory file about z-transform and loading signals in MATLAB/Octave.
-Using your MATLAB/Octave, execute the commands and codes given below.
-You may message your teacher for any questions.

1. Convolution Property of z-transform. Example:


Let 𝑋1 (𝑧) = 2 + 3𝑧 −1 + 4𝑧 −2 and 𝑋2 (𝑧) = 3 + 4𝑧 −1 + 5𝑧 −2 + 6𝑧 −3 .
Determine 𝑋3 (𝑧) = 𝑋1 (𝑧)𝑋2 (𝑧).

Remember from the z-transform property, 𝑋1 (𝑧)𝑋2 (𝑧) means convolution of


𝑋1 (𝑧) and 𝑋2 (𝑧).

From the definition of the z-transform, we observe that

Then the convolution of these two sequences will give the coefficients of the
required polynomial product. We can use the conv() function to multiply two
polynomials.

>> x1 = [2, 3, 4]; x2 = [3, 4, 5, 6]; x3 = conv(x1, x2)

Using the conv_m function developed in Laboratory 3, we can also multiply two
z-domain polynomials corresponding to noncausal sequences.
2. Deconvolution. In passing, we note that to divide one polynomial by another
one, we would require an inverse operation called deconvolution. We can use
the deconv() function in MATLAB/Octave.

[p, r] = deconv(b, a) computes the result of dividing b by a in a polynomial part


p and a remainder r. If we divide the resulting polynomial from number 1 above
with x2. The resulting polynomial should be x1 with zero remainder. Kindly try
and check this on your MATLAB/Octave.

3. Inverse z-transform. Partial fraction expansion using residuez().

Example:

The following expansion:

6 − 10𝑧 −1 + 2𝑧 −2 2 3
𝑋(𝑧) = = 1 + +
1 − 3𝑧 −1 + 2𝑧 −2 1 − 𝑧 −1 1 − 2𝑧 −1

is obtained by calling residuez with b = [6, -10, 2] and a = [1, -3, 2].
>> b=[6 -10 2];
>> a=[1 -3 2];
>> [A,p,C]=residuez(b,a)

The reverse operation can be done using the same function as:
>>[b,a]=residuez(A,p,C).

4. Pole-Zero Plot.

Using MATLAB/Octave, we can use zplane() function to show the pole-zero


plot of a system.

zplane(b,a), where b and a are row vectors, first uses roots to find the zeros
and poles of the transfer function represented by the numerator coefficients b
and the denominator coefficients a. The symbol 'o' represents a zero and the
symbol 'x' represents a pole. The plot includes the unit circle for reference.
Example:

The transfer function of a discrete-time system is given as

1 − 𝑧 −2
𝐻(𝑧) =
1 + 0.9𝑧 −1 + 0.6𝑧 −2 + 0.05𝑧 −3

To check whether the system is stable, we need the pole-zero plot. We use the
following code to plot:

>>b = [1, 0, -1] %numerator coefficients


>>a = [1, 0.9, 0.6, 0.05] %denominator coefficients
>>zplane(b,a)

Try plotting this on your MATLAB/Octave. You should expect a result where
poles are inside the unit circle making the given system stable.

5. Audio Signals
Although it is possible to plot audio (sound) signals, it is more informative to
play and listen to these signals through a computer’s built-in audio input/output
devices using appropriate MATLAB functions. The sound(x,Fs) plays the
signal x as an audio through speakers at Fs Hz rate.

Type in the command below to play the given sinusoidal signal on number 1.

>>sound(x, fs)

It is possible to read and save a wav file in MATLAB. Save the given sinusoidal
signal as a wav file using the audiowrite() command. Note: The wav file
will be saved on the same folder of your octave m-file. The code given will save
a wav file with the signal x and sampling frequency fs.

>> audiowrite(‘filename.wav’, x ,fs);

Then try to read your newly saved wav file. (Note: The wav file should be on
the same folder of your octave m-file.) To read a wave file from disk into signal
y, use the audioread() command. Try to run the code given below, the
sampling rate of the wav file will be stored on variable Fs and the signal values
will be stored on y. Use the sound function again to play.

>>[y,Fs] = audioread(‘filename.wav’);
>>sound(y,Fs);

-END-

Prepared by:
Niño Christon Y. Lazarte

You might also like