<< Chapter < Page | Chapter >> Page > |
Repeat this procedure for the function
y = (n>=0)
, where
n
is a vector of time indices.The word sampling refers to the conversion of a continuous-time signal into a discrete-time signal.The signal is converted by taking its value, or sample,at uniformly spaced points in time. The time between two consecutive samplesis called the sampling period . For example, a sampling period of 0.1 seconds implies thatthe value of the signal is stored every 0.1 seconds.
Consider the signal . We may form a discrete-time signal, , by sampling this signal with a period of . In this case,
Use the
stem
command to plot the function
defined above for the following values of
and
.
Use the
subplot
command
to put all the plots in a single figure,and scale the plots properly with the
axis
command.
For help on the Matlab random function, click here .
The objective of this section is to show how two signals that “look” similarcan be distinguished by computing their average over a large interval.This type of technique is used in signal demodulators todistinguish between the digits “1” and “0”.
Generate two discrete-time signals called “sig1” and “sig2”
of length 1,000.The samples of “sig1” should be independent, Gaussian
random variables with mean 0 and variance 1.The samples of “sig2” should be independent, Gaussian
random variables with mean 0.2 and variance 1.Use the Matlab command
random
or
randn
to generate these signals,
and then plot themon a single figure using the
subplot
command.
(Recall that an alternative name for a Gaussian random variableis a
normal random variable.)
Next form a new signal “ave1(n)” of length 1,000
such that “ave1(n)” is the average of the vector “sig1(1:n)”(the expression
sig1(1:n)
returns a vector containing the first n elements of “sig1”).
Similarly, compute “ave2(n)” as the average of “sig2(1:n)”.Plot the signals “ave1(n)” and “ave2(n)” versus “n”
on a single plot.Refer to help on the Matlab
plot command for information on plotting multiple signals.
For help on the following topics, click the corresponding link: Meshgrid Command , Mesh Command , and Displaying Images .
So far we have only considered 1-D signals such as speech signals.However, 2-D signals are also very important in digital signal processing.For example, the elevation at each point on a map, or the color at each point on a photograph areexamples of important 2-D signals. As in the 1-D case,we may distinguish between continuous-space and discrete-space signals.However in this section, we will restrict attention to discrete-space2-D signals.
When working with 2-D signals, we may choose to visualize them as images or as 2-D surfaces in a 3-D space.To demonstrate the differences between these two approaches, we will use two different display techniques in Matlab.Do the following:
meshgrid
command to generate the discrete-space 2-D signal
mesh
command to display the signal as a surface plot.colormap(gray(256))
just after issuing the
image
command
to obtain a grayscale image.Read the help on
image for more information.Notification Switch
Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?