<< Chapter < Page Chapter >> Page >
  • a n ( u ( n ) - u ( n - 10 ) ) for n in [ - 20 , 20 ]

Repeat this procedure for the function

  • cos ( ω n ) a n u ( n ) for ω = π / 4 , and n in [ - 1 , 10 ]
The unit step function y = u(n) may be computed in Matlab using the command y = (n>=0) , where n is a vector of time indices.
Submit all three figures, for a total of 8 plots. Also submit the printouts of your Matlab .m-files.

Sampling

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 f ( t ) = sin ( 2 π t ) . We may form a discrete-time signal, x ( n ) , by sampling this signal with a period of T s . In this case,

x ( n ) = f ( T s n ) = sin ( 2 π T s n ) .

Use the stem command to plot the function f ( T s n ) defined above for the following values of T s and n . Use the subplot command to put all the plots in a single figure,and scale the plots properly with the axis command.

  1. T s = 1 / 10 , 0 n 100 ; axis([0,100,-1,1])
  2. T s = 1 / 3 , 0 n 30 ; axis([0,30,-1,1])
  3. T s = 1 / 2 , 0 n 20 ; axis([0,20,-1,1])
  4. T s = 10 / 9 , 0 n 9 ; axis([0,9,-1,1])
Submit a hardcopy of the figure containing all four subplots. Discuss your results.How does the sampled version of the signal with T s = 1 / 10 compare to those with T s = 1 / 3 , T s = 1 / 2 and T s = 10 / 9 ?

Random signals

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.

Submit your plot of the two signals “sig1” and “sig2”. Also submit your plot of the two signals “ave1” and “ave2”.Comment on how the average values changes with n . Also comment on how the average values can be usedto distinguish between random noise with different means.

2-d 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:

  1. Use the meshgrid command to generate the discrete-space 2-D signal
    f ( m , n ) = 255 | sinc ( 0 . 2 m ) sin ( 0 . 2 n ) |
    for - 50 m 50 and - 50 n 50 . See the help on meshgrid if you're unfamiliar with its usage.
  2. Use the mesh command to display the signal as a surface plot.
  3. Display the signal as an image. Use the command colormap(gray(256)) just after issuing the image command to obtain a grayscale image.Read the help on image for more information.
Hand in hardcopies of your mesh plot and image. For which applications do you thinkthe surface plot works better? When would you prefer the image?

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Purdue digital signal processing labs (ece 438). OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10593/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?

Ask