University of Kentucky s6

Total Page:16

File Type:pdf, Size:1020Kb

University of Kentucky s6

University of Kentucky

EE 422G - Signals and Systems Laboratory

Lab 1 Sampling and Aliasing Objectives:  Use LabVIEW program to examine programming elements and observe effects of sampling and quantization.  Use Matlab to examine relationship between quantization bits and signal to noise ratios (SNR).

1. Back ground In this lab you will study the relationship between discrete-time and continuous-time signals by examining sampling and aliasing. A digital system cannot directly work on continuous-time signals. Discrete time signals can however be constructed by sampling continuous time signals.

The mathematical representation of the sampling of a continuous time waveform is given by:

Figure 1 where s(t) is the sampling signal in the time domain. The impulses are separated by time 2 T, or they occur at a frequency of   2F  . s s T s(t)

t -3T -2T -T 0 T 2T 3T Figure 2

Fourier Transform of s(t). Note that the Fourier Transform of a pulse train is a pulse train.

Figure 3

Fourier Transform of xc(t). xc(t) is bandlimited to  N , i.e. X c  j  0 for    N

Figure 4

For an LTI system, convolution in the time domain is multiplication in the frequency domain:

o s  2 N

Figure 5

o  s  2 N : In this case aliasing occurs and original signal cannot be recovered.

Figure 6

  For   2 and   S , x (t) can be exactly recovered with ideal low-pass s N C 2 c filtering.

Figure 7

2. Prelab

1. Sample continuous-time signal x(t) using ideal impulse sampling with sampling period Ts to obtain xs(t).  ˆ ˆ ˆ (a) Show that the Fourier transform xs(t) is X s ( f )  f s  X ( f  nf s ) where X ( f ) is the n 1 Fourier transform of x(t), and f s  . Ts b) Use the result of problem 1a) to sketch the magnitude of the spectrum of the sampled ˆ signal (i.e., sketch X s ( f ) ) given the following Fourier transforms of the original signal (assume the sampling period is 50 msec):

Figure 8 c) Use your answer to part b) to explain the Nyquist Sampling Theorem. Then, find the minimum Nyquist sampling frequency to avoid aliasing for each signal given in part 1b).

2. Consider quantizing the signal x(t)  10cos(2t) where the dynamic range is from the minimum and maximum values of x(t). a) For one full period, sketch the results of quantizing the x(t) with a two bits. b) Compute and plot the Signal to quantization noise ratio as the number of quantization bits increase from 2 to 16.

3. Lab assignment

In this assignment, you will create a real-time demonstration of the Sampling Theorem. To do this, you will create a LabVIEW program that implements Figure 1. The T.A will provide you with a copy of ‘lab1.vi’ which will be our template for the next 2-3 labs.

1. Download lab1.vi to your Home Directory. Use program to create a pure tone for xc(t) using sine wave generation option and play it through the sound card. Do not exceed frequency of 30kHz. The LabVIEW function block “resample.vi” resamples the sine wave generated from the signal generated block, which can be created at a much higher frequency. Try a couple of rates that will result in aliasing. Indicate these rates in your lab write up and the frequencies they aliased to. In your discussion section, explain whether or not these aliased frequencies make sense. 2. Show DFTs of output waveforms (the original and resampled) on the block diagram on the front panel. Take a screen shot and save it for lab report. Do this for a case with and without aliasing of the resampled waveform. 3. Change the frequency of xc(t) to demonstrate aliasing. Play xr(t) through the sound card with and without aliasing. Describe what you hear in your results section.

For the remainder of the lab we will work with a chirp signal that can be generated using the equation option on the vi.

4. Generate the signal

Sampled at 8kHz and sweeps from 0 to 12kHz for 10 seconds. Listen to the chirp. Explain any aliasing effects your hear in the results section. Use help to determine how to use the formula bar. (Hint: w= 2*pi*f). Refer to the Supplementary help in the end.

5. Use the ‘signal analysis.vi’ to create a plot of the magnitude of the DFT of the chirp signal from the previous part over the frequency range 0 kHz to 4 kHz. Make sure the horizontal axis of your plot is labeled in Hertz and take a screen shot of the waveform to include in the results section of your report. In your discussion section described how the plot does or does not look like a sensible frequency-domain representation of this chirp?

6. Generate a chirp that is sampled at 8 kHz and sweeps from a frequency of 0 kHz to 4kHz. Listen to the resulting sound. Describe what you hear in the results section, indicate if aliasing artifacts could be heard. In the discussion section, describe how this does and does not make sense.

7. Use the ‘signal analysis.vi’ to create a plot of the DFT magnitude of the chirp signal from the previous part over the frequency range 0 Hz to 4 kHz. Make sure the horizontal axis of your plot is labeled in Hertz. Take a screen shot and include in the results section of the report. In the discussion section, explain whether or not the plot look like a sensible frequency-domain representation of this chirp.

8. Modify your chirp so that it sweeps from 0 to 5 kHz. Listen to it. Do you hear aliasing artifacts? Plot the magnitude of the DFT over 0 Hz to 4 kHz. Take a screen shot and include in the results section of the report. In the discussion section explain how aliasing affects the DFT magnitude plot.

Quantization part 1. Create a sine wave in Matlab sampled at 44.1 kHz for 5 seconds with unit amplitude and save it as a wave file with 16 bits of quantization (see help on wavwrite). 2. Use the Matlab script template file ‘quant.m’ load the wave file just saved and quantize the signal using “R” bits ranging from 2 to 16. Observe the change in sound quality. Describe what you hear in the results section and indicate at what bit resolution and corresponding SNR the quantization effects become audible. Describe the audible effects in the sound file at various bit-resolution levels. 3. Plot the power spectral densities (PSDs) of the original and requantized waveforms on the same graph (in dB). Do this for quantization levels corresponding to 8, 4, and 2 bits. Useful Matlab commands for this are pwelch, semilogx, and hold. Discuss if the changes agree with the table constructed in problem 2b of the prelab assignment. Supplementary help on chirp

A chirp looks like the signal shown in figure 9.

Figure 9

The chirp given by the equation has an instantaneous frequency of in radians per second or in Hz.

A chirp with starting frequency of fstart and sweep frequency of fend is given by the equation x(t)  sin((0.5* a *t  b) *t) where a is given by 2 ( f  f ) a  end start T

and T is the duration of the sweep in seconds, and b is given by b  2f start

Therefore the equation of a chirp with the length of 10seconds, sweeping from frequency  2f t 2   end  0 to 12kHz will have the equation x(t)  sin  , where T=10, and fend is 12kHz.  2*T 

Recommended publications