Professional Documents
Culture Documents
LAB MANUAL
EE-501
3 Introduction to MATLAB
PART A:Dealing with polynomials & Partial fraction expansion
PART B:Plotting in MATLAB 14
PART C:Solving ordinary differential equation (ODE) symbolically
2
Experiment 1
Introduction to MATLAB
Exercise Objective:
PART A: Familiarization with MATLAB screen
Requirements:
➢ a computer
➢ MATLAB
Theory:
MATLAB is a high performance language for technical computing. It integrates computation,
visualization and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. It is particularly convenient for modeling,
simulation, analysis and design of dynamic systems.
The purpose of this introductory lab is to give you a quick introduction to MATLAB enabling
you to use the software from the very beginning of the Signal & Systems course. To run
MATLAB, double-click on the MATLAB icon. Once the program is loaded you will see the
prompt”>>” in the command window. The command window is the main window in which we
communicate with the MATLAB interpreter. Anything typed after “%” sign is treated as a
comment and ignored by MATLAB. First we will familiarize with the MATLAB screen.
Procedure:
3
MATLAB has the following basic window components:
• Launch Pad Window
• to access all MATLAB services and toolboxes
• Command Window
- to execute commands in the MATLAB environment
• Current Directory Window
- to quickly access files on the MATLAB path
• Figure Window
- to display graphical output from MATLAB code
Basic Components of the MATLAB Environment
• Workspace Window
- to view variable definitions and variable memory allocations
• M-File Editor/Debugger Window
- to write M-files (includes color-coded syntax features)
- to debug M-files interactively (break points)
• MATLAB Path Window
- to add and delete folders to the MATLAB path
• Command History Window
- displays all commands issued in MATLAB since the last session (good for learning and
verification)
MATLAB Command Window
• The command window allows you to interact with MATLAB just as if you type things in a
calculator
• Cut and paste operations ease the repetition of tasks
• Use ‘up-arrow’ key to repeat commands (command history)
MATLAB Launch Pad Window
• The launch window allows you to quickly select among various MATLAB components and
toolboxes
MATLAB Current Directory Window
• Provides quick access to all files available in your Path
• Provides a brief description (when files are commented out) of each M-file
4
MATLAB Editor/Debuger Window
• Provides the same functionality found in most programming language development
environments
- Color codes MATLAB built-in functions (blue color)
- Easy access to cut, paste, print, and debug operations
- Checks balance in MATLAB function syntax
5
MATLAB Workspace
As you develop and execute models in MATLAB theworkspace stores all variables names and
definitions for you. All variables are usually available to you unless the workspace is clear with
the ‘>>clear’ command
Getting Started:-
If you don’t know anything about MATLAB, then MATLAB help is the best way to learn about
something. In the command window of MATLAB simply write ‘help’;
>> help
It will display list of all toolboxes included in MATLAB. Then by investigating the name of
toolbox or the name of a function, which you would like to learn how to use, use the ‘help’
command:
>> help function name
This command displays a description of the function and generally also includes a list of related
functions. If you cannot remember the name of the function, use the ‘lookfor’ command and the
name of some keyword associated with the function:
>>look for keyword
This command will display a list of functions that include the keyword in their descriptions.
MATLAB also contains a variety of demos that can be with the ‘demo’ command.
MATLAB as a calucator
>>1+2*3 >>(1+2)*3
Ans = 7 ans = 9
Order of precedence is from left to right and from inner most parenthesis to outermost
.Suppressing output:
If you simply type a statement and press Return or Enter, MATLAB automatically displays the
results on screen. However, if you end the line with a semicolon, MATLAB performs the
computation but does not display any output. This is particularly useful when you generate large
matrices
e.g>>x=1;y=5;z=9
ans
z=9
Complex Numbers:
MATLAB also supports complex numbers.The imaginary number is denoted with the symbol I
or j. There are different methods to declare a complex number which are given below
>>com=4+2i
com=4.0000 + 2.0000i
>> c=complex(1,-2)
Operations on Complex Numbers:
c=1.0000-2.0000i
Conjugate: Imaginary Part:
7
Built-in Mathematical functions in MATLAB
MATLAB comes with a large number of built-in functions that operate on matrices on an
element-by element basis. These include
sin sine
cos cosine
tan tangent
asin inverse sine
acos inverse cosine
atan inverse tangent
exp exponential
log natural logarithm
log10 common logarithm
sqrt square root
abs absolute value
signsignum
for further functions see help elfun
helpspecfun
Before quitting,Save .m files in current work (default) directory of MATLAB
To end a session
>>exit or quit
Conclusion:
8
Experiment 2
Introduction to Matrices and Arrays
Exercise Objective:
To become familiar with matrices and arrays and operations that can be performed on them
Requirements:
➢ Intel based computer
➢ MATLAB
Theory:
MATLAB stores variables in the form of matrices which are M ×N, where M is the numberof
rows and N the number of columns. A 1 × 1 matrix is a scalar; a 1 × N matrix is a row vector,
and M×1 matrix is a column vector. You can enter matrices into MATLAB in several different
ways:
• Enter an explicit list of elements.
Generating vectors
Vectors can be generated using the ‘:’ command. For example, to generate a vector x that takes
on the values 0 to 10 in increments of 0.5, type the following which generates a 1×21 matrix
>> x = [0:0.5:10];
Other ways to generate vectors include the commands: ‘linspace’ which generates a vector by
specifying the first and last number and the number of equally spaced entries between the first
and last number, and ‘logspace’ which is the same except that entries are spaced logarithmically
between the first and last entry
Note :An error message occurs if the sizes of matrices are incompatible for the operation.
The difference between matrix multiplication and element-by-element multiplication is
seen in the following example
>>A = [1 2; 3 4]
A=
12
34
>>B=A*A
B=
7 10
15 22
>>C=A.*A
C=
14
9 16
The magic Function
MATLAB actually has a built-in function that creates magic squares of almost any size. Not
surprisingly, this function is named magic:
B = magic (4)
B=
16 2 3 13
5 11 10 8
9 7 6 12
11
4 14 15 1
Properties of MAGIC SQUARE:
You are probably already aware that the special properties of a magic square have to do with the
various ways of summing its elements. If you take the sum along any row or column, or along
either of the two main diagonals, you will always get the same number. Let us verify that using
MATLAB.
The first statement to try is
sum(A)
MATLAB replies with
ans =
34 34 34 34
A'
Produces sum of rows
ans =
16 5 9 4
3 10 6 15
2 11 7 14
13 8 12 1
and
sum(A')'
produces a column vector containing the row sums
ans =
34
34
34
34
The sum of the elements on the main diagonal is obtained with the sum and the diag functions:
diag(A)
produces
ans =
16
10
7
1
and
sum(diag(A))
produces
ans =
34
Arrays
When they are taken away from the world of linear algebra, matrices becometwo-dimensional
numeric arrays. Arithmetic operations on arrays aredone element by element. This means that
addition and subtraction arethe same for arrays and matrices, but that multiplicative operations
aredifferent. MATLAB uses a dot, or decimal point, as part of the notation formultiplicative
array operations.
The difference between matrix multiplication and element-by-element multiplication is
seen in the following example
>>A = [1 2; 3 4]
A=
12
34
>>B=A*A
B=
7 10
15 22
>>C=A.*A
C=
14
9 16
Conclusion:
13
Experiment 3
Introduction to MATLAB
Exercise Objective:
PART A: Dealing with Polynomials& Partial Fraction Expansion
PART B: Plotting in MATLAB
PART C: Solving ordinary differential equations (ODE) symbolically
Requirements:
➢ Intel based computer
➢ MATLAB
Theory:
MATLAB provides a full programming language that enables you to write a series of MATLAB
statements into a file and then executing them into a single document.
Polynomials are used for the analysis of transfer function because in case of transfer function we
want to see output and input in the form of polynomial. So it is important to study the
polynomials in MATLAB.
When trying to find the inverse Laplace transform (or Z transform) it is helpful to be able to
break a complicated ratio of two polynomials into forms that are on the Laplace transform or Z
transform table. We will illustrate here using Laplace transforms. This can be done using the
method of Partial fraction expansion (PFE) which is the reverse of finding a common
denominator and combining fractions. It is possible to do PFE by hand also. We will illustrate
hand computation only for the simplest case when there are no repeated roots and the order of
the numerator polynomial is strictly less than the order of denominator polynomial.
The primary tool we will use for plotting in MATLAB is plot().The MATLAB environment
provides a wide variety of techniques to displaydata graphically.
The type of graph you choose to create depends on the nature of your dataand what you want to
reveal about the data. You can choose from manypredefined graph types, such as line, bar,
histogram, and pie graphs as wellas 3-D graphs, such as surfaces, slice planes, and streamlines.
After you create a graph, you can extract specific information about the data. You can also edit
graph components as well as annotate graphs. Annotations are the text, arrows, callouts, and
other labels added to graphsto help viewers see what is important about the data.lastly you can
print your graph on any printer connected to your computer
14
Though MATLAB is primarily a numeric package, it can certainly solve straightforward
differential equations symbolically as well using Math symbolic toolbox as demonstrated in this
lab.
Procedure:
PART A: Dealing with Polynomials
Polynomials
Polynomials arise frequently in systems theory. MATLAB represents polynomials as row vectors
of polynomial coefficients. For example, the polynomial s2 +4s−5 is represented in MATLAB
by the polynomial >> p = [1 4 -5]. The following is a list of the more important commands for
manipulating polynomials.
roots(p) Express the roots of polynomial p as a column vector
polyval(p,x) Evaluate the polynomial p at the values contained in the vector x
conv(p1,p2) Computer the product of the polynomials p1 and p2
deconv(p1,p2) Compute the quotient of p1 divided by p2
poly2str(p,’s’) Display the polynomial as an equation ins
Declaring a Polynomial:
>> [q r]=deconv(num,den)
-1.0000 + 1.7321i
q=
-1.0000 - 1.7321i
0.3333 -2.833
Determining Coefficients from given Roots:
r=
>> c=poly(rt_1)
0 0.0000 179.3333 104.5000 9.6667
>> c=poly(rt_pol1)
Integration of Polynomial Function
c = 1.0000 2.0000 4.0000
>> pol1=[1 2 4];
Finding value of Polynomial at a given point:
>> pol2=[1 4 8];
e=polyval(pol1,2)
Multiplication of two Polynomials:
>> k=polyint(pol1)
e =12
>> g=conv(pol1,pol2) k = 0.3333 1.0000 4.0000 0
Derivative of Polynomial function:
g=
15 >> m=polyint(pol1,pol2)
>> pol1=[1 2 4];
1 6 20 32 32
m = 0.3333 1.0000 4.0000 1.0000 4.0000
>> pol2=[1 4 8]; 8.0000
>> h=polyder(pol1) j = 4 18 40 32
Additional Exercise
Determine roots of the following functions Determine value of polynomial at given instant
Exercise
1-p1=x^4 + 7x^3 = 15x^2 – 25x + 8 1-p1=x^5+2x^4-3x^3+7x^2-5x+7 at x=2
2-f2=s + 3/s^3 + 5s + 4
>>plot(t,y) >>stairs(t,y)
>>xlabel(‘t’) >>xlabel(‘t’)
>>ylabel(‘sin(t)’) >>ylabel(‘sin(t)’)
>>grid on >>grid on
17
—Customization of plots
There are many commands used to customize plots by annotations, titles, axes labels, etc.
A few of the most frequently used commands are
xlabel Labels x-axis
ylabel Labels y-axis
title Puts a title on the plot
grid Adds a grid to the plot
gtext Allows positioning of text with the mouse
text Allows placing text at specified coordinates of the plot
axis Allows changing the x and y axes
figure Create a figure for plotting
figure(n) Make figure number nthe current figure
hold on Allows multiple plots to be superimposed on the same axes
hold off Release hold on current plot
close(n) Close figure number n
subplot(a,b,c) Create an a × b matrix of plots with c the current figure
orient Specify orientation of a figure
Procedure:
Titles & Labels:-
To put a title and label the axes, we use
>>title (’text’)
>>xlabel (’text’)
>>ylabel (’text’)
The strings enclosed in single quotes, can be anything of ourChoosing
Grids:-
A dotted grid may be added by
>>grid
Line Styles &Colors:-
Various line types, plot symbols, and colous may be obtained with plot(x,y,s) where s is a
character string made from one element from any or all the following 3 columns:
m magenta * star
r red s square
w white d diamond
18
y yellow v triangle (down)
^ triangle (up)
➢ triangle (right)
p pentagram
h hexagram
For example, plot (X,Y, ‘g:’) plots a green dotted line and plot(X,Y,’rd’) plots red diamond at
each data point. You may also edit colors and line styles directly from the menus which appear at
the top of the figure windowThe default is to plot solid lines. A solid white line isproduced by
>>plot (x, y, ’w-’)
The third argument is a string whose first character specifies the colour (optional) and the second
the line style.
Multi–plots:-
Several graphs can be drawn on the same figure as:
>>plot (x, y, ’w-’, x, cos (2*pi*x), ’g--’)
A descriptive legend may be included with
>>legend (’Sin curve’, ’Cos curve’)
Which will give a list of line–styles, as they appeared in the plot command, followed by a brief
description.MATLABfitsthe legend in a suitable position, so as not to conceal the graphs
whenever possible. For further information do help plot etc. The result of the commands
>>plot (x, y, ’w-’, x, cos (2*pi*x), ’g--’)
>>legend (’Sin curve’, ’Cos curve’)
>>title (’Multi-plot ’)
>>xlabel (’x axis’), ylabel (’y axis’)
>>grid
Hold:-
A call to plot clears the graphics window before plotting the current graph. This is not
convenient if we wish to addfurther graphics to the figure at some later stage. To stop the
window being cleared:
>>plot (x, y, ’w-’), hold
>>plot (x, y, ’gx’), hold off
“hold on” holds the current picture; “hold off” releases it (but does not clear the window, which
can be done with clf). “hold” on its own toggles the hold state.
Subplot:-
19
The graphics window may be split into an m × n array of smaller windows into which we may
plot one or more graphs. The windows are counted 1 to mn row–wise, starting from the top left.
Both hold and grid work on the current subplot.
>>subplot (221), plot (x,y)
>>xlabel (’x’), ylabel (’sin 3 pi x’)
>>subplot (222), plot (x, cos (3*pi*x))
>>xlabel (’x’), ylabel (’cos 3 pi x’)
>>subplot (223), plot (x, sin (6*pi*x))
>>xlabel (’x’), ylabel (’sin 6 pi x’)
>>subplot (224), plot (x, cos (6*pi*x))
>>xlabel (’x’), ylabel (’cos 6 pi x’)
subplot(221) (or subplot(2,2,1)) specifies that the window should be split into a 2 × 2 array and
we select the first subwindow.
Controlling Axes:-
If it is desired to plot a curve in a region specified by r = [x-min x-max y-min y-max]. Enter the
command axis(r). This command sets the scaling to the prescribed limits. Find-out more about
the command “axis” by typing:
help axis
If you wish to plot cos(t) of exercise 5 from time 0 to 10 seconds, and if you wish that the y-axis
should be from –2 to 2, then enter the following command:
axis([0 10 -2 2])Once a plot has been created in the graphics window you may wish to change
the range of x and y values shown on the picture
Property Editor
20
Figure properties can be changed interactively using thefollowing commands:
• PlotEdit
- allows interactive changes to plots (add legend, lines, arrows, etc.)
• PropEdit
- Allows changes to all Handle Graphic properties in a MATLAB plot
Examples in Plotting
Example: Draw graphs of the functions
i. y = sin(x)/x
ii. u= (1/(x-1)2)+x
iii. v= (x2+1)/(x2-4)
iv. ((10-x)1/3-1)/(4 - x2)1/2
Conclusion:
21
Experiment 4
Generating Signals using MATLAB
Exercise Objective:
To generate signals using MATLAB and visualize the characteristics of signals by changing
parameters
Requirements:
➢ Intel based computer
➢ MATLAB
Theory:
The MATLAB signal processing toolbox has a large variety of functions for generating
signals, most of which require that we begin with a vector representation of time t to n. To
generate a vector t of time values with a sampling interval t of 1 ms on the interval from 0 to
1s, for example, we use the command:
T = 0: .001:1;
Procedure:
PERIODIC SIGNALS
It is an easy matter to generate periodic signals such as square waves and triangular waves using
MATLAB. Consider first the generation of a square wave of amplitude A, fundamental frequency w0
{measured in radians per second), and duty cycle rho. That is, rho is the fraction of each period for
which the signal is positive. To generate such a signal, we use the basic command:
22
In the second command, pi is a built-in MATLAB function that returns the floating-point number closest
to . The last command is used to view the square wave. The command p lot draws lines connecting the
successive values of the signal and thus gives the appearance of a continuous-time signal.
Consider next the generation of a triangular wave of amplitude A, fundamental frequency wо (measured
in radians per second), and width w. Let the period of the triangular wave be T, with the first maximum
value occurring at t = W T. The basic command for generating this second periodic signal is
Thus to generate the symmetric triangular wave shown in Fig. above, we used the following commands:
The toolbox provides functions for generating widely used periodic waveforms:
•sawtooth generates a sawtooth wave with peaks at ±1 and a period of 2p. An optional width
parameter specifies a fractional multiple of 2p at which the signal’s maximum occurs.
•square generates a square wave with a period of 2p. An optional parameter specifies duty cycle,
the percent of the period for which the signal is positive.
To generate 1.5 seconds of a 50 Hz sawtooth wave with a sample rate of 10 kHz and plot 0.2
seconds of the generated waveform, use
Fs = 10000;
t = 0:1/Fs:1.5;
x = sawtooth(2*pi*50*t);
plot(t,x), axis([0 0.2 –1 1])
DISCRETE PERIODIC SIGNALS
Consider, for example, the discrete-time square wave shown in Fig. above
23
Figure: The discrete-time square wave
EXPONENTIAL SIGNALS
Moving on to exponential signals, we have decaying exponentials and growing exponentials. The
MATLAB command for generating a decaying exponential is
8*exp(-a * t);
8*exp(a* t);
24
Consider next the discrete-time exponential sequence. The growing form of this exponential is
shown in Fig below
SINUSOIDAL SIGNALS
MATLAB also contains trigonometric functions that can be used to generate sinusoidal signals. A cosine
signal of amplitude A, frequency w0 (measured in radians per second), and phase angle p h i (in radians)
is obtained by using the command
A*cos(w0*t + phi);
Alternatively, we may use the sine function to generate a sinusoidal signal by using the command
These two commands were used as the basis of generating the sinusoidal signals.
25
Figure 2: The cosine signal
Elementary signals
Unit impulse, unit step and ramp functions
Most of the theory presented in the Signals & Systems course examines the behavior of
continuous-time signals and systems. MATLAB can use special, so-called symbolic variables to
represent and manipulate continuous signals and systems (another software package called
Mathematica has much more developed symbolic capabilities). When doing non-symbolic
manipulations however MATLAB is limited to use discretized versions on signals. Using the
vector notation and the plotting commands we introduced it is now easy to create and visualize
signals. In fact we have already done that when we created sines and cosines for our plotting
examples. Now we will write two simple functions to generate the unit step and ramp signals.
The unit step function is defined as:
us[t] =
26
_
1; t _ 0
0; t < 0
function y = us(t)
%US Unit step
% y = us(t)
% t: time index
% y: signal
y = (t >= 0);
And the unit ramp function is defined as:
ur[t] =
_
t; t _ 0
0; t < 0
Since MATLAB is a programming language, an endless variety of different signals is possible.
Here are some statements that generate several commonly used sequences, including the unit
impulse, unit step, and unit ramp functions:
t = (0:0.001:1)';
y = [1; zeros(99,1)]; % impulse
y = ones(100,1); % step (filter assumes 0 initial cond.)
y = t; % ramp
y = t.^2;
y = square(4*t);
All of these sequences are column vectors – the last three inherit their shapes from t.
Now it is easy to create other signals using the functions we just wrote. For example:
>> t = -5:0.001:5;
>> y = us(-t+2) .* ur(t);
>>plot(t,y)
>>grid on
>>axis([-5 5 -.5 2.5])
>>set(gcf,'paperunits','centimeters');
>> exportfig(gcf,'elem1.eps','bounds','tight','width',8.5,'linestylemap','bw');
Conclusion:
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………
27
Experiment 5
Generating Signals using Simulink
Exercise Objective:
To generate signals using MATLAB simulink.
Requirement:
Simulink is a software package that enables you to model, simulate, and analyze system whose outputs
change over time. Such systems are often referred to as dynamic systems. Simulink can be used to
explore the behavior of a wide range of real-world dynamic systems, including electrical circuits, shock
absorbers, braking systems, and many other electrical, mechanical, and thermodynamic systems
Procedure:
Starting simulink:
To start Simulink, you must first start MATLAB. Consult your MATLAB documentation for more
information. You can then start Simulink in two ways: Click the Simulink icon on the MATLAB toolbar.
Enter the simulink command at the MATLAB prompt. On Microsoft Windows platforms, starting
Simulink displays the Simulink Library Browser.
28
Figure 5.1: The Simulink library browser
Model windows in the Windows version of Simulink optionally display a toolbar beneath the Simulink
menu bar. To display the toolbar, select the Toolbar option on the Simulink View menu.
The toolbar contains buttons corresponding to frequently used Simulink commands, such as those for
opening, running, and closing models. You can run such commands by clicking the corresponding button.
For example, to open a Simulink model, click the button containing the open folder icon. You can
determine which command a button executes by moving the mouse pointer over the button. A small
window appears containing text that describes the button. The window is called a tooltip. Each button on
the toolbar displays a tooltip when the mouse pointer hovers over it. You can hide the toolbar by clearing
the Toolbar option on the Simulink View menu.
29
Generating a Sine Wave
To create this model, you need to copy blocks into the model from the following Simulink block
libraries.
On the dialog box that appears, notice that the Stop time is set to 10.0 (its default value), changes it’s into
inf.
30
First, set the simulation parameters by choosing Simulation Parameters from the Simulation menu. Set
simulation stop time to INF. Now, open the Scope block to view the simulation output. Keeping the
Scope window open, set up Simulink to run the simulation for infinite seconds
Conclusion:
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………
31
Experiment 6
Discrete time signals in time-domain
Exercise Objective:
To study generation of basic discrete time signals.
Time shifting, reversal and scaling processes on the signals.
Requirement:
Generation of Sequences:-
The purpose of this section is to familiarize you with the basic commands in MATLAB for
signal generation and for plotting the generated signal. MATLAB has been designed to operate
on data stored as vectors or matrices. For our purposes, sequences will be stored as vectors.
Therefore, all signals are limited to being causal and of finite length. The steps to follow to
execute the programs listed in this book depend on the platform being used to run the MATLAB
A unit sample sequence u[n] of length N can be generated using the following MATLAB
command
u = [1 zeros(1, N -1)];
A unit sample sequence ud[n] of length N and delayed by M samples, where M < N, can be
generated using the MATLAB command
ud=[zeros(1,M) 1 zeros(1,N-M-1) ];
Likewise, a unit step sequence s[n] of length N can be generated using the MATLAB command
s = [ones(1, N)];
A delayed unit step sequence can be generated in a manner similar to that used in the generation
of a delayed unit sample sequence.
Exponential Signals:-
Another basic discrete-time sequence is the exponential sequence. Such a sequence can be
generated using the MATLAB operators (. ^ and exp).
Program P1_2 given below can be employed to generate a complex-valued exponential
sequence.
% Program P1_2
% Generation of a complex exponential sequence
clf; (clear figure)
c = -(1/12)+(pi/6)*i;
K = 2;
n = 0:40;
x = K*exp(c*n);
subplot(2,1,1);
stem(n, real(x));
xlabel('Time index n');
ylabel ('Amplitude');
title('Real part');
subplot (2,1,2);
stem(n, imag(x));
xlabel('Time index n');
ylabel('Amplitude');
title('Imaginary part');
Program P1_3 given below can be employed to generate a
real-valued exponential sequence.
% Program P1_3
% Program P1_3
% Generation of a real exponential sequence
clf;
Sinusoidal Sequences:-
Another very useful class of discrete-time signals is the real sinusoidal sequence. The real
sinusoidal sequence with constant amplitude is of the form,
where A, ωo, and φ are real numbers. The parameters A, ωo, and φ are called, respectively, the
amplitude, the angular frequency, and the initial phase of the sinusoidal sequence
x[n]. fo = ωo/2π is the frequency.
Such sinusoidal sequences can be generated in MATLAB using the trigonometric operators (cos
and sin).
Program P1_4 is a simple example that generates a sinusoidal signal.
% Program P1_4
% Generation of a sinusoidal sequence
n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
x = A*cos(arg);
Random Signals:-
A random signal of length N with samples uniformly distributed in the interval (0, 1) can be
generated by using the MATLAB command
x = rand (1, N);
Likewise, a random signal x[n] of length N with samples normally distributed with zero mean
and unity variance can be generated by using the following MATLAB command
x = randn (1, N);
34
Exercise 1: Consider the following discrete time sinusoid:
y[n] = sin(0.1n)
Where n is an integer.
a. Plot this signal for 0n22 seconds. Estimate the time period of the signal.
n = 0:1/3:22;
y = sin(0.1*pi* n);
stem(n,y)
Ylabel('y = sin(0.1*pi*n)');
Xlabel('n');
z = sin(0.3*pi*n);
figure(2)
stem(n,z)
Ylabel('z= sin(0.3*pi*n)');
Xlabel('n');
figure(3)
plot(n,y,n,z)
Xlabel('y = blue signal & z = Green signal')
35
Exercise 2: A discrete time signal x[n] is defined as:
x[n]= [1 1 1 1 1/2 1/2]
Sketch the following:
a. x[n]
n = -1:1:4;
x = [1 1 1 1 1/2 1/2];
subplot(1,2,1)
plot(n,x)
36
axis([-2 5 -2 2])
subplot(1,2,2)
stem(n,x)
axis([-2 5 -2 2])
37
b. x[n-2]
n = -1:1:4;
x = [1 1 1 1 1/2 1/2];
subplot(1,2,1)
plot(n-2,x)
axis([-4 5 -2 2])
subplot(1,2,2)
stem(n-2,x)
axis([-4 5 -2 2])
38
c. x[n+2]
n = -1:1:4;
x = [1 1 1 1 1/2 1/2];
subplot(1,2,1)
plot(n+2,x)
axis([-2 7 -2 2])
subplot(1,2,2)
stem(n+2,x)
axis([-2 7 -2 2])
d. x[n2]
n = -1:1:4;
x = [1 1 1 1 1/2 1/2];
subplot(1,2,1)
plot(power(n,2),x)
axis([-2 20 -2 2])
subplot(1,2,2)
stem(power(n,2),x)
axis([-2 20 -2 2])
39
Conclusion:-
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………
40
Experiment 7
Convolution of Continuous time signals
Exercise Objective:
To Plot convolution result using MATLAB and analyze the results.
Requirement:
• Intel based computer
• MATLAB
Theory:
The convolution of two functions is the overlap of the two functions as one function is passed
over the second. The convolution symbol is . The convolution of h (t) and g (t) is defined
mathematically as
The above equation is depicted for rectangular shaped h(t) and g(t)functions in this animation.
Procedure:
CONV
Convolution and polynomial multiplication
Syntax
41
w = conv(u,v)
Description
w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same operation as
multiplying the polynomials whose coefficients are the elements of u and v
It is an easy matter to generate convolution signals such as square waves and triangular waves
using MATLAB. Consider first the generation of a square wave fundamental frequency 4 pi
(measured in radians per second).
42
Figure 7.3: Convolution result a (t)
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
43
Experiment 8
Convolution of Discrete time signals
Exercise Objective:
To study basics of convolution in discrete time signals.
Generation of convolved signal by the convolution of discrete signals.
In this lab you will learn
Convolution Background & Concepts
Discrete Convolution methodologies
Theconv Command
Structures
Theory:
Convolution is denoted by: y[n] = x[n] * h[n]..
First, we set up two signals x[k] and h[k]:
44
Shift h[-k] by n to form h[n-k]. For each value of n, form y [n] by multiplying and summing all
the element of the product of x [k]h[n-k],Starting, from - ∞ to + ∞, first partial overlap then
complete overlap and then end at no overlap.
The figure below shows an example of the calculation of y[1]. The top panel shows x[k]. The
middle panel shows h[1-k].The lower panel shows x[k]y[1-k]. Note that this is a sequence on a k
axis. The sum of the lower sequence over all k gives y[1]=2
Length of Convolution Sum = length of x[n] + length of h[n] – 1
Starting index of Convolution Sum = Starting index of x[n] + Starting index of h[n]
Ending index of Convolution Su
m = Ending index of x[n] + Ending index of h[n]
45
We repeat this shifting, multiplication and summing for all values of n to get the complete
sequence y[n]:
46
An easy approach to convolve the above signals is the polynomial multiplication. Since x[n] and
h[n] in the above example are finite sequences then we can use polynomial
multiplication as follows.
Length of Convolution Sum = length of x[n] + length of h[n]
–1
= 5 + 3 –1 = 7
Starting index of Convolution Sum = Starting index of x[n] + Starting index of h[n]
=0+0=0
Ending index of Convolution Sum = Ending index of x[n] + Ending index of h[n]
=4+2=6
MATLAB Commands:-
conv(a,b) performs a 1-D convolution of vectors a and b. The result is a vector with length =
length(a) + length(b) -1.
Imagine vector a as being stationary and the flipped version of b is slid from left to right. Note
that conv(a,b) = conv(b,a).
%Filename: example.m
%This m-file convolves two signals and plots the result
47
x = [0.5 0.5 0.5]; %define input signal x[n]
h = [3.0 2.0 1.0]; %unit-pulse response h[n]
y = conv(x,h); %compute output y[n] via convolution
n = 0:(length(y)-1); %for plotting y[n]
stem(n,y); % plot y[n]
grid;
xlabel('n');
ylabel('y[n]');
title('Output of System via Convolution');
Conclusion:-
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………
48
Experiment 9
Impulse Response of a Discrete Time System
Exercise Objective:
Requirement:
Impulse Response:-
The impulse response of a system is its output when an impulse is applied at input of system
49
If we know the impulse response of a discrete system we can readily implement the system in a
simple way. To understand this, observe that any sampled signal is impulses whose amplitudes
are amplitudes of the original analogue signal. Thus if the input signal is just a series of impulses
and we know what the system does to impulses and we know the system obeys the principle of
superposition then we can calculate the output of the system to any input signal. We do
this by shifting an impulse response at each input sample scaled according to the amplitude of
the sample. The sum of the overlapping triggered scaled impulse responses is theoutput signal.
Mathematically this is called convolution.
Time Delay:-
A system is delayed in time if the system occurs at t = 1instead of t =0. Practically if an output
appears at t = 0 but we pass it through a delay block then it will appear at t =1.
Mathematically the delay is shifting in time.
Figure 2 represent the delay in a time. Consider a signal x[n] is passed through a delay box Delay
box will shifts the x[n].
Figure 2 represents the single delay of x[n].
Consider a system
50
Consider a system shown in figure 3. This system is dividedinto two parts.
One part delays the input twice and amplifies the signal by the factor of 6.
Second part first delays the input by one and thenamplifies it by factor of 7.
MATLAB code
x=[1 zeros(1,10)]; %Input
D=[0 1]; %Unit Delay
% System 1
x1=conv(x,D);
x2=conv(x1,D);
y1=x2*6
% System 2
x3=conv(x,D);
y2=x3*7
%%% Final Output
y2=[y2 zeros(1,length(y1)-length(y2))];
y1=[y1 zeros(1,length(y2)-length(y1))];
y=y1+y2;
subplot(411)%%%% Plot Input
n=0:(length(x)-1);
stem(n,x);
axis([-1 10 0 max(x)]);
title('Input x');
subplot(412)%%% Plot First Output
n=0:(length(y1)-1);
stem(n,y1);
axis([-1 10 0 max(y1)]);
title('First Output y1');
subplot(413)%%% Plot Second Output
n=0:(length(y2)-1);
stem(n,y2);
axis([-1 10 0 max(y2)]);
title('Second Output y2');
subplot(414)%%% Plot Final Output
51
n=0:(length(y)-1);
stem(n,y);
axis([-1 10 0 max(y)]);
title('Final Output y')
The calculation of Impulse response involve following
steps.
1: Initially we will apply an impulse at the input if system and then observe the output. Figure 4
represent an impulse at input.
System 1 shifts the impulse at t = 2 and then increase the amplitude by 7. Figure 5 represents the
output of system 1
System 1 shifts the impulse at t = 1 and then increase the amplitude by 6. Figure 6 represents the
output of system 2.
52
The Sum of the outputs of system 1 and system 2 gives the final output, which is the over all
system impulse response i.e.
y = [0 7 6]
Figure 7 represents the impulse response of the system.
Now, once we have impulse response then for any input we can calculate output using
convolution sum:
y[n] = x[n]*h[n]
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
53
Experiment 10
Frequency Response of a Discrete Time System
Exercise Objective:
Requirement:
Frequency Response:
54
In general X(ejω) is a complex function of the real variable ω and can be written as
whereXre(ejω) and Xim(ejω) are, respectively, the real and imaginary parts of X(ejω), and are
real functions of ω. X(ejω) can alternately be expressed in the form
The quantity |X(ejω)| is called the magnitude function and the quantity θ(ω) is called the phase
functionIn many applications, the Fourier transform is called the Fourier spectrum and, likewise,
|X(ejω)| and θ(ω) are referred to as the magnitude spectrum and phase spectrum,
respectively.The DTFT X(ejω) is a periodic continuous function in ω with a period 2π. The
DTFT satisfies a number of useful properties that are often uitilized in a number of applications.
MATLAB COMMANDS:
Procedure:
For complex Z, the magnitude R and phase angle theta are given by:
R = abs (Z)
Theta = angle (Z)
Y = fft(X) returns the discrete Fourier transform of vector X, computed with a fast Fourier
transform (FFT) algorithm.
Y = fft(X)
Y = fft(X,n) returns the n-point FFT.
Y = fft(X, n)
Question No 01:
Compute the discrete Fourier transform of the following function analytically and Then plot the
magnitude and phase:
55
MATLAB Code:
w = [0:500]*pi/500;
z = exp(-j*w);
x = 3*(1-0.9*z).^(-1);
a = abs(x);
b = angle(x)*180/pi;
subplot(2,1,1);
plot(w/pi,a);
subplot(2,1,2);
plot(w/pi,b);
OUTPUT:
num=[2 1]
den=[1 –0.6]
56
MATLAB CODE:
57
Fast Fourier Transform:
The Fast Fourier Transform (FFT) is just a computationally fast way to calculate the DFT.
Question No 03:
Determine the Fourier transform of the following sequence. Use the FFT (Fast Fourier
Transform) function.
x (n) = {4 6 2 1 7 4 8}
MATLAB Code:
n = 0:6;
x = [4 6 2 1 7 4 8];
a = fft(x);
mag = abs(a);
pha = angle(a);
subplot(2,1,1);
plot(mag);
grid on
title('Magnitude Response');
subplot(2,1,2);
plot(pha);
grid on
title('phase Response');
OUTPUT:
58
Time-shifting property of DTFT:
If ‘x[n]’ be the sequence ,and X(ejw) be its fourier transform then,
x[n]----F-----X(ejw)
then, for the time-shifted sequences, a simple transformation of the index of summation
in the discrete-time Fourier transform yields
x[n-nd]----F-----e-jwndX(ejw)
• Plot and compare the magnitude spectrum of the original input with time delayed input.
• Plot and compare the phase spectrum of the original input with delayed input.
MATLAB CODE:
59
Frequency-shifting property of the DTFT:
Question#05: Observe the frequency shifting property of DTFT.
• Plot and compare the magnitude spectrum of the original input with frequency shifted
input.
• Plot and compare the phase spectrum of the original input with frequency shifted input..
MATLAB CODE:
60
subplot(2,2,1)
plot(w/pi,abs(h1));
grid on;
title('Magnitude Spectrum of Original Sequence')
subplot(2,2,2)
plot(w/pi,abs(h2));
grid on;
title('Magnitude Spectrum of Frequency-Shifted Sequence')
subplot(2,2,3)
plot(w/pi,angle(h1));
grid on;
title('Phase Spectrum of Original Sequence')
subplot(2,2,4)
plot(w/pi,angle(h2));
grid on;
title('Phase Spectrum of Frequency-Shifted Sequence')
OUTPUT
61
LAB EXERCISES:
1. Determine the Fourier transform of the following sequence. Use the FFT (Fast Fourier
Transform) function,
x(n) = {4 3 2 1 1 2 3 4}
2. Compute the discrete Fourier transform of the following function analytically and then
Plot the magnitude and phase
x(n) = 2(0.8)n+2 u(n-2)
3. Determine H(w) and plot its magnitude and phase for the following system.
H(ejw) = 1+e-jw
1-e-jw+0.9e-j2w
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
…………………………
62
Experiment 11
Properties Linear Time-Invariant Discrete-Time
Systems
Exercise Objective:
Requirement:
Theory:
Commutative Property: [Book section 2.3.1]:-
The commutative property in discrete time is given by
When we are convolving the roles of x[n] and h[n] are interchangeable. According to above
equation, the output of an LTI system with input x[n] and unit impulse response h[n]is identical
to the output of an LTI system with input h[n] and unit impulse response x[n].
We want to calculate convolution of two signals e.g. x[n]=[1 2
3 4 5] (n=0:4) and h[n]=[-1 0 1] (n=-1:1).
First flip h[n] and shift h[-k] from –1 to 5 and compute the output (as shown in figure 1).
63
Now flip x[n] and shiftx[-n] from -1 to 5 and compute convolution sum. The output should be
same as found above (as in figure 2).
64
Distributive Property: [Book section 2.3.2]:-
Another property of convolution is the distributive property
x[n]*(h1[n] + h2[n]) = x[n]* h1[n] + x[n]*h2[n] = y1[n]+
y2[n]
This can be verified as
65
Therefore, the above two systems are equivalent. The convolved sum of two impulse responses
is equivalent to considering the two equivalent parallel systems (equivalent for discrete-time
systems)
Practically when we are calculating the overall system response sequence of blocks connected in
series does not effect on system output.
Example:-
Consider two signals
>>x=[1 2 3 4]; h1=[2 1 0 1];
First compute
>> y1=conv(x,h1)
y1 =
2 5 8 12 6 3 4
Exercise:-
In MATLAB when we are using conv(a,b) if ‘a’ and ‘b’ are interchanged then because of
Commutative property outputwill not change.
For the following signals
x[n] = [-1.5 0 1.5 0 -1.5 0 1.5]
h1[n] = [1 0 0 1 1 ]
h2[n] = [-2 -1 0 1 2 3 ]
Prove
a. Commutative Property
x[n] * h2 [n] = h2 [n] * x[n]
b. Distributive Property
66
x[n]*(h1[n] + h2[n]) = x[n]* h1[n]+ x[n]* h2[n]
c. Associative Property
x[ n ] * ( h1[ n ] * h2[ n ]) = (x[ n ] * h1[ n ]) * h2[ n ]
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
67
Experiment 12
Simulating different types of Modulation using MATLAB
Exercise Objective:
Requirement:
In AM, the carrier itself does not fluctuate in amplitude. Instead, the modulating data appears in
the form of signal components at frequencies slightly higher and lower than that of the carrier.
These components are called sidebands. The lower sideband (LSB) appears at frequencies below
the carrier frequency; the upper sideband (USB) appears at frequencies above the carrier
frequency. The LSB and USB are essentially "mirror images" of each other in a graph of signal
amplitude versus frequency, as shown in the illustration. The sideband power accounts for the
variations in the overall amplitude of the signal.
When a carrier is amplitude-modulated with a pure sine wave, up to 1/3 (33 percent) of the
overall signal power is contained in the sidebands. The other 2/3 of the signal power is contained
in the carrier, which does not contribute to the transfer of data. With a complex modulating
68
signal such as voice, video, or music, the sidebands generally contain 20 to 25 percent of the
overall signal power; thus the carrier consumes 75 to 80 percent of the power. This makes AM
an inefficient mode. If an attempt is made to increase the modulating data input amplitude
beyond these limits, the signal will become distorted, and will occupy a much greater bandwidth
than it should. This is called over modulation, and can result in interference to signals on nearby
frequencies.
Procedure:
AMPLITUDE MODULATION USING M-FILE
Y = MODULATE(X,Fc,Fs,METHOD,OPT) modulates the message signal X with a Carrier
frequency Fc and sampling frequency Fs, using the modulation scheme in METHOD.OPT is an
extra sometimes optional parameter whose purpose depends on the modulation scheme you
choose.
Fs must satisfy Fs> 2*Fc + BW, where BW is the bandwidth of the modulated signal.
69
Now run a simulation by clicking play button, you will see the following window.
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
…………………………
70
Experiment 13
Laplace transforms using MATLAB
Exercise Objective:
Requirement:
The MATLAB control system toolbox contains numerous command that are useful for working
with Laplace transforms and continuous-time LTI systems described in terms of transfer
functions, poles zeros, or state-variable description.
Procedure:
POLES AND ZEROS
The command
r = roots (a)
Finds the roots of a polynomial described by the vector a and thus may be used to determine the
zeros and poles of a Laplace transform expressed as a ratio of polynomials in s. The element of
the vector a correspond to descending powers of s.
For example
Using the command
>> z = roots( [4, 0, 6] );
>> p = roots( [1, 1, 0, -2] );
71
Using this commands
hence the residue r(1)= -1 corresponds to the pole at s = -2 given by p(1), the residue r(2)=2
corresponds to the double pole at s = -2 given by p(2), and the residue r(3) = 1 correspond to the
pole at s= -1 given by p(3). Partial fraction expansion is therefore
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
72
Experiment 14
Fourier Series in MATLAB
Exercise Objective:
To study the basics of Fourier series representationof discrete time periodic signal.
1.2. Generation of Fourier series of discrete time periodic signals.
In this lab you will learn
Representation of Fourier series in discrete time.
Linear Combinations of Harmonically related Complex
Exponentials.
Gibbs Phenomena
Requirement:
Fourier series provide an alternate way of representing data instead of representing the signal
amplitude as a function of time; we represent the signal by how much information is contained at
different frequencies.
Harmonics:-
In acoustics and telecommunication, the harmonic of a wave is a component frequency of the
signal that is an integer multiple of the fundamental frequency. For a sine wave, it is an integer
multiple of the frequency of the wave. For example, if the frequency is f, the harmonics have
frequency 2f, 3f, 4f, etc.
Sample for a harmonic series:
1f 440 Hz Fundamental frequency First harmonic
2f 880 Hz First overtone Second harmonic
3f 1320Hz Second overtone Third harmonic
Is also periodic with period T. In the above equation for k=0 is a constant. The term for k=+1 and
k=-1 both have fundamental frequency equal to ωο and are collectively referred to as the
fundamental components or the first harmonic components. The two terms for k=+2 and k=-2 are
periodic with half the period (or, equivalently, twice the frequency) of the fundamental
components. More generally, the components for k=+N and k=-N are referred to as the Nth
harmonic components.
The representation of a periodic signal in the form of equation (1) is referred to as the Fourier
series representation.
Consider a periodic signal x(t), with fundamental frequency 2π , that is expressed in the form of
equation (1)
Where
Rewriting equation (2) and collecting each of the harmonic components, which have the same
fundamental frequency, we obtain
Equation (4) is an example of an alternative form for the Fourier series of real periodic signals.
We illustrate graphically how the signal x(t) is built up from its harmonic components
74
75
Application of Fourier Series (Gibbs
Phenomena):-
Now consider the pulse train x[n] with a Fourier series representation:
By Fourier series xn[n] should be converges to x[n].In other words |xn[n] – x[n]|should be
getting close to zero as N
increases.
Now we can plot the Fourier series representation using MATLAB and see how the series does
at reproducing the original signal. If we plot the first 20 terms in the sum, we see the general
shape of the original function but we see a lot of 'ringing'. As we plot more terms, we see the
original function is represented quite accurately. In general Fourier series can reconstruct a signal
with a small number of modes if the original signal is smooth.
Discontinuities require many high frequency components to construct the signal accurately.
The process of resolving a signal into its Fourier series is called spectral analysis or Harmonic
analysis.
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
77
Experiment 15
Fourier Transform using MATLAB
Exercise Objective:
Requirement:
The discrete time Fourier transforms (DTFT) of a discrete sequence x[n] is a representation of
the sequence in terms of the complex exponential sequence { e j w n } where ω is the real
frequency variable. The DTFT representation of a sequence is unique.
Where Xre( e j w ) and im X ( e j w ) are, respectively, the real and imaginary part of the X ( e j w
) , and are real functions of ω . X ( e j w ) can alternatively be expressed in the polar form as
The quantity X is called the magnitude function and the quantity (w) is called the phase function
with both functions again being real functions of w. The relationship between the rectangular and
polar forms of X ( e j w ) follows from above equations and are given by,
78
Procedure:
DTFT Computation using MATLAB:-
The signal processing toolbox in MATLAB includes a number of M-files to aid in the DTFT-
based analysis of discrete-time signals. Specifically, the functions that can be used are freqz, abs,
and angle. In addition, the built-in MATLAB function real and imag are also useful in some
applications.
The function freqz can be used to compute the values of the DTFT of a sequence, described as a
rational function in Xe j w ) in the form of following equation at a prescribed set of discrete
frequency points w = w
79
Examples of MATLAB:-
Consider a signal (referred to Example 5.1 page 362)
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
80
Experiment 16
Z- Transform using MATLAB
Exercise Objective:
Requirement:
In last lab, we discussed the discrete-time Fourier transform approach for representing discrete
signals using complex exponential sequences. There are two shortcomings to the
Fourier transform approach.
There are many useful signals in practice such as u[n] and nu[n] for which the discrete-time
Fourier transform does not exist.
Second, the transient response of a system due to initial conditions or due to changing inputs
cannot be computed using the discrete-time Fourier transform approach.
We now consider the z-transform an extension of the discrete-time Fourier transform to address
the above two problems.
Definition:-
For a given sequence x[n], its z-transforms X[z] is defined as
81
Which can be interpreted as the DTFT of a modifiedsequence {x[n] r 1}. For r=1(i.e. |z|=1), the
z-transform of x[n] reduces to its DTFT. From equation (2), we see that X ( r e j w ) is the
Fourier transform of sequence of x[n] multiplied by real exponential r n , i.e.
(Where, x R and x R positive numbers) Convergence of series in Eq. (1) depends only on |z|,
since
|X(z)| < ∞ if,
The region of convergence consists of all values of z such that inequality (4) holds. Thus if some
value of z, say z=z1 is in the ROC, then all values of z on the circle defined by |z|=|z1| will also
be in the ROC. The ROC consists of a ring in the z-plane centered about the origin. Its outer
boundary will be either a circle or mayextend outward to infinity, and its inner boundary will be
either a circle or may extend inward to include the origin. This is illustrated in Figure 1. In this
figure X(z) will exist for all values of z lie in shaded region.
82
p are numerator coefficients and q are denominator coefficients. Eq (5) results from solving LTI
system in z domain.
Procedure:
Z-Transforms using MATLAB:-
3.1 [z,p,k]=tf2zp(num, den) command
Pole, zeros and ROC of the expression of following form can determine using tf2zp command.
Consider response of an LTI system
To find poles and zeros fist we carry out the factorization of G(z). Following code do this.
% Determination of factor form
num = input('Type the Numerators coefficients = ');
den = input('Type the Denominators coefficients = ');
[z,p,k]=tf2zp(num,den);
m=abs(p);
disp('zeros are at');disp(z);
disp('poles are at');disp(p);
disp('Gain Constant');disp(k);
disp('Radius of Poles');disp(m);
zplane(num,den);
the program compute and prints the location of poles and
zeros, the value of gain
constant and the radius of poles
Input data:
Type the coefficients = [2 16 44 56 32]
Type the Denominators coefficients = [3 3 -15 18 -12]
Output
zeros are at
-4.0000
-2.0000
-1.0000 + 1.0000i
-1.0000 - 1.0000i
poles are at
-3.2361
1.2361
0.5000 + 0.8660i
0.5000 - 0.8660i
83
Gain Constant
0.6667
Radius of Poles
3.2361
1.2361
1.0000
1.0000
[r,p,k]=residuez(num,den) command:-
The M-file residuez can be used to develop partial fraction expansion of Eq (5) and vice versa
Now, we will find the partial fraction expansion using following code,
%Partial fraction expansion of rational z-transform
Conclusion:
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………
85