ECE402 Lab4
ECE402 Lab4
Engineering Department
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.
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.
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.
Example:
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.
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:
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:
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.
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