Sie sind auf Seite 1von 14

Experiment No.

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.

Type the following in the first line of the MathScript node:


n = [n1:n2]; x = [(n-k) == 0];
This will generate an array n which will have n1 as the first element, increments by one and ends
up with n2 as the last element. The array x will be generated by testing each of the values of array
n minus the number of delay if it is equal to zero. It returns 1 when it is true.
Create the outputs n and x. Switch to FP. Create an Array indicator, naming this as n then place a
numeric indicator inside this array indicator. Insert another array indicator for x.
Switch to BD. Wire the n and x array indicators to the n and x outputs of the MathScript node to
the array nodes. Then right-click the n and x outputs of the MathScript node and select Choose
Data Type > 1D Array > DBL 1D.
Switch back to FP. Insert an XY Chart. Name this as delta(n). Configure the chart as shown:

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.

5. Save and run the VI.


Q1.5(a): What is the functionality of the VI?
Q1.5(b): Complete the table below by plotting the output signal from the XY chart.
6. 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.

7. Replicate act04-01_step.vi and rename the VI as act04-01_realexp.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.

9. Run the VI.


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.
10. Create the VI act04-01.vi which will generate x(n) = 0.8 u(n 4) for 20 n < 20 using the
previously created Vis as subVIs.
Q1.10(a): Plot the signal generated above.
Activity 4.2 The Convolution Sum.
1. Create the VI act04-02.vi. This VI will compute the convolution sum of two signals x (n) = a u(n)
and x (n) = u(n) u(n N) and plot the results, as well as the individual signals on an XY chart.
2. Build the BD and FP as shown. The XY charts are configured in the same manner as those used in the
previous sub-activity. This VI also uses the previously created Vis as subVIs to generate the signals to be
convolved

3. Save and run the VI.


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).
4. Modify act04-02.vi to compute for the convolution sum of the pairs of sequences given in the table
below. The code inside the MathScript node may be modified, and new subVIs generating a sinusoidal
signal can be created.
Q2.4(a): Complete the table below by plotting the convolution sum of the following pairs of signals
from .
Activity 4.3 The Difference Equation
1. The difference equation can be implemented in the MathScript node as the function filter. Create
the VI act04-03_impresp.vi. This VI generates the impulse response of a difference equation defined by
coefficients b and a. The parameters n1 and n2 determine the duration of the impulse response.

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:

6. Data and Results:


Q1.3(a): Generate the following sequences and plot the resulting waveform.

(n)
for 20 n 20

(n 5)
for 20 n 20

(n + 5)
for 20 n 20

Q1.5(a): What is the functionality of the VI?


_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
Q1.5(b): Complete the table below by plotting the output signal from the XY chart.

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

Q1.10(a): Plot the signal generated above.

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

x (n) = 0.9 u(n)


x (n) = u(n) u(n 3)

x (n) = 1.1 u(n)


x (n) = u(n) u(n 5)

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)]

x (n) = n[u(n + 10) u(n 20)], x (n) = cos(0.1n)[u(n) u(n 30)]

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

[u(n) u(n 10)]; a sinusoidal pulse.

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.

Operate equipment and


instruments with ease

Analyze data, validate


experimental values against
theoretical values to
determine possible
experimental errors, and
provide valid conclusions.

Members follow good


Members do not follow
and safe laboratory
good and safe laboratory
practice most of the time
practice in the conduct
in the conduct of
of experiments.
experiments.
Members are unable to
operate the equipment
and instruments.

The group has


incomplete data.

Members follow good


and safe laboratory
practice at all times in
the conduct of
experiments.

Members are able to


operate equipment and
instrument with
supervision.

Members are able to


operate the equipment
and instruments with
ease and with minimum
supervision.

The group has complete


data but has no analysis
and valid conclusion.

The group has complete


data, validates
experimental values
against theoretical
values, and provides
valid conclusion.
Total Score

Mean Score = (Total Score /3)


Percentage Score = (Total Score / 9) x 100%

Points

Das könnte Ihnen auch gefallen