











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!












Rensselaer Polytechnic Institute
Number of Sessions – 4
In other laboratory exercises in this course we investigate methods of applying the power of
digital computation to various communications and control problems. A difficulty arises, however, in
allowing designers trained in other disciplines to use such computer aids in their everyday work. A
specialist in one field cannot be expected to direct a majority of effort from his primary field to
engage in detailed computer training. A promising answer to this problem of simplifying the use of
such aids by non-computer personnel can be found in the utilization of computer driven graphics
display consoles as the user-computer communication interface.
The RCS workstations use fully buffered, interactive display systems, intended for use in such
areas as computer-aided design, information retrieval, and simulation. As with other typical
systems, they uses a cathode ray tube output display unit, coupled with a mouse, keyboard and other
input devices. The display unit receives problem output information from the minicomputer driving
it , and converts this information to a visual display. The user, upon viewing the display, uses the
console input devices to instruct programs in the computer to make some manipulation or
computation on the screen. Thus, the feedback loop to the computer is closed:
The important point is that through the use of such a system, user-computer communication can
be entirely in a picture language where desired actions may be specified by the designation of simple
picture pieces. The pieces may represent both commands to activate certain programs and, once the
programs are activated, arguments or data for the programs. The user need not be concerned with
the complex internal operations performed as a result, just so far as to specify a logical sequence of
operations within the framework of the program. He thus must only be familiar with a simple
picture language that can be oriented toward his specialty. The ability both to enter inputs and to
receive outputs pictorially is the major advantage of this system, making the use of existing
computer aids much simpler.
In addition to providing new convenience and freedom and better approachability, computer
communication through graphic display makes possible an interactive method of problem solving.
Under this arrangement, the display surface serves as a common working area for both man and
computer. The display system acts as a broadband communication channel through which the user
can rapidly ask questions and the computer can rapidly provide answers. These rapid answers can
stimulate the user's thoughts more than if the functions were separated in time or by intermediate
personnel. Thus a partnership of the person and the computer becomes possible, where significant
time and economic penalties do not result from making a few wrong decisions or exploring paths that
do not produce immediate results.
This lab uses the RCS UNIX workstations. Since every student is given accounts for these
systems, there are no RTA class accounts available for use. The RCS terminals, run by ITS, are
located in the JEC, CII, and several other buildings around campus. The logon procedure for RCS is
somewhat obvious. Enter your logon ID and password at the prompt (and wait patiently).
Consultants for the RCS are generally available during the day, and can answer most questions
dealing with general workstation operation. If you run into trouble with the theory of the
experiment, see your TA during scheduled lab hours.
Remember:
Lab can be performed at any convenient time before the due date.
TAs available for help during scheduled lab time or by appointment.
All printouts must have the students name and date (printed by the computer).
This part of the lab uses a program called SIMULINK, an extension to MATLAB (version 4.0 and
up), to help the student design a motor controller. You will generate a system circuit by connecting
together different types of components. The components are blocks that could represent transfer
functions defined by you, as well as basic system components such as adders, gain units and
input/output points. SIMULINK is a supported software program with manuals available from ITS,
so this guide will just walk you through the first portion of the problem to acquaint you with the
program.
In order to run SIMULINK you, at this stage, may use either the SUN workstations or the IBM
RS/6000s. The notation used in this overview for mouse commands ( click and drag modified by left ,
middle or right ) refers to either pushing and releasing the appropriate mouse button or pushing
and holding the button while moving the mouse pointer to the desired location. For example, left
double-click means to push and release the left mouse button twice (quickly)
represent the filename.m MATLAB M-file. To save the block model use Save As... under your
workspace File menu and type in a name for the system.
Assuming that you chose to save your model as model1 then to start performing your analysis in
the MATLAB window type:
[a,b,c,d]=linmod('model1')
Hence, you will obtain the a,b,c,d state matrices of the system. These matrices can then be used
to find the impulse response of the system by typing:
impulse(a,b,c,d)
To get the Bode plot type:
bode(a,b,c,d)
The step function response can be obtained by entering:
step(a,b,c,d)
The pole-zero values can be obtained by typing:
[z1,p1]=ss2zp(a,b,c,d)
Finally, the pole-zero plot (note: this is sometimes drawn with the negative real axis going to the
right) is drawn when you type:
pzmap(a,b,c,d)
Hardcopies of the graphics window can be made using the MATLAB print command. This can be
done after the impulse , bode , step , and pzmap commands above. Use the title function to put your
name and the date on every plot before printing it - e.g. title('Step resp z=5, p=1 1/29/94 John
Doe'). After the plot is done, you should add a title and print it to be included in your report. More
information is available under help on title , print , prtsc , and printsys. To print your Simulink
block diagram, use the command print - f name where name is the name of the Simulink window.
(ex. print - fRTA to print the system window named RTA.)
In order to decrease the amount of typing needed, all the above commands can be put into an M-
file function process.m that you can run by entering:
process(a,b,c,d)
An example of an M-file to do this can be found in the class directory on RCS at
afs/rpi.edu/dept/ecse/rta/process.m. You may copy this file into your own directory and execute it
or modify it first.
The remaining steps of the procedure can be done by following the same general outline used
here.
which you can save your models and work.
response to the >> matlab prompt.
workspace window. The file name you choose, when saving, represents the model name and is
used by MATLAB commands to refer to it.
elements that defines the block characteristics will be generated. The parameters can then be
changed by first double-clicking on the parameter box to select and highlight it and then typing
in new parameters to overwrite the previous contents. Left click on Done to close the block
parameter window.
data such as variable values. Use the title function to do this.
before you exit MATLAB and SIMULINK then a fatal error will occur and your SIMULINK and
MATLAB workspaces will be closed.
help. Typing help command where command is a MATLAB function will give more details on
the particular function. See the MATLAB and SIMULINK User's Guides in the manual racks in
the terminal rooms for further details and explanations.
Step Fcn Scope Unit Delay Sum Abs
Sine Wave To Workspace Dis. Zero-Pole Gain Product
White Noise To File Filter Integrator Fcn
Clock Dis. Transfer Fcn Derivative Backlash
Constant Dis. State-space Transfer Fcn Dead Zone
From Workspace Zero-Pole Rate Limiter
From File State-space Look Up Table
Signal Gen. Relay
Saturation
Switch
Transport Delay
MATLAB Fcn
S-function
CONNECTIONS EXTRA (undocumented advanced functions)
Inport Display Devices
Outport Filters
Mux Controllers
Demux Nonlinear
Transformations
System ID
(these are subdirectories)
A transmitted signal will always be altered in some way by noise and interference in the
transmission medium. It then becomes a major task to correctly interpret the signal as it is finally
received at the desired destination. The project becomes even more ominous when one considers that
these interferences are usually random in nature and as such can only be described probabilistically.
This part of the lab will be concerned with various methods of interpreting these signals, and the
workstation will be used to display the calculated results of one type of decision scheme.
Since the noise encountered in communication systems is generally random and unpredictable,
some basic probability theory must be introduced in order to understand its effects. The probability
that a random event will occur is a simple concept, yet consider what it implies: a series of
occurrences which individually are unpredictable, will in the long run converge to a fraction of the
total number of events, and this fraction may be easily calculated. For example, if a coin is tossed it
is not known exactly which side will appear. But, in the long run (large number of throws), as many
heads will appear as tails, and thus it may be said that each side has a probability of appearing of
0.5 or 50 percent.
This concept may be generalized as
P ( x ) =
lim
number of times x occurs
N
where P(x) is the probability that the event x (such as heads or tails) occurs, and N is the total
number of times the experiment is repeated. It is also obvious that the sum of the probabilities of
each possible outcome of the experiment will be equal to one, assuming that they are mutually
exclusive events.
The preceding discussion may also be applied to an event that exhibits an outcome that varies
continuously, that is, having an infinite number of possible values. In this case the probability that
one of these values will occur is mathematically zero, and the only number that may be meaningfully
discussed is the probability that the value will be between any two points.
A convenient representation of this type of probability 'distribution' is called the probability
density function. This is a function of the continuous variable (the outcome) which, when integrated
between two points, will give the value of the probability that the outcome will be between these two
points. Thus the area under the curve corresponds to a measure of probability. Not surprisingly, if
the curve is integrated from minus infinity to plus infinity the result will be equal to one,
encompassing all possible outcomes.
As an example, consider a randomly spun wheel with retarding-friction, and let x stand for the
angle at which it stops. x may have any value between 0 and 2π (radians) and each value would be
equally likely. The probability density function for x (denoted f(x)) is called a uniform distribution
and is plotted below:
The function is zero for values of x less than 0 and greater than 2π, and has a value of
1
2 π
between these points, thus making the total area equal to one. Now, the probability that the wheel
will stop between 0 and π/2 radians may be calculated as follows:
1
2 π
0
π / 2
0
π / 2
1
4
Another very common distribution is called the Gaussian distribution. The Gaussian density
function is illustrated below:
0 0 0
The probability is 'concentrated' about the mean point, x 0
. Thus it is most likely that x will be
close to x 0
. The equation for the Gaussian distribution is given by:
2
0
2
2
The quantity σ
2 is called the variance and is indicative of the 'width' of the curve as shown
below:
This curve is a bell-shaped surface with its peak at (x 0
, y 0
), where x 0
and y 0
are the mean values
of X and Y, respectively. The equation for this density function is:
f ( x , y ) =
2 π M
exp
2 ( 1 − ρ
2
)
( x − x 0
2
σ x
2
2 ρ( x − x 0
)( y − y 0
σ x
σ y
( y − y 0
2
σ y
2
where σ
2
x
and σ
2
y
are the respective variances, x 0
and y 0
are the means, ρ is the correlation
coefficient, and M is given by:
M = σ x
σ y
1 − ρ
2
(6)
The covariance μ is defined by μ = ρσ x
σ y
where |ρ| < 1 and σ x
and σ y
are known as the standard
deviations in the x and y directions.
The variance and the covariance are usually combined in the symmetric covariance matrix, S. In
the two-dimensional case,
s 11
s 12
s 21
s 22
σ x
2
μ
μ σ y
2
Thus s 11
is the variance of the first variable, s 22
is the variance of the second, and s 12
= s 21
is the
covariance. It is obvious that, to completely determine the relationship between two Gaussian
variables, all that are needed are the covariance matrix and the respective means.
Noise plays a significant role in determining the performance of communication systems. In fact,
the presence of unwanted random disturbances limits the rate at which one can communication over
a given channel. Unfortunately, noise cannot be eliminated in a practical system. The motions of all
atoms at temperatures above absolute zero cause unavoidable fluctuations that must be lived with.
It shall be assumed for now that noise has been added to the signals transmitted so that at the
receiver the voltage measured consists of the algebraic sum of the two. Although the noise is
assumed random so that particular voltage values may not be specified in advance as a function of
time, it will be assumed that the noise statistics are known.
In particular, it will be assumed that the noise is zero-mean Gaussian. That is, it has a Gaussian
probability density function with a mean of zero. Thus, the probability that a measured sample n
will fall in the range a to b is given by:
ab
= P { na < n ≤ b } =
2 πσ
2
exp
− n
2
2 σ
2
^ dn
a
b
This is the most commonly used statistical model for additive noise in communications, and in
most applications is a valid representation for actual noise present. It will also be assumed that the
noise variance σ
2 is known. The variance may be either measured digitally or by a long time-
constant true power meter.
Consider as an example the reception of binary pulses in a binary PCM system. The noise n(t) is
added to the incoming group of pulses in the receiver, and there is a possibility that the noise will
cause an error in the decoding of the signal. Specifically, if the system is of the on-off type, in which
pulses represent 1's in the binary code and the absence of pulses representing 0's, the error will occur
if noise in the absence of a signal happens to have an instantaneous amplitude comparable with that
of a pulse when present or if noise in the presence of a signal happens to have a large enough
negative amplitude to destroy the pulse. In the first case noise alone will be mistaken for a pulse
signal, and a 0 will be converted to a 1. In the second case the 1 actually transmitted will appear as a
0 at the decoder output.
There is now a need to act on the received information and reach a definite decision as to the
signal's nature. The resulting loss of information must often be tolerated. Since the wrong decision
may be costly to the observer, a method of processing the received voltage v(t) is needed, such that
losses due to incorrect decisions will be minimized.
Returning to the binary PCM problem, one simple way of making the decision is to choose a 1 if
the composite noise and signal voltage exceeds one-half the original pulse amplitude A, or a 0 if it is
less than A/2. Thus, there will be an error if, when a 1 is sent, the noise is less than - A/2 volts, or,
when a 0 is sent, the noise is greater than A/2 volts.
The density function, assuming a 1 is present, is:
f 1
( v ) =
2 πσ
2
exp
−( v − A)
2
2 σ
2
Thus, the probability of error is
indicated in the figure, is the value above which the signal would be called a 1, and below which a 0.
This point is also referred to as the threshold for the decision scheme.
From equations 10, 11, and 13, assuming an arbitrary decision level d,
P e
0
f 0
( v )
d
∞
dv + P 1
f 1
( v
−∞
d
) dv (15)
Now, to minimize P e
with respect to d, the derivative is set equal to zero:
e
∂ d
0
f 0
( d ) + P 1
f 1
( d ) = 0 (16)
yielding
f 1
( d )
f 0
( d )
0
1
The solution to equation 17 can be shown to provide an optimal value for d of:
d opt
σ
2
A
ln
P 0
P 1
A
Note that if both signals are equally likely (P 0
1
= 1/2), the decision point will be halfway between
the two means at A/2, as might be expected.
The threshold requirements implied by equation 17 may be alternately stated as
L( v ) ≡
f 0
( v )
f 1
( v )
<
1
0
decision =
0 if L ( v ) >
1
0
1 if L ( v ) <
1
0
The term L(v) is called the likelihood ratio. P 1
0
is called the threshold value of the likelihood
ratio for the decision. Thus, if L(v) is greater than P 1
0
, then the signal v is decoded as a 0, and vice
versa. Equation 19 is called the Bayes test for minimum error. It is also valid for non-Gaussian
distributions and other two-class (0-1, yes-no, on-off, etc.) decision problems.
The decision rule may alternately be formulated with consideration of the cost of a wrong
decision. Thus, the quantity to be minimized is the risk, defined from equation 13 as
1
1
e
0
0
e
C is the average risk per decision, C 1
is the cost of choosing a 0 when the signal is really a 1, and
0
is the cost of choosing a 1 when it is really a 0. It is assumed that the cost of a correct decision is
zero.
In a manner similar to the minimum error analysis, the final decision rule may be stated as,
f 0
( v )
f 1
( v )
<
1
1
0
0
decision =
0 if L( v ) >
1
1
0
0
1 if L( v ) <
1
1
0
0
The rule is called the Bayes test for minimum risk. Note that this is just a likelihood ratio test
with a different threshold value, and that a change in the costs can have the same effect as a change
of the a priori probabilities P 0
and P 1
The preceding analysis has shown how an optimal decision may be made between either of two
signals on the basis of one received sample. It is apparent that it should be possible to improve the
detection by using more than one sample. For example the received pulse may be sampled various
times during its appearance, or alternately the pulse may be repeated several times, each being
sampled once.
The n samples will each define an n-fold density function. In particular, if signal s 0
is
transmitted, the n-dimensional conditional density function f 0
(v 1
, v 2
, ..., v n
) is defined, where the v i
are the n samples. A two-dimensional example of this type of function was shown earlier. Similarly a
second signal s 1
will define f 1
(v 1
, v 2
, ..., v n
). Thus, the problem is to divide the n-dimensional space
into two mutually exclusive regions V 0
and V 1
, each corresponding to a choice of one of the two
signals.
The probability of error may be written for n-dimensions as:
e
0
f 0
( v )
V 0
dv 1
dv 2
... dv n
1
f 1
( v
V 1
) dv 1
dv 2
... dv n
where v is the signal vector
v = (v 1
, v 2
, ..., v n
The minimization process is similar to that carried out in the one-dimensional case, and yields a
likelihood ratio of:
L( v ) ≡
f 0
( v )
f 1
( v )
<
1
0
decision =
0 if L ( v ) >
1
0
1 if L ( v ) <
1
0
The preceding calculations obviously grow more difficult with such added complications as non-
zero covariance, unequal variances, unequal error penalties, and unequal a priori signal
probabilities. Fortunately, modern digital computers are able to produce a solution rapidly and
accurately.
We have on the RCS a program that will take the probabilistic descriptions of two-class decision
problems, compute the threshold for the decision, (using the Bayes test for minimum risk) and
display the results on the screen. The sample is assumed to be two-dimensional, and the signal is
assumed to be received in the presence of Gaussian noise.
This explanation of PDF.NET is designed to show the reader how to use this program, which is
available on the RCS. The program allows the user to specify the various parameters that
probabilistically describe two different signals. Assuming these signals are transmitted in the
presence of Gaussian noise, the received signals will be noise-contaminated. To decode these signals
properly, some sort of threshold for making a decision must be calculated. That is what DX with the
PDF.NET network does, utilizing the Bayes' test for minimum risk.
When the program first starts running, default values are given that the user will be able to
adjust for the following parameters:
σ x
, σ y
, and ρ)
the X and Y coordinates of the means (X0 and Y0)
the costs of making the wrong decision (C)
the a priori probabilities that either signal will be sent (P for the 'Red' function; 1-P is
assumed for the 'Green' function)
This is all the information needed to calculate and display the threshold that is expressed in
equation 25. After your parameters seem correct, and you wish to see a plot of the threshold, type
σ > 0
|ρ| < 1
where σ is any standard deviation, ρ is the correlation coefficient corresponding to σ x
and σ y
, and C
and P are any cost or probability. If any of these rules are violated, no plot will be generated.
After observing the details of the graph, be sure to look at a wide enough area by increasing the
boundaries to verify the threshold equation function. Without observing enough of the function, an
ellipse or hyperbola may appear to be a parabola. Also, to eliminate distortion, be sure to use the
same scale on both the x and y axes. If XMAX - XMIN is not equal to YMAX - YMIN, circles may
appear as ellipses.
NOTE: It is not necessary to get a plot of every example. Unless they can be reduced to fit 6 or more
to a page, the report will be too long. It is all right to just sketch the salient features from the top
view (the standard deviation contours and threshold line) in the report. You may have to use the
screen printing function built into the operating system to get custom scaled hardcopies. Ask the
ARC consultants about this to use utilities like xv or xgrab.
Use the following procedure to access the PDF.NET file:
i) Log onto an RCS IBM console (as described in the introduction). For convenience, it is
also possible to logon remotely from any X Window terminal. You must set up the X-
terminal as a remote display before logging on to the RCS machine with the following
command:
ssh username @rcs-ibm.rpi.edu
(or ssh - X username @rcs-ibm.rpi.edu )
(There may be some problems running DX on rcs-ibm1.rpi.edu that occur during
the semester. If rcs-ibm1 is available, it is desirable to distribute the load of
running DX over both machines when two lab groups run it simultaneously.
Sometimes the commands ssh – X … or ssh – x … must be used if a ‘can’t open
display’ error is received after running the command dx & below.)
ii) Begin execution of the program DX by typing the commands:
setenv DXMACROS /dept/ecse/rta/pdf
setup dx (this may not be required)
dx &
(Ignore any ‘No such file or directory’ error. If you are running from a
SiliconGraphics workstation (CII-3130) or other remote access connection to
rcs-ibm2.edu.rpi you may have trouble with the display assignment. After the
setup command given above, type
hostname
cii3130-23.rcs.rpi.edu (Typical reply)
export DISPLAY=cii3130-23.rcs.rpi.edu:0.0 (Replace with reply
from hostname and trailing :0.0)
dx &
These commands may change. See your TA if this doesn’t execute DX.) After dx
brings up the Data Explorer window, start the PDF network with:
Left click the Run Visual Programs… menu item. In the new Net File Selection
window, set the directory at the top of the dialog box to
/dept/ecse/rta/pdf/.net* , and hit
and left click OK. If the Open command failed with an error message
'CreateGrid & Gaussian1 are undefined', DXMACROS was not set correctly.
After the file is loaded, it should automatically open 3 control panel and 2
output display windows. If not, type
display to see the 5 I/O windows such that the windows labeled 'Visualization
parameters', 'Red Gaussian', and 'Green Gaussian' are across the top of the
screen and 'perspective view' and 'top view' are in the lower left and right
corners if the windows don’t default to these positions. You may close the
window titled ‘Window Comment…’ to get it out of the way. It will not be used
in the procedure.
iii) Use the program to investigate the topics that are described below. Don't feel restricted
to only these topics, however, and investigate further any aspect that interests you.
After observing a set of conditions, change the appropriate parameters. The display
should update itself for the new values, but if it doesn’t, type
results of a new set. If the error message 'connection to server has been broken' is ever
received while generating a new plot, pull down the Connection menu, pick Start
Server , left click on Connect , and type
the following parameters and covariance matrices:
Signal 1 Signal 2
x 01
= 0 x 02
y 01
= 0 y 02
a) Sketch and describe the displayed results, and give an example of how such a situation
might occur. Indicate which regions correspond to which signal.
b) Change x 02
to 2, sketch the resulting display, and comment on the points of intersection.
c) Return x 02
to 10, and give one distribution a non-zero (positive and negative) covariance.
Describe the effects on the distribution and threshold.
[1] Fukunaga, K ., Introduction to Statistical Pattern Recognition , Ch. 3.
[2] Helstrom, C. , Statistical Theory of Signal Detection , Ch. 3.
[3] Newman, W. and Sproull, R. , Principles of Interactive Computer Graphics.
[4] Ninke, W. , Man-Computer Graphical Communication , pp. 395-427.
[5] Schwartz, M. , Information Transmission, Modulation, and Noise , Ch. 5,8.
[7] Dorf, R. C. , Modern Control Systems , Ch. 10.