Download lab 7

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Signals and Systems Theory and Lab – Week 7 Lab
ET382 W7 Lab
Lab 7 – The Z-Transform
·
Watch video entitled “Module 7– Z-Transform in MATLAB”
·
Work the below lab assignment below using MATLAB.
·
Include answers for Problems and include MATLAB coding along with any output
plots that support solutions into a Word document entitled “Lab7_StudentID”. Where
your student id is substituted in the file name.
·
Upload file “Lab7_StudentID”
Activity 1:
A linear time-invariant discrete-time system has transfer function
·
·
Use Matlab to obtain the poles of the system. Is the system stable? Explain.
Matlab tip: You can find the roots of a polynomial by using the roots command. For
instance, if you have the polynomial x2+ 4x + 3, then you can find the roots of this
polynomial as follows:
>>roots([1 4 3])
where the array is the coefficients of the polynomial.
·
·
Compute the step response. This should be done analytically, but you can
use Matlab commands like conv and residue to help you in the calculations.
Matlab tip: Besides using conv to look at the response of a system, it can also be used
to multiply two polynomials together. For instance, if you want to know the product
(x2 + 4x + 3)(x + 1), you can do the following:
>>conv([1 4 3],[1 1])
where the two arrays are the coefficients of the two polynomials.
The result is
>> ans = 1
5
7
3
Thus, the product of the two polynomials is x3 + 5x2 + 7x + 3.
Matlab tip: The command residue does the partial fraction expansion of the ratio of two
polynomials. In our case, we can obtain Y(z)/z and then use the residue command to do
the partial fraction expansion. Then it is relatively easy to obtain y[n] using the tables.
·
Plot the first seven values of the step response. Is the response increasing or decreasing
with time? Is this what you would expect, and why?
.
If you cannot view the images above, download a PDF of the Lab.
Grading Rubric
30
Establishes an understanding of discrete-time
to frequency domain conversion of signals
Demonstrates the ability to perform numerical 30
and symbolic computations
Solves problems using current software used Excellent
in the discipline (e.g. Matlab, Multisim, IDEs,
etc.)
Develops a
solution using
software with
few to no errors
and
incorporating
advanced
features of the
software tool
Uses graphics, numerical expressions and
tables to illustrate ideas
Competent
Needs
Improvement
Develops a
solution using
software with
no major or
significant
errors in use of
the software
tool
Makes
significant
errors in use of
software tool to
solve
problems. The
errors are
related to the
use and
understanding of
the software tool
and not
specifically to
the problem.
20
15
8
Excellent
Competent
Needs
Improvement
Numerical
expressions,
images, tables,
and graphs are
used as needed
and are in the
proper format.
Numerical
expressions,
images, tables,
and graphs are
generally used
as needed and
are in the
The need for
graphical or
numerical
information is
recognized but
presentation is
flawed or such
information is
proper format not provided but
with few errors. needed to
illustrate ideas.
10
Provides a well written report (
Following APA formatting, including
figures, equations and answer to the
questions)
10
TOTAL
100
6
SOLUTION
>> % solving using MATLAB
>> % Part-1:
>> num = [ 1 -1 -2 ] ;
% Numerator: z^-z-2
>> den = [ 1 1.5 -1] ;
% Denominator: z^2 + 1.5z-1
>> H=tf ( num, den, .8)
% Creates the LTI object and displays the result
>> % Gain factor
>> K = num(1)/den(1)
Stable = (abs(poles) < 1) ;
If stable
fprint (‘The system is stable.\n’) ;
else
fprint (‘WARNING: The system is NOT stable.\n’) ;
end
%step response
H =tf ([ 1, -1,-2],[1,1.5,-1],0.8) ;
stepplot (H)
4
%to find residue
num = [1 -1 -2] ;
den = [1.5 -2 .5 1] ;
[r,p,k] = residue ( num, den)
Pzmap (H) % Getting pole-zero plot
% Also we can get poles using the following command…
>>Poles_H=roots ([1 1.5 -1])
Poles_H=
-2.0000
0.5000
>> % Now, the system has (-2) outside the unit circle. It implies that it is unstable
Point to NOTE:
The roots of the numerator and denominator are called poles in this case
>>
>>
>> % Part-2: Getting step response
>> syms z
>> Y(z)=(z/(z-1))*((z^2-z-2)/(z^2+1.5*z-1))
Y(z) =
-(z*(-z^2+z+2))/((z-1)*(z^2+(3*z)/2-1))
>>y_ n=iztrans (Y)
% Getting step response using inverse z-transform
Y_ n=
(8*(-2)^n)/15 + ( 9*(1/2)^n)/5-4/3
>>
>> % Part-3: Plotting first seven values
>>
>> n =0 : 1 : 6 ;
>> y_ n _7 = double (sub (y_n))
Y_n_7 =
1.0000
-1.5000 1.2500 -5.3750 7.3125 -18.3438 32.8281
>> stem (n, y_n_7, ‘linewidth’, 2) % Plotting
>> grid on
>> ylim ([-20 40])
>> xlim ([-1 7])
>>xlabel (‘Samples (n) ‘)
>>ylabel (‘Value’)
>>title (‘First 7 samples of step response’)