Beruflich Dokumente
Kultur Dokumente
04
ANALYSIS OF DISCRETE-TIME SYSTEMS: CONVOLUTION AND DIFFERENCE EQUATION
1. Objective(s):
This activity aims to:
1. demonstrate how discrete-time systems are analyzed using the convolution and difference
equation; and
2. equip the students with the knowledge and skills in using the MathScript node or MATLAB in
generating discrete-time signals and implementing the convolution algorithm and determining the
output of a system described by constant-coefficient difference equation.
2. Intended Learning Outcomes (ILOs):
At the end of this activity, the students shall be able to:
1. generate elementary discrete-time signals and using these as inputs to systems; and
2. analyze discrete-time system using the convolution algorithm or the difference equation.
3. Discussion
Discrete-time systems can be analyzed and implemented in two ways: using the convolution sum and
through a recursive algorithm that can be expressed in terms of a difference equation.
The convolution sum is implemented through four operations: folding a signal in time, shifting the folded
signal by a number of sample, multiplying the signals and summing up the product sequence. The
algorithm for computing the convolution sum y(n) of the signals x(n) and h(n) is
y(n) = x(n) h(n) =
x(k)h(n k)
For a finite-duration signal, this implementation is effective. However, for signals with infinite duration, a
recursive algorithm may be more effective since it is computationally more efficient and requires less
memory.
Recursive systems are those systems that use memory elements to store all past results of the
computations, use it when needed, and updates itself when new values arrive. This implementation is more
practical when the system is characterized by an infinite impulse response. The impulse response of a
discrete-time system is the response of the system for a unit sample input. This impulse response
characterizes the system and is used to generate the response of the system for any arbitrary input,
through the convolution sum. Another important characterization of systems is the step response, which is
the output of the system for a step input.
Recursive systems are described by difference equations which have the general form
y(n) =
a y(n k) +
b x(n k)
where the values a and b are the filter coefficients of y(n) (with a = 1) and x(n) respectively. The
number N is the order of the system.
In this activity, the MathScript module of LabVIEW will be used. The MathScript module of LabVIEW is
intended to increase compatibility with m-files, or programs created using MATLAB. Inside the MathScript
module, a source code with syntax and semantics similar to MATLAB is used. Thus, MATLAB programs
can be run on a LabVIEW environment using the MathScript node. This activity uses the MathScript node
to implement the convolution sum and the difference equation.
4. Resources:
To perform this activity, a computer workstation with LabVIEW 8.6 or higher with MathScript module.
MATLAB can also be used by creating a program out of the code inside the MathScript node.
5. Procedure:
Activity 4.1 Generation of Elementary Discrete-time Signals Using the MathScript node.
1. Create the VI act04-01_delta.vi. This will generate a unit sample sequence in which the user can
specify at what time index n will the sequence start and finish, and also the number of samples k this
signal will be delayed (for positive k) or advanced (for negative k).
2. Build the FP and BD as shown.
Insert a MathScript node structure. Right-click on the left edge of the structure and choose Add
Input, naming this input as k. This variable will be the number of samples the unit sample
sequence will be delayed or advanced. Add two more inputs. Name them as n1 and n2. These will
be the starting and ending time-index of the sequence respectively. Create numeric controls for
each of the inputs.
Wire the X input terminal of the Build XY Graph to the n output of the MathScript node and the Y
input terminal to the x output of the MathScript node.
3. Save and run the VI. Test the VI for various values of k, n1 and n2.
Q1.3(a): Generate the following sequences and plot the resulting waveform.
Edit the icon of this VI as shown below. Then set the connections of this VI with k, n1 and n2 as inputs
and x and n as outputs. Save the VI.
4. Replicate act04-01_delta.vi and rename the VI as act04-01_step.vi Modify the FP and BD as shown.
Configure the XY Graph. Under the Display Format of the Properties of XY Graph, choose
Amplitude (Y-Axis) and change the Format string to %0.1g.
8. Edit the icon of this VI as shown below. Then set the connections of this VI with a, n1 and n2 as inputs
and x and n as outputs. Save the VI.
The subVI delta(n) is the VI act04-01_delta.vi which generates an impulse sequence whose
duration is between n1 and n2.
The function filter implements the difference equation by specifying the coefficients of y(n)
and its delayed versions in the vector a and coefficients of x(n) and its delayed versions in the
vector b. The vector x contains the vector of the input signal x(n).
The graph in the FP is an XY Graph which have the same configuration as before.
2. Save and run the VI. Plot the impulse response of the difference equation y(n) y(n 1) +
0.9y(n 2) = x(n).
Q3.2(a): Plot the impulse response of the above given difference equation for
.
What can be said about the causality and stability of this system?
Q3.2(b): Determine the impulse response of the system using hand calculations. Then plot the few
values of the impulse response. Does this agree with the one obtained from the VI?
3. Replicate the VI and name the new VI as act04-03_stepresp.vi. This will plot the step response of a
system described by a difference equation.
Q3.3(a): Using this VI, plot the step response of the system ( ) ( ) + . ( ) =
( ) for
. Determine an equation for the step response of the system using hand
calculations and plot the few values.
Q3.3(b): Compare the form of impulse and step responses. Observe the value to which each
response approach to as the time index grows larger, and the value for which each of the inputs
that generated the responses approach as time index grows larger.
Course:
Experiment No.:
Group No.:
Section:
Group Members:
Date Performed:
Date Submitted:
Instructor:
(n)
for 20 n 20
(n 5)
for 20 n 20
(n + 5)
for 20 n 20
u(n)
for 20 n 20
u(n 5)
for 20 n 20
u(n + 5)
for 20 n 20
Q1.9(a): What is the functionality of the VI? What can be said about the value of a with respect to
the form of the plot?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q1.9(b): Generate the following sequences and complete the table below by plotting the output
waveform at the XY Graph.
0.8
for 10 n 10
1
for 10 n 10
1.2
for 10 n 10
Q2.3(a): Discuss the functionality of the VI. Include in the discussions the meaning of the variables
N, n1, n2, a, y and n.
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q2.3(b): Evaluate the convolution sum of each of the pairs of signals for
using the
VI. Complete the table below. Verify the values obtained by using alternate methods (manual
calculation or a spreadsheet can be used for this purpose).
Pair Of Signals
Convolution Sum
Plot
Q2.4(a): Complete the table below by plotting the convolution sum of the following pairs of signals
from .
x (n) = n[u(n + 10) u(n 20)], x (n) = (1.2) [u(n + 5) u(n 10)]
Q3.2(a): Plot the impulse response of the above given difference equation for
.
What can be said about the causality and stability of this system?
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q3.2(b): Determine the impulse response of the system using hand calculations. Then plot the few
values of the impulse response. Does this agree with the one obtained from the VI?
Impulse Response:
Plot:
Q3.3(a): Using this VI, plot the step response of the system ( ) ( ) + . ( ) =
( ) for
. Determine an equation for the step response of the system using hand
calculations and plot the few values.
Step Response:
Plot:
Q3.3(b): Compare the form of impulse and step responses. Observe the value to which each
response approach to as the time index grows larger, and the value for which each of the inputs
that generated the responses approach as time index grows larger.
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
7. Conclusion:
8. Assessment:
1. Implement a system that will generate the autocorrelation and crosscorrelation of signals using the
MathScript node of LabVIEW. Apply this system to a practical signal.
2. A simple digital differentiator is given by
y(n) = x(n) x(n 1)
which computes a backward first-order difference of the input sequence. Implement this differentiator using
the MathScript node. Do the following:
Plot the impulse and step response of this system. Investigate the causality and stability of this
system.
Implement this differentiator on the following sequences and plot the results.
o x(n) = 5[u(n) u(n 20)]; a rectangular pulse
o x(n) = n[u(n) u(n 10)] + (20 n)[u(n 10) u(n 20)]; a triangular
pulse.
o x(n) = sin
Comment on the appropriateness of the differentiator based on the observations drawn from the
results obtained above.
Assessment rubric for the conduct of laboratory experiments
Performance Indicators
Conduct experiments in
accordance with good and
safe laboratory practice.
Points