



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ECE 1563 Fall, 2009 EXPERIMENT 1, DISCRETE-TIME SYSTEMS: Exercises Homework 0 DUE on Wednesday, September 2 Homework 1 DUE on Monday, September 14 Exercises Report DUE before lab on Wednesday, September 16
Objective
The purpose of this experiment is to review the properties of linear systems and analyze some of the differences between real continuous systems and discrete-time representations of continuous systems.
Some Comments on defining linear systems in MATLAB
You can define a system in MATLAB by directly specifying coefficients of the defining equation (differential or difference) as the numerator and denominator of the transfer function or by creating a "system object". System objects can be created using the command ‘tf’. For example, for a continuous second-order system with input function x(t) and output function y(t) defined by the differential equation
5 x dt
dx 2 y dt
dy 2 dt
d y 2
2
with transfer function
s s
s X s
Ys H s
you can use
num = [1 5]; % Coefficients of right-hand side of differential equation den = [1 2 2]; % Coefficients of left-hand side of differential equation ContinuousSystem = tf(num,den);
To create a discrete system from a continuous system, use 'tf' with the Laplace transfer function coefficients to generate an object representing the continuous system. Then use 'c2d' on the continuous system to generate an explicit discrete representation. For example, to approximate ContinuousSystem, use
DiscreteSystem = c2d(ContinuousSystem,T);
where T is the sampling interval. This form of ‘c2d’ uses a default discretization, but the command allows you to specify the method of discretization.
You can also specify a discrete system directly from its z-transform by
DiscreteSystem = tf(numz,denz,T);
where numz and denz represent the coefficients of the defining difference equation and T is the
sampling interval. If you want to specify a discrete system without a specific sampling interval, set T = -1. For example, for a discrete second-order system with input sequence x[n] and output sequence y[n] defined by the difference equation
y[n] = 0.6 y[n-1] - 0.8 y[n - 2] + 0.5 x[n] + 0.25 x[n-1]
with transfer function
z 0. 6 z 0. 8
z 0. 5 z
1 0. 5 z
Y(z) H( z) 2
2 1 2
1
− +
−
you can use
numz = [0.5 0.25]; % Coefficients of x[n] denz = [1 -0.6 0.8]; % Coefficients of y[n] DiscreteSystem = tf(numz,denz,-1);
Note that there is no time associated with this system.
The coefficients of a z-domain transfer function of a discrete system that approximates a given continuous system are different from the coefficients of the s-domain transfer function of the continuous system. The orders of the numerator and denominator may even be different. Discrete transfer functions in MATLAB are defined in terms of descending powers of z (as opposed to powers of z-1).
Some commands in MATLAB (like 'freqz' and 'filter') require num and den as arguments. Others (like 'impulse' ) can use either the system object (e.g., ‘ContinuousSystem’ or ‘DiscreteSystem’) or the defining equation coefficients, num and den. Still others require system objects.
You may find it convenient to create a function or a script to calculate and plot the impulse response and frequency response of a system. You use this operation many times in this and the next lab.
Section 1: Discrete approximation of continuous systems
In this section, you will develop a discrete representation for the continuous time first-order low-pass filter and determine its response to a square wave and sinusoids.
Procedure
Δ t
y(t Δt) y(t ) dt
dy (The forwarddifferenceapproximationis
Define the impulse response as h[n] = y[n] for x[n] = δ[n] and y[n] = 0, n ≤ 0.)
(p = [ones(1,10) zeros(1,40)] or p = [ones(10,1); zeros(40,1)]). Verify that the results are what they should be by comparing to your analytic result from the pre-lab.
Report
Compare your results to the results in Section 1. How are the lengths of the impulse response, the input and the output related? What does the end section of the output function represent? Include a listing of your m-file in your report.
Section 3: Simulating Systems in MATLAB
In this section, you will use MATLAB functions to find the outputs for continuous and discrete versions of a first-order lowpass filter.
Procedure
Report
filter (using ‘lsim’) to your discrete approximation in Section 1. Comment on differences and why they occur.
Section 4: Non-recursive Systems
Difference equations like the ones we have been using to represent the filters are called recursive. Note that the value of y for sequence value k+1 is defined in terms of the input x and the output y at sequence value k; hence, the values of y are determined recursively from earlier values of y.
For a non-recursive system, the output y is defined only in terms of the inputs and not in terms of previous values of y. An example commonly encountered in signal processing is the three-point smoother:
y(k) = 0.25x(k) + 0.5 x(k-1) + 0.25*x(k-2)
In this section, you will explore some of the properties of this system.
Procedure
y(k) = 0.25x(k+1) + 0.5 x(k) + 0.25*x(k-1)
Plot the impulse response for this system.
Report