EECS20N: Signals and Systems

Defining signals

Recall that signals are functions. Thus, both declarative and imperative approaches can be used to define signals. Consider for example an audio signal, a pure tone at 440 Hz (middle A on the piano keyboard). Recall that audio signals are functions Sound : TimePressure, where the set TimeReals represents a range of time and the set Pressure represents air pressure. To define this function, we might give a declarative description as follows:


s(t) = sin(440 × 2 π t)

Here, we have shortened "Sound" to "s" to be more consistent with common mathematical notation, which prefers to use single-character names for variables and functions. Such an audio signal sounds like this:

If you had a java-enabled browser, you would see an applet here.

An alternative way to define a signal is to construct a model for a physical system that produces that signal. Your textbook does this in chapter 2 where it gives an example where a pure tone is defined as a solution to a differential equation that describes the physics of a tuning fork.

Giving an imperative description of such a signal is a bit trickier. Do you give the value of s for a particular t? Or for all t? Suppose we want the latter, which seems like a more 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 computer program could provide the value of s for all these values of t.

One alternative is to provide an imperative description that has the potential of providing values for s, given any t. For example, we could define a Matlab function by putting the following into an m-file named "s.m":

function y = s(t)
y = sin(440*2*pi*t);

(Note that it is uncommon, and not recommended, to use single-character names for functions and variables in programs, but we do so here to maintain consistency.) Calling this function with a value for t as an argument yields a value for s.

Another alternative is to provide a set of samples of the signal. For example, in Matlab, we could define a vector that gives the values of t 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 sample 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 = sin(2*pi*440*t);

The vector s also has 8001 elements, representing evenly spaced samples of one second of A-440.