Capitulo 2
Capitulo 2
Contents
2.1 Defining functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.1.1 Declarative assignment . . . . . . . . . . . . . . . . . . . . . 52
2.1.2 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Probing Further: Relations . . . . . . . . . . . . . . . . . . . . . . . 56
2.1.3 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.1.4 Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.1.5 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.1.6 Declarative vs. imperative . . . . . . . . . . . . . . . . . . . 62
Probing Further: Declarative and imperative . . . . . . . . . . . . . 63
2.2 Defining signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
2.2.1 Declarative definitions . . . . . . . . . . . . . . . . . . . . . 66
2.2.2 Imperative definitions . . . . . . . . . . . . . . . . . . . . . 66
2.2.3 Physical modeling . . . . . . . . . . . . . . . . . . . . . . . 68
2.3 Defining systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Probing Further: Physics of a Tuning Fork . . . . . . . . . . . . . . 70
2.3.1 Memoryless systems and systems with memory . . . . . . . . 71
2.3.2 Differential equations . . . . . . . . . . . . . . . . . . . . . . 72
2.3.3 Difference equations . . . . . . . . . . . . . . . . . . . . . . 74
Basics: Trigonometric Identities . . . . . . . . . . . . . . . . . . . . 76
Basics: Summations . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2.3.4 Composing systems using block diagrams . . . . . . . . . . . 78
Probing Further: Composition of graphs . . . . . . . . . . . . . . . . 80
2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
49
2.1. DEFINING FUNCTIONS
The previous chapter describes the representation of signals and systems as functions,
concentrating on how to select the domain and range. This chapter is concerned with how
to give more complete definitions of these functions. In particular, we need an assignment
rule, which specifies how to assign an element in the range to each element in the domain.
There are many ways to give an assignment rule. A theme of this chapter is that these dif-
ferent ways have complementary uses. Procedural descriptions of the assignment rule, for
example, are more convenient for synthesizing signals or constructing implementations of
a system in software or hardware. Mathematical descriptions are more convenient for an-
alyzing signals and systems and determining their properties.
In practice it is often necessary to use several descriptions of assignment rules in combi-
nation, because of their complementary uses. In designing systems, a practicing engineer
is often reconciling these diverse views to ensure, for instance, that a particular hardware
device or piece of software indeed implements a system that is specified mathematically.
We begin with a discussion of functions in general, and then specialize to signals and
systems.
Example 2.1: In Section 1.1.5 we mentioned that sequences are a special kind
of function. An infinite sequence s is a function that maps the natural numbers
into some set Y , as illustrated in Figure 2.2. This function fully defines any infinite
sequence of elements in Y .
x1 y1
x2 y2
x3 y3
x4 y4
X f:X! Y Y
1 y1
2 y2
3 y3
4 y4
...
Naturals s : Naturals ! Y Y
∀ x ∈ R, Square(x) = x2 . (2.1)
In (2.1), we have used the universal quantifier symbol ‘∀’, which means ‘for all’ or ‘for
every’ to declare the relationship between values in the domain of the function and values
in the range. Statement (2.1) is read: “for every value of x in R, the function Square
evaluated at x is assigned the value x2 .” The expression “Square(x) = x2 ” in (2.1) is an
assignment.1
Expression (2.1) is an instance of the following prototype for defining functions. Define
f : X → Y by
∀ x ∈ X, f (x) = expression in x. (2.2)
In this prototype, f is the name of the function to be defined, such as Square, X is the
domain of f , Y is the range of f , and ‘expression in x’ specifies the value in Y assigned to
f (x).
The prototype (2.2) does not say how the ‘expression in x’ is to be evaluated. In the
Square example above, it was specified by the algebraic expression Square(x) = x2 . Such
a definition of a function is said to be declarative, because it declares properties of the
function without directly explaining how to construct the function.
Example 2.2: Here are some examples of functions of complex variables. (See
Appendix B for a review of complex variables.)
The magnitude of a complex number is given by abs : C → R+ , where C is the set
of complex numbers and R+ is the set of set of non-negative real numbers, and
q
∀ z = x + iy ∈ C, abs(z) = (x2 + y2 ).
∀ z = x + iy ∈ C, conjugate(z) = x − iy.
1 See Appendix A for a discussion of the use of “=” as an assignment, vs. its use as an assertion.
If this notation is unfamiliar, see box on page 77.) It is worth emphasizing that
the last definition is declarative: it does not give a procedure for calculating the
exponential function, since the sum is infinite. Such a calculation would never
terminate.
Example 2.3: The signum function gives the sign of a real number, signum : R →
{−1, 0, 1},
−1 if x < 0
∀ x ∈ R, signum(x) = 0 if x = 0 (2.3)
1 if x > 0
The right side of this assignment tabulates three expressions for three different sub-
sets of the domain. Below we will consider a more extreme case of this where every
value in the domain is tabulated with a value in the range.
2.1.2 Graphs
The vertical bar | is read “such that,” and the expression after it is a predicate that defines
the set.2
When X ⊂ R and Y ⊂ R, we can plot graph( f ) on a page.
which is plotted in Figure 2.3. In that figure, the horizontal and vertical axes repre-
sent the domain and the range, respectively (more precisely, a subset of the domain
and the range). The rectangular region enclosed by these axes represents the prod-
uct of the domain and the range (every point in that region is a member of (R × R)).
The graph is visually rendered by placing a black dot at every point in that region
that is a member of graph(Square). The resulting picture is the familiar plot of the
Square function.
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
is not, because two points a and b are assigned to the same point, 1, in the domain.
Neither is
{(1, a)},
because no point in the range is assigned to the point 2 in the domain.
The graph of Square, graph(Square), is given by the algebraic expression (x, x2 ). In other
cases, no such algebraic expression exists. For example, Voice is specified through its
graph in Figure 1.1, not through an algebraic expression. Thus, graphs can be used to
define functions that cannot be conveniently given by declarative assignments.
x1 y1
x2 y2
x3 y3
x4 y4
X Relation ! X × Y Y
∀ x ∈ X, f (x) = expression in x
The graph of f is
The expression ‘y = expression in x’ is a predicate in the variable (x, y) and so this proto-
type definition conforms to the prototype new set constructor given in (A.4) of Appendix
A:
NewSet = {z ∈ Set | Pred(z)}.
Name Marks
John Brown 90.0
Jane Doe 91.2
··· ···
Since the graph of f is a set, we can define the function f via its graph using the same
techniques we use to define sets.
2.1.3 Tables
gives the outcome of the first midterm exam for each student in the class. Obvi-
ously, this function cannot be given by an algebraic declarative assignment. But it
can certainly be given as a table, as shown in table 2.1.
nslookup cory.eecs.berkeley.edu
you get the IP address 128.32.134.240. The domain name server attached to your
machine stores the nslookup function as a table.
2.1.4 Procedures
Sometimes the value f (x) that a function f assigns to an element x ∈ domain( f ) is ob-
tained by executing a procedure.
fact(1) = 1;
for n = 2:10
fact(n) = n * fact(n-1);
end
Unlike previous mechanisms for defining a function, this one gives a constructive method
to determine an element in the range given an element in the domain. This style is called
imperative to distinguish it from declarative. The relationship between these two styles
is interesting, and quite subtle. It is explored further in Section 2.1.6.
2.1.5 Composition
Functions can be combined to define new functions. The simplest mechanism is to con-
nect the output of one function to the input of another. We have been doing this informally
to define systems by connecting components in block diagrams.
If the first function is f1 and the second is f2 , then we write the function composition as
f2 ◦ f1 . That is, for every x in the domain of f1 ,
( f2 ◦ f1 )(x) = f2 ( f1 (x)).
f 3
f 1(x)
x f 2 (f 1(x)) = f 3 (x)
X f 1
Y
f 2 Y’
X’
must be in the set of possible inputs for the second. Without this input-output connection
restriction, the interconnection would be meaningless.3
It is worth pausing to study the notation f2 ◦ f1 . Assume f1 : X → Y and f2 : X 0 → Y 0 .
Then if Y ⊂ X 0 , we can define
f3 = f2 ◦ f1 ,
where f3 : X → Y 0 such that
∀ x ∈ X, f3 (x) = f2 ( f1 (x)) (2.5)
Notice that f1 is applied first, and then f2 . Why is f1 listed second in f2 ◦ f1 ? This
convention simply mirrors the ordering of f2 ( f1 (x)) in (2.5). We can visualize f3 as in
Figure 2.5.
its output. This interpretation of domain as inputs and range as outputs is natural, and it is the reason that
systems are described by functions.
The function
Display : ColorMapIndexes → Intensity3
decodes the colormap indexes. If ColorMapIndexes has 256 values, it could be
identified with the set Integers8 of all 8-bit words, as we have seen. If we compose
these functions
If f : X → X, i.e. the domain and range of f are the same, we can form the function
f2 = f ◦ f.
To see this, let (y1 , y2 ) = S(x1 , x2 ) and (z1 , z2 ) = S(y1 , y2 ) = (S ◦ S)(x1 , x2 ). Then
we see that
z1 1 2 y1 1 2 1 2 x1
= =
z2 3 4 y2 3 4 3 4 x2
| {z }
A
2
1 2 x1 7 10 x1
= =
3 4 x2 15 22 x2
| {z }
A2
x1
= A2 .
x2
Example 2.12: Consider another example in the context of the telephone system.
Let Voices be the set of possible voice input signals of the form
The twisted wire pair may distort this signal, so we define a function
(LocalLoop ◦ Mouthpiece)(Voice).
where DiscreteTime = {0, 1/64, 000, 2/64, 000, · · · }, since there are 64,000 bit-
s/sec. So,
BitStreams = [DiscreteTime → Binary].
The encoder in a line card can be mathematically described as a function
We can continue in this fashion until we model the entire path of a voice signal
through the telephone network as the function composition
defined by the statement “SquareRoot(x) is the unique value of y ∈ R+ such that y2 = x.”
This declarative definition of SquareRoot does not tell us how to calculate its value at
any point in its domain. Nevertheless, it defines SquareRoot perfectly well. By contrast,
an imperative definition of SquareRoot would give us a procedure, or algorithm, for cal-
culating SquareRoot(x) for a given x. Call the result of such an algorithm ŷ. Since the
algorithm would yield an approximation in most cases, ŷ2 would not be exactly equal to
x. So the declarative and imperative definitions are not always the same.
Any definition of a function following the prototype (2.2) is a declarative definition. It
does not give a procedure for evaluating ‘expression in x’.
The declarative approach establishes a relation between the domain and the range of a
function. For example, the equation
y = sin(x)/x
can be viewed as defining a subset of R × R. This subset is the graph of the function
Sinc : R → R.
The imperative approach also establishes a function, but it is a function that maps the
program state before the statement is executed into a program state after the statement
is executed. Consider for example the Java statement
y = Math.sin(x)/x;
Considering only this statement (rather than a larger program), the program state is the
value of the two variables, x and y. Suppose that these have been declared to be of type
double, which in Java represents double-precision floating-point numbers encoding
according to an IEEE standard. Let the set Doubles be the set of all numbers so encoded,
and note that NaN ∈ Doubles, not a number, the result of division by zero. The set of
possible program states is therefore Doubles × Doubles. The Java statement therefore
defines a function
sin(x)
y= . (2.8)
x
Consider the following Java statement:
y = Math.sin(x)/x;
y = sin(x)/x
Superficially, these look very similar to (2.8). There are minor differences in syntax
in the Java statement, but otherwise, it is hard to tell the difference. But there are
differences. For one, the mathematical equation (2.8) has meaning if y is known and
x is not. It declares a relationship between x and y. The Java and Matlab statements
define a procedure for computing y given x. Those statements have no meaning if
y is known and x is not.
The mathematical equation (2.8) can be interpreted as a predicate that defines a
function, for example the function Sinc : R → R, where
in (2.9). To see this, consider the value of y when x = 0. Given the mathematical
equation, it is not entirely trivial to determine the value of y. You can verify that
y = 1 when x = 0 using l’Hôpital’s rule, which states that if f (a) = g(a) = 0, then
f (x) f 0 (x)
lim = lim 0 , (2.10)
x→a g(x) x→a g (x)
if the limit exists, where f 0 (x) is the derivative of f with respect to x, and g0 (x) is
the derivative of g with respect to x.
In contrast, the meaning of the Java and Matlab statements is that y = 0/0 when
x = 0, which Java and Matlab (and most modern languages) define to be NaN, not
a number. Thus, given x = 0, the procedures yield different values for y than the
mathematical expression. (An exception is symbolic algebra programs, such as
Mathematica or Maple, which will evaluate sin(x)/x to 1 when x = 0. These pro-
grams use sophisticated, rule-based solution techniques, and, in effect, recognize
the need and apply l’Hôpital’s rule.)
We can see from the above example some of the strengths and weaknesses of imperative
and declarative approaches. Given only a declarative definition, it is difficult for a com-
puter to determine the value of y. Symbolic mathematical software, such as Maple and
Mathematica, is designed to deal with such situations, but these are very sophisticated
programs. In general, using declarative definitions in computers requires quite a bit more
sophistication than using imperative definitions.
Imperative definitions are easier for computers to work with. But the Java and Matlab
statements illustrate one weakness of the imperative approach: it is arguable that y = NaN
is the wrong answer, so the Java and Matlab statements have a bug. This bug is unlikely
to be detected unless, in testing, these statements happen to be executed with the value
x = 0. A correct Java program might look like this:
if (x == 0.0) y = 1.0;
else y = Math.sin(x)/x;
Thus, the imperative approach has the weakness that ensuring correctness is more dif-
ficult. Humans have developed a huge arsenal of techniques and skills for thoroughly
Signals are functions. Thus, both declarative and imperative approaches can be used to
define them.
Consider for example an audio signal s, a pure tone at 440 Hz (middle A on the piano
keyboard). Recall that audio signals are functions Sound : Time → Pressure, where the
set Time ⊂ R represents a range of time and the set Pressure represents air pressure.4 To
define this function, we might give the declarative description
used as the definition of the function s. Using the shorthand is only acceptable when
the domain of the function is well understood from the context. This shorthand can be
particularly misleading when considering systems, and so we will only use it sparingly.
A portion of the graph of the function (2.11) is shown in Figure 1.3.
We can also give an imperative description of such a signal. When thinking of signals
rather than more abstractly of functions, there is a subtle question that arises when we
attempt to construct an imperative definition. Do you give the value of s(t) for a particular
t? Or for all t in the domain? Suppose we want the latter, which seems like a more
4 Recall
further that we normalize Pressure so that zero represents the ambient air pressure. We also use
arbitrary units, rather than a physical unit such as millibars.
complete definition of the function. Then we have a problem. The domain of this function
may be any time interval, or all time! Suppose we just want one second of sound. Define
t = 0 to be the start of that one second. Then the domain is [0, 1]. But there are an
(uncountably) infinite number of values for t in this range! No Java or Matlab program
could provide the value of s(t) for all these values of t.
Since a signal is function, we give an imperative description of the signal exactly as we
did for functions. We give a procedure that has the potential of providing values for s(t),
given any t.
double s(double t) {
return (Math.sin(440*2*Math.PI*t));
}
Calling this method with a value for t as an argument yields a value for s(t). Java
(and most object-oriented languages) use the term “method” for most procedures.
Example 2.15: In Matlab, we could define a vector t that gives the values of time
that we are interested in:
t = [0:1/8000:1];
In the vector t there are 8001 values evenly spaced between 0 and 1, so our sam-
pling rate is 8000 samples per second. Then we can compute values of s for these
values of t and listen to the resulting sound:
s = cos(2*pi*440*t);
sound(s,8000)
The vector s also has 8001 elements, representing evenly spaced samples of one
second of A-440.
An alternative way to define a signal is to construct a model for a physical system that
produces that signal.
where ω0 is constant that depends on the mass and stiffness of the tine, and and
where ÿ(t) denotes the second derivative with respect to time of y (see box).
It is easy to verify that y given by
is a solution to this differential equation (just take its second derivative). Thus,
the displacement of the tuning fork is sinusoidal. This displacement will couple
directly with air around the tuning fork, creating vibrations in the air (sound). If
we choose materials for the tuning fork so that ω0 = 2π × 440, then the tuning fork
will produce the tone of A-440 on the musical scale.
All of the methods that we have discussed for defining functions can be used, in princi-
ple, to define systems. However, in practice, the situation is much more complicated for
systems than for signals. Recall from Section 1.2.1 that a system is a function where the
domain and range are sets of signals called signal spaces. Elements of these domains and
tine
ranges are considerably more difficult to specify than, say, an element of R or Z. For this
reason, it is almost never reasonable to use a graph or a table to define a system. Much
of the rest of this book is devoted to giving precise ways to define systems where some
analysis is possible. Here we consider some simple techniques that can be immediately
motivated. Then we show how more complicated systems can be constructed from sim-
pler ones using block diagrams. We give a rigorous meaning to these block diagrams so
that we can use them without resorting to perilous intuition to interpret them.
Consider a system S where
S : [D → R] → [D0 → R0 ]. (2.14)
Suppose that x ∈ [D → R] and y = S(x). Then we call the pair (x, y) a behavior of the
system. A behavior is an input, output pair. The set of all behaviors is
Giving the set of behaviors is one way to define a system. Explicitly giving the set
Behaviors, however, is usually impractical, because it is a huge set, typically infinite (see
boxes on pages 679 and 681). Thus, we seek other ways of talking about the relationship
between a signal x and a signal y when y = S(x).
To describe a system, one must specify its domain (the space of input signals), its range
(the space of output signals), and the rule by which the system assigns an output signal
to each input signal. This assignment rule is more difficult to describe and analyze than
the input and output signals themselves. A table is almost never adequate, for example.
Indeed for most systems we do not have effective mathematical tools for describing or
A tuning fork consists of two fingers called tines, as shown in Figure 2.6. If you displace
one of these tines by hitting it with a hammer, it will vibrate with a nearly perfect sinu-
soidal characteristic. As it vibrates, it pushes the air, creating a nearly perfect sinusoidal
variation in air pressure that propogates as sound. Why does it vibrate this way?
Suppose the displacement of the tine (relative to its position at rest) at time t is given
by x(t), where x : R → R. There is a force on the tine pushing it towards its at-rest
position. This is the restorative force of the elastic material used to make the tine. The
force is proportional to the displacement (the greater the displacement, the greater the
force), so
F(t) = −kx(t),
where k is the proportionality constant that depends on the material and geometry of the
tine. In addition, Newton’s second law of motion tells us the relationship between force
and acceleration,
F(t) = ma(t),
where m is the mass and a(t) is the acceleration at time t. Of course,
d2
a(t) = x(t) = ẍ(t),
dt
so
mẍ(t) = −kx(t)
or
ẍ(t) = −(k/m)x(t).
Comparing with (2.12), we see that ω20 = k/m.
A solution to this equation needs to be some signal that is proportional to its own
second derivative. A sinusoid as in (2.13) has exactly this property. The sinusoidal
behavior of the tine is called simple harmonic motion.
t x x(t)
F(x) f
y(t)
understanding their behavior. Thus, it is useful to restrict our system designs to those we
can understand. We first consider some simple examples.
Memoryless systems are characterized by the property that previous input values are not
remembered when determining the current output value. More precisely, a system F :
[R → Y ] → [R → Y ] is memoryless if there is a function f : Y → Y such that
This is illustrated in Figure 2.7. In other words, at any time t, the output (F(x))(t) depends
only on the input x(t) at that same time t; in particular, it does not depend on t nor on
previous or future values of x.
Specification of a memoryless system reduces to specification of the function f . If Y is
finite, then a table may be adequate.
This system is clearly not memoryless. It has the effect of smoothing the input
signal. We will study it and many related systems in detail in later chapters.
f (t) = ma(t),
where f (t) is the force at time t, and m is the mass. By the definition of acceleration,
where ẍ(t) denotes the second derivative with respect to time of x. If we know the
initial position x(0) and initial speed ẋ(0) of the particle at time 0, and if we are
given the input force f , we can evaluate the position at any t by integrating this
differential equation
Z t Z s
x(t) = x(0) + ẋ(0)t + [ ( f (τ)/m)dτ]ds. (2.15)
0 0
We can regard the initial position and velocity as inputs, together with force, in
which case the system is a function
where for any inputs (x(0), ẋ(0), f ), x = Particle(x(0), ẋ(0), f ) must satisfy (2.15).
Suppose for example that the input is (1, −1, f ) where m = 1 and ∀ t ∈ R+ , f (t) = 1.
We can calculate the position by carrying out the integration in (2.15) to find that
∀ t ∈ R+ , x(t) = 1 − t + 0.5t 2 .
Notice that the position of the particle is sinusoidal. Notice further that the ampli-
tude of this sinusoid decreases as ω0 increases. Intuitively, this has to be the case.
If the externally imposed force is varying more rapidly back and forth, the particle
has less time to respond to each direction of force, and hence its excursion is less.
In subsequent chapters, we will study how the response of certain kinds of systems
varies with the frequency of the input.
Using the trigonometric identities in the box on page 76 this can be written as
y(n) = R cos(2π f n + θ)
where
sin(−2π f )
θ = arctan( )/2,
1 + cos(−2π f )
p
R = 2 + 2 cos(2π f )
1 M−1
∀ n ∈ Integers, y(n) = ∑ x(n − k),
M k=0
where x is the input and y is the output. (If this notation is unfamiliar, see box on
page 77.)
This system is called an M-point moving average, since at any n it gives the average
of the M most recent values of the input. It computes an average, just like example
2.18 but the integral has been replaced by its discrete counterpart, the sum.
Moving averages are widely used on Wall Street to smooth out momentary fluctuations in
stock prices to try to determine general trends. We will study the smoothing properties of
this system. We will also study more general forms of difference equations of which the
moving average is a special case.
The examples above give declarative definitions of systems. Imperative definitions re-
quire giving a procedure for computing the output signal given the input signal. It is clear
how to do that with the memoryless system, assuming that an imperative definition of the
function f is available, and with the moving average. The integral equation, however, is
harder to define imperatively. An imperative description of such systems that is suitable
for computation on a computer requires approximation via solvers for differential equa-
tions. Simulink, for example, which is part of the Matlab package, provides such solvers.
Alternatively, an imperative description can be given in terms of analog circuits or other
physical systems that operate directly on the pertinent continuous domain. Discrete-time
systems often have reasonable imperative definitions as state machines, considered in
detail in the next chapter.
where
C = A cos α + B cos β
S =√A sin α + B sin β
R = C 2 + S2
φ = arctan(S/C)
Basics: Summations
1 M−1
∀ n ∈ Integers, y(n) = ∑ x(n − k),
M k=0
M−1
where x is the input and y is the output. The notation ∑ indicates a sum of M terms.
k=0
The terms are x(n − k), where k takes on values from 0 to M − 1. Thus,
M−1
∑ x(n − k) = x(n) + x(n − 1) + · · · + x(n − M + 1).
k=0
This is similar to the discrete-time moving average in that it sums values of x, but it
sums over a continuum of values of the dummy variable τ. In the discrete-time version,
the sum is over discrete values of the dummy variable k, which takes only integer val-
ues. The summation notation has an ambiguity that it does not share with the integral
notation. In particular, it is not clear how to interpret an expression like
M−1
∑ 1 + 2.
k=0
There are two possibilities, depending on whether the 2 is included in the summation
or is interpreted as being outside the summation. One possibility gives a sum of 3M,
while the other gives M + 2. In integration, this ambiguity does not occur because of the
explicit reference to the dummy variable as dτ. In particular, it is clear that
Z T Z T
1 + 2dτ 6= 1dτ + 2.
0 0
We have been using block diagrams informally to describe systems. But it turns out that
block diagrams can have as rigorous and formal a meaning as mathematical notations.
We begin the exploration of this concept here, and pursue it much further in Chapter 4.
A block diagram is a visual syntax for describing a system as an interconnection of other
(component) systems, each of which emphasizes one particular input-to-output transfor-
mation of a signal. A block diagram is a collection of blocks interconnected by arrows.
Arrows are labeled by signals. Each block represents an individual system that transforms
an incoming or input signal into an outgoing or output signal.
A block diagram, which is a composition of systems, is itself a system. We can use
function composition, as discussed in Section 2.1.5, to give a precise meaning to this
larger system. A block represents a function, and the connection of an output from one
block to the input of another represents the composition of their two functions. The only
requirement for interconnecting two blocks is that the output of the first block must be an
acceptable input for the second.
Block diagrams can be much more readable than symbolic function composition, particu-
larly for complicated interconnections. They also offer a natural hierarchy, where we can
combine blocks to hide certain signals and component systems and to emphasize others.
For certain sorts of blocks, composing them in a block diagram results in a new system
whose properties are easy to determine. In chapter 4 we will show how to combine state
machine blocks to define a new state machine. In Chapter 8 we will show how to combine
filter blocks to define new filter blocks. Here, we consider the composition of blocks
when all we know about the blocks is that they represent functions with a given domain
and range. No further structure is available.
The simplest block diagram has a single block, as in Figure 2.8. The block represents a
system with input signal x and output signal y. Here, x denotes a variable over the set X,
and y denotes a variable over the set Y . The system is described by the function S : X → Y .
Both X and Y are sets of functions or signals. Therefore the variables x and y themselves
denote functions.
In general, a system obtained by a cascade composition of two blocks is given by the
composition of the functions describing those blocks. In figure 2.9 the function S de-
scribes the system obtained by connecting the systems S1 and S2 , with S = S2 ◦ S1 , i.e.
∀ x ∈ X, S(x) = S2 (S1 (x)).
x"X y "Y
S:X!Y
X = [DX ! RX] Y = [DY ! RY]
Figure 2.8: The simplest block diagram represents a function S that maps an input
signal x ∈ X to an output signal y ∈ Y . The domain and range of the input are DX
and RX , repectively, and of the output, DY and RY .
S:X!Z
The combined system has input signal x, output signal z, and internal signal y. (The
internal signal is not visible in the input or output of the combined system.) Of course,
the range of the first system must be contained by the domain of the second for this
composition to make sense. In the figure, the typical case is shown where this range and
domain are the same. The voice path in (2.7) is an example of cascade composition.
Consider two more block diagrams with slightly more complicated structure. Figure 2.10
is similar to Figure 2.9. The system described by S1 is the same as before, but the system
described by S2 has a pair of input signals (w, y) ∈ W × Y . The combined system has
the pair (x, w) ∈ X × W as input signal, z as output signal, y as internal signal, and it is
described by the function S : X ×W → Z, where
We suggest a general method for writing down a declarative specification of the inter-
connected system S in Figure 2.9 in terms of the subsystems S1 and S2 and the connec-
tion restriction that the output of S1 be acceptable as an input of S2 .
We describe S1 and S2 by their graphs,
y1 = y2 .
We use different dummy variables y1 and y2 to distinguish between the two systems and
the connection restriction.
The graph of the combined system S is then given by
w"W
W = [DW ! RW]
z "Z
S2 : W × Y ! Z
Z = [DZ ! RZ]
x"X y "Y
S1 : X ! Y
X = [DX ! RX] Y = [DY ! RY]
S:W×X!Z
Figure 2.10: The combined system with input signals x, w and output signal z is
described by the function S, where ∀ (x, w), S(x, w) = S2 (w, S1 (x)).
Notice that it is now much harder to define this system using the function composition
notation, ◦, yet the block diagram makes its definition evident. In fact, the block diagram
notation is much more flexible.
The system of Figure 2.11 is obtained from that of figure 2.10 by connecting the output
signal z to the input signal w. As a result the new system has input signal x, output signal
z, internal signals y and w, and it is described by the function S0 : X → Z, where
The connection of z to w is called a feedback connection because the output z is fed back
as input w. Of course, such a connection has meaning only if Z, the range of S2 , is a subset
of W . The system in Figure 2.11 is again difficult to define using function composition
notation, ◦, yet again the block diagram definition is clear.
There is one enormous difference between (2.17) and (2.18). Expression (2.17) serves as
a definition of the function S: to every (x, w) in its domain S assigns the value given by
the right-hand side which is uniquely determined by the given functions S1 and S2 . But in
expression (2.18) the value S0 (x) assigned to x may not be determined by the right-hand
side of (2.18), since the right-hand side itself depends on S0 (x). In other words, (2.18) is
an equation that must be solved to determine the value of S0 (x) for a given x; i.e. S0 (x) = y
where y is a solution of
y = S2 (y, S1 (x)). (2.19)
z"W
Z#W
z "Z
S2 : W × Y ! Z
Z = [DZ ! RZ]
x"X y "Y
S1 : X ! Y
X = [DX ! RX] Y = [DY ! RY]
S' : X ! Z
Figure 2.11: The combined system is described by the function S0 , where S0 (x) =
S2 (S0 (x), S1 (x)).
Such a solution, if it exists, is called a fixed point. We now face the difficulty that this
equation may have no solution, exactly one solution, or several solutions. Another diffi-
culty is that the value y that solves (2.19) is not a number but a function. So it will not
be easy to solve such an equation. Since feedback connections always arise in control
systems, we will study how to solve them. We will first solve them in the context of state
machines, which are introduced in the next chapter.
All of these block diagrams follow the same principles. They use component systems
to define composite systems. To be useful, of course, it is necessary to be able to infer
properties of the composite systems. Fortunately, this is often the case, although feedback
connections will prove subtle. This idea is explored further in chapters 4 and 8.
2.4 Summary
Signals and systems both are modeled as functions. It is often straightforward to figure
out the domain and range of a particular signal and system. It is more difficult to specify
the function’s assignment rule. Since the domain and range of a system are themselves
signal spaces, the assignment rule for a system is more complex than for a signal. The
domain and range signal spaces of a system can be quite different: a modem converts bit
sequences into sounds, an encoder converts sounds into bit sequences.
The assignment rule of a function takes a declarative or imperative form. The declarative
form is usually mathematical, as in: define Chirp : [−1, 1] → R by
The imperative form is a procedure to evaluate the function at an arbitrary point in its
domain. The procedure may involve a table lookup (if the domain is finite) or a computer
program. If the domain is infinite, the evaluation procedure may only yield an approxi-
mation of the declarative form of the “same” function.
A physical system is often described using differential or difference equations that em-
body its “law of motion.” A mechanical system’s law of motion is derived from Newton’s
laws. An electrical circuit’s law of motion is derived from Kirchhoff’s laws and the laws
of the circuit’s constitutive elements: resistors, capacitors, inductors, transistors.
Most systems are built by composing smaller subsystems. The composition may be ex-
pressed in the visual syntax of block diagrams or, mathematically, using function compo-
sition. Feedback is the most complex form of system composition: a feedback specifica-
tion requires the solution of a fixed point equation.
Exercises
Each problem is annotated with the letter E, T, C which stands for exercise, requires some
thought, and requires some conceptualization. Problems labeled E are usually mechani-
cal, those labeled T require a plan of attack, those labeled C usually have more than one
defensible answer.
1. E The broadcast signal of an AM radio station located at 110 on your dial has a
carrier frequency of 110 kHz. An AM signal that includes the carrier has the form
∀ t ∈ Time, AMSignal(t) = (1 + m(t)) sin(2π × 110, 000t),
where m is an audio signal like Voice in figure 1.1, except that ∀ t ∈ Time, |m(t)| < 1.
Since you cannot easily plot such a high frequency signal, give an expression for
and plot AMSignal (using Matlab) for the case where Time = [0, 1], m(t) = cos(πt),
and the carrier frequency is 20 Hz.
2. T This problem studies the relationship between the notion of delay and the graph
of a function.
(a) Consider two functions f and g from R into R where ∀ t ∈ R, f (t) = t and
g(t) = f (t −t0 ), where t0 is a fixed number. Sketch a plot of f and g for t0 = 1
and t0 = −1. Observe that if t0 > 0 then graph(g) is obtained by moving
graph( f ) to the right, and if t0 < 0 by moving it to the left.
(b) Show that if f : R → R is any function whatsoever, and ∀ t, g(t) = f (t − t0 ),
then if (t, y) ∈ graph( f ), then (t + t0 , y) ∈ graph(g). This is another way of
saying that if t0 > 0 then the graph is moved to the right, and if t0 < 0 then the
graph is moved to the left.
(c) If t represents time, and if t0 > 0, we say that g is obtained by delaying f .
Why is it reasonable to say this?
3. E Indicate whether the following statements are true or false.
(a) [{1, 2, 3} → {a, b}] ⊂ [N → {a, b}]
(b) {g | g = graph( f ) ∧ f : X → Y } ⊂ X ×Y
(c) F : [R → R] → [R → R], such that ∀ t ∈ R, and ∀ x ∈ [R → R],
(F(x))(t) = sin(2π · 440t)
is a memoryless system.
1 1
graph(g)
graph(f )
-1 0 1 -1 0 1
-0.5
Figure 2.12: Graphs of two functions. The bold line is the graph.
4. E Figure 2.12 shows graphs of two functions f : [−1, 1] → [−1, 1] and g : [−1, 1] →
[−1, 1]. For each case, define the function by giving an algebraic expression for its
value at each point in its domain. This expression will have several parts, similar to
the definition of the signum function in (2.3). Note that g(0) = 0 for the graph on
the right. Plot graph( f ◦ g) and graph(g ◦ f ).
5. T Let X = {a, b, c}, Y = {1, 2}. For each of the following subsets G ⊂ X × Y ,
determine whether G is the graph of a function from X to Y , and if it is, describe
the function as a table.
6. C A router in the Internet is a switch with several input ports and several output
ports. A packet containing data arrives at an input port at an arbitrary time, and
the switch forwards the packet to one of the outgoing ports. The ports of different
routers are connected by transmission links. When a packet arrives at an input port,
the switch examines the packet, extracting from it a destination address d. The
switch then looks up the output port in its routing table, which contains entries of
the form (d, outputPort). It then forwards the packet to the specified output port.
The Internet works by setting up the routing tables in the routers.
Consider a simplified router with one input port and and two output ports, named
O1 , O2 . Let D be the set of destination addresses.
(a) Explain why the routing table can be described as a subset T ⊂ D × {O1 , O2 }.
(b) Is it reasonable to constrain T to be the graph of a function from D → {O1 , O2 }?
Why?
(c) Assume the signal at the input port is a sequence of packets. How would you
describe the space of input signals to the router and output signals from the
router?
(d) How would you describe the switch as a function from the space of input
signals to the space of output signals?
(a) x = 5,
(b) A = {5},
(c) x > 5,
(d) 3 > 5,
(e) x > 5 ∧ x < 3.
8. T A logic circuit with m binary inputs and n binary outputs is shown in Figure 2.13.
It is described by a function F : X → Y where X = Binarym and Y = Binaryn . (In
a circuit, the signal values 1 and 0 in Binary correspond to voltage High and Low,
respectively.) How many such distinct logic functions F are there?
∀n ∈ N0 , H(x)(n) = x(10n),
is a mathematical example of a system with input signal space [R+ → R] and output
signal space [N0 → R]. Give a mathematical example of a system H whose
... ...
F : Binm ! Binn
xm " Binary yn " Binary
Figure 2.13: The logic circuit has m binary inputs (x1 , · · · , xm ) and n binary outputs
(y1 , · · · , yn ).
(a) input and output signal spaces both are [N0 → Binary].
(b) input signal space is [N0 → R] and output signal space is [N0 → {0, 1}].
(c) input signal space is [Z → R] and output signal space is [R → R].
10. E Consider the functions
g: Y → R and f : Nats → Y.
where Y is a set.
(a) Draw a block diagram for (g ◦ f ), with one block for each of g and f , and
label the inputs and output of the blocks with the domain and range of g and
f.
(b) Suppose Y is given by
Y = [{1, · · · , 100} → R]
(Thus, the function f takes a natural number and returns a sequence of length
100, while the function g takes a sequence of length 100 and returns a real
number.)
Suppose further that g is given by: for all y ∈ Y ,
100
g(y) = ∑ y(i) = y(1) + y(2) + · · · + y(100),
i=1
( f (x))(z) = cos(2πz/x).
(Thus, x gives the period of a cosine waveform, and f gives 100 samples of
that waveform.) Give a one-line Matlab expression that evaluates (g ◦ f )(x)
for any x ∈ Nats. Assume the value of x is already in a Matlab variable called
x.
(c) Find (g ◦ f )(1).
11. T The following system S takes a discrete-time signal x ∈ X and transforms it into
a discrete-time signal y ∈ Y whose value at index n is the average of the previous 4
values of x. Such a system is called a moving average. Suppose that X = Y = [N →
R], where N is the set of natural numbers. More precisely, the system is described
by the function S such that for any x ∈ X, y = S(x) is given by
[x(1) + · · · + x(n)]/4 for 1 ≤ n < 4
y(n) =
[x(n − 3) + x(n − 2) + x(n − 1) + x(n)]/4 for n ≥ 4
Notice that the first three samples are averages only if we assume that samples prior
to those that are available have value zero. Thus, there is an initial transient while
the system collects enough data to begin computing meaningful averages.
Write a Matlab program to calculate and plot the output signal y for time 1 ≤ n ≤ 20
for the following input signals:
(a) x is a unit step delayed by 10, i.e. x(n) = 0 for n ≤ 9 and x(n) = 1 for n ≥ 10.
(b) x is a unit step delayed by 15.
(c) x alternates between +1 and -1, i.e. x(n) = 1 for n odd, and x(n) = −1 for n
even. Hint: Try computing cos(πn) for n ∈ N.
(d) Comment on what this system does. Qualitatively, how is the output signal
different from the input signal?
12. T The following system is similar to problem 11, but time is continuous. Now
X = Y = [R → R] and the system F : X → Y is defined as follows. For all x ∈ X
and t ∈ R
1 t
Z
(F(x))(t) = x(s)ds.
10 t−10
Show that if x is the sinusoidal signal
∀t ∈R x(t) = sin(ωt),
then y is also sinusoidal
∀ t ∈ R, y(t) = A sin(ωt + φ).
You do not need to give precise expressions for A and φ, but just show that the
result has this form. Also, show that as ω gets large, the amplitude of the output
gets small. Higher frequencies, which represent more abrupt changes in the input,
are more attenuated by the system than lower frequencies.
Hint: The following fact from calculus may be useful:
Z b
1
sin(ωs)ds = (cos(ωa) − cos(ωb)).
a ω
Also, the identity in the footnote on page 76 might be useful to show that the output
is sinusoidal with the appropriate frequency.
13. E Suppose that f : R → R and g : R → Z such that for all x ∈ R,
if x > 0
1
g(x) = 0 if x = 0
−1 if x < 0
and
f (x) = 1 + x.
(a) Define h = g ◦ f .
(b) Suppose that
F : [R → R] → [R → R]
G : [R → R] → [R → Z]
such that for all s ∈ [R → R] and x ∈ R,
(F(s))(x) = f (s(x))
(G(s))(x) = g(s(x))
where f and g are as given above. Sketch a block diagram for H = G ◦ F,
where you have one block for each of G and F. Label the inputs and outputs
of your blocks with the domain and range of the functions in the blocks.
(c) Let s ∈ [R → R] be such that for all x ∈ R,
s(x) = cos(πx).
Define u where
u = (G ◦ F)(s).
Give the domain, range, and assignment rule for u.
G: D×D → D
H
x
y G
H
x
y G
but where now x ∈ R+ and y ∈ R+ . The inputs and outputs are no longer signals,
but rather just non-negative real numbers. So G : R+ × R+ → R+ . Block diagrams,
of course, work just as well for such simpler functions.
In this problem, we explore fixed points by considering a classic algorithm for
calculating the square root of a non-negative real number. Let the function G above
be given by
∀ x, y ∈ R+ , G(x, y) = 0.5(y + x/y). (2.20)
(a) Show that for a given x ∈ R+ , if the fixed point exists, then H : R+ → R+ is
given by √
∀ x ∈ R+ , H(x) = x.
(b) To use the system above to calculate a square root, we simply start with a
guess for y, say 1, and calculate G(x, y) repeatedly until it converges to a
stable value for y. That stable value is the fixed point. Do this calculation for
x = 4 and for x = 12, repeating the evaluation of G until you obtain a close
approximation to the true square root. You may want to use Matlab for this.