Gary Hecht Nyquist Sampling Theorem Homework #1 Answers 1. Assume a 2 kHz sinusoid is multiplied by a 20 kHz sinusoid. What sinusoid(s) will be present in the result? (2 kHz sinusoid) • (20 kHz sinusoid) = 18 kHz sinusoid and 22 kHz sinusoid (Difference (Sum frequency) frequency) 2. Assume a 1.0 volt DC signal is added to the 20 kHz sinusoid in problem 1 (before the multiplication process). What sinusoid(s) will be present in the result? [2 kHz sinusoid] • [1 volt (DC) + 20 kHz sinusoid] = (2 kHz sinusoid) • (1 volt (DC)) + (2 kHz sinusoid) • (20 kHz sinusoid) = (2 kHz sinusoid) + (18 kHz sinusoid) + (22 kHz sinusoid) 3. Assume a 3 kHz squarewave is applied to an ideal low-pass filter with a ‘cutoff’ frequency of 2 kHz. Sketch the waveform that will appear on the output of the low-pass filter. (Output = 0v since all sinusoids of the squarewave are rejected by the low-pass filter) ────────────────────────────────────────► 4. Assume a 3 kHz squarewave is applied to an ideal low-pass filter with a ‘cutoff’ frequency of 4 kHz. Sketch the waveform that will appear on the output of the low-pass filter. (Output = 3 kHz sinusoid since only the first harmonic (sinusoid) of the squarewave passes through the low-pass filter) ────────────────────────────────────────► 5. Assume a 3 kHz squarewave is applied to an ideal low-pass filter with a ‘cutoff’ frequency of 10 kHz. Sketch the approximate waveform that will appear on the output of the low-pass filter. Only the first harmonic (3 kHz) and the third harmonic (9 kHz) (sinusoids) of the square wave will pass through the low-pass filter creating a “rippling” square wave on the output (the tops ────────────────────────────────────────► and bottoms of the square wave will not be flat (they will have ripples) and the ‘sides’ will not be perfectly vertical) 2 6. Assume a signal consists of three simultaneously present sinusoids at frequencies of 3 kHz, 7 kHz, and 11 kHz. Further assume that this signal is to be sampled. According to the Nyquist Sampling Theorem, what is the minimum (lowest) sampling frequency that will allow these three sinusoids to be correctly ‘reconstructed’ from the samples (i.e., from the ‘Sampled Signal’)? fS (min) = 2•(Highest frequency sinusoid) = 2•(11 kHz) = 22 kHz Minimum sampling frequency = fS (min) = ___22___ kHz 7. Assume a signal consists of two simultaneously present sinusoids at frequencies of 5 kHz and 8 kHz. Also assume that this signal is sampled at a rate of 20,000 samples per second (fS = 20 kHz). The ‘Sampled Signal’ (the signal created by the sampling process) will have numerous sinusoids including sinusoids at frequencies of 5 kHz and 8 kHz (the original information). Determine the specific frequency of the first sinusoid, in the ‘Sampled Signal’, that has a frequency above 8 kHz. To determine the answer to this question, you may need to review the specifics of how the sampling process creates various sinusoids. Sampled Signal Sampled Signal Sampled Signal Sampled Signal = = = = [5 kHz + 8 kHz]•[(DC offset) + fS + 2•fS + 3•fS +…] [5 kHz + 8 kHz]•[(DC offset) + 20 kHz + 2•(20 kHz) + 3•(20 kHz)…] 5 kHz + 8 kHz + (20 – 5)kHz + (20 + 5)kHz + (20 – 8)kHz + (20 + 8)kHz… 5 kHz + 8 kHz + (15)kHz + (25)kHz + (12)kHz + (28)kHz… First sinusoidal frequency above 8 kHz in the ‘Sampled Signal’ = ___12___ kHz 8. Assume a perfect 3 kHz squarewave signal is to be sampled. According to the Nyquist Sampling Theorem, at what frequency would the squarewave need to be sampled such that the squarewave can be perfectly ‘reconstructed’ from the samples? fS (min) = 2•(Highest frequency sinusoid) = 2•(∞ kHz) = ∞ kHz Required Sampling frequency = fS = ____∞____ kHz 9. Assume a perfect 5 kHz squarewave (with 50% duty cycle) signal is to be sampled. Assume that you will be satisfied if only the first three sinusoids that describe the squarewave are correctly ‘reconstructed’ from the ‘Samples Signal’. According to the Nyquist Sampling Theorem, what is the minimum sampling frequency that will meet the desired goal of correctly reconstructing the first three sinusoids that express the squarewave? 5 kHz squarewave = 5 kHz sinusoid + 3•(5 kHz sinusoid) + 5•(5 kHz sinusoid) +… 5 kHz squarewave = 5 kHz sinusoid + 15 kHz sinusoid + 25 kHz sinusoid +… fS (min) = 2•(Highest frequency sinusoid) = 2•(25 kHz) = 50 kHz Required Sampling frequency = fS = ___50___ kHz 10. Assume a 5kHz sinusoid is sampled by a sampling system with a sampling frequency of 8 kHz. What are the frequencies of the first two sinusoids in the ‘Sampled Signal’? Sampled Signal = [5 kHz]•[(DC offset) + fS + 2•fS + 3•fS +…] Sampled Signal = [5 kHz]•[(DC offset) + 8 kHz + 2•(8 kHz) + 3•(8 kHz)…] Sampled Signal = 5 kHz + (8 – 5)kHz + (8 + 5)kHz +… Sampled Signal = 5 kHz + 3kHz + 13kHz +… [Note: The 3 kHz sinusoid is an ‘alias’ of the 5 kHz sinusoid] First two sinusoidal frequencies in the ‘Sampled Signal’ = ____3____ kHz and ____5____ kHz Gary Hecht Nyquist Sampling Theorem Homework #2 Answers 1. Most sampling systems use a sampling rate that is somewhat higher than the minimum required for sampling the signal (fS (min) = 2•(Highest frequency sinusoid in the signal to be sampled)). This is done because the real-world low-pass filters that are used for the anti-aliasing and reconstruction filters in a sampling system have noticeably non-ideal characteristics (especially near their cutoff frequencies). When a sampling system uses a sampling rate that is higher than the minimum required, some amount of so-called ‘guardband’ is created. The amount of guardband is calculated as the difference between the actual sampling frequency and the minimum required sampling frequency: Guardband = Sampling frequency (actual) – Minimum required sampling frequency Sampling frequency (actual) = Minimum required sampling frequency + Guardband Sampling frequency = fS = 2•(Highest frequency sinusoid in the signal to be sampled) + Guardband Assume a signal consists of three simultaneously present sinusoids at frequencies of 3 kHz, 7 kHz, and 11 kHz. Further assume that this signal is to be sampled by a sampling system that has 5 kHz of guardband. What is the required sampling frequency that will allow these three sinusoids to be correctly ‘reconstructed’ from the samples with a guardband of 5 kHz? fS = 2•(Highest frequency sinusoid) + Guardband = 2•(11 kHz) + 5 kHz = 27 kHz Sampling frequency = fS = ____27____ kHz 2. Land-line telephone service (known as POTS (plain-old telephone service)) samples each call at a rate of 8,000 samples per second (in each direction) where each sample is converted into an 8-bit digital value by an ADC (analog-to-digital converter) and then transferred through the telephone system as a digital value. At the receiving end for a call, each sample is converted back into an analog voltage by a DAC (digital-to-analog converter) and then sent to the speaker in the handset. For POTS, what is the telephone company’s internal (digital) ‘data rate’ (in bits per second) for each direction of a call? Note: ‘Data rate’ is also known as ‘bandwidth’. Data rate = (8,000 samples/second)•(8 bits/sample) = 64,000 bits/second Data rate (or bandwidth) for POTS (each direction) = ___64,000___ bits per second CDs have a sampling rate of 44,100 samples per second where each sample consists of 16 bits. Also, CDs have two independent ‘channels’ (allowing for stereo) and, as such, there are two samples stored on the CD for each 1/44,100 of a second. How many times larger is the total data rate for CDs as compared to POTS (one direction)? CD data rate = (44,100 samples/sec)•(16 bits/sample)•(2 channels) = 1,411,200 bits/sec Data Rate Ratio = (1,411,200 bits/sec) / (64,000 bits/sec) = 22.05 The CD data rate is ___22.05___ times larger than the data rate for POTS 3. Assume it is desired to build a sampling system that samples an analog signal, digitizes the samples, stores the digitized samples, and later plays back the digitized samples so as to recreate the original analog signal. The sampling system is to have the following general characteristics: Sampling rate = 12,000 samples/sec (fS = 12,000 Hz) Cutoff frequency (fc) for the anti-aliasing and reconstruction filters = 5 kHz (assume no sinusoids above 5 kHz get through the low-pass filters) Resolution per sample = 8 bits Questions: a. How much ‘guardband’ exists in the sampling system? Guardband = fs – 2•fc = 12 kHz – 2•(5 kHz) = 12 kHz – 10 kHz = 2 kHz b. What is the ‘data rate’ (or ‘bandwidth’) of the sampled signal (in bits per second)? Bandwidth = (12,000 samples/sec)•(8 bits/sample) = 96,000 bits/sec c. Assume the anti-aliasing and reconstruction filters each use a 0.2 μF capacitor. What value should be used for the resistor in these filters? Note: fc = 1/(2πRC) R = 1/[2π fc C] = 1/[2π(5•10+3)•(0.2•10-6)] = 0.159•10+3 = 159 ohms d. If you wanted to store 5 minutes worth of samples, how many bits would need to be stored? Eight bits are known as a ‘byte’ (i.e., 8 bits = 1 byte) – as such, how many bytes would need to be stored for 5 minutes worth of samples? 5 minutes of samples = (96,000 bits/sec)•(60 secs/min)•(5 min) = 28,800,000 bits 5 minutes of samples = (28,800,000 bits) / (8 bits/byte) = 3,600,000 bytes e. Assume the analog signal that is being sampled has a voltage range of –5v to +5v. This analog signal, after being sampled, has each sample ‘digitized’ by an ADC (analog-to-digital converter) that outputs an 8-bit numerical value for the voltage of each sample. Typically the digital value of all 0’s corresponds to the lowest voltage possible for the analog signal (0000 0000 = –5v for this example). And, typically, the maximum digital value, plus 1, corresponds to the highest voltage possible for the analog signal (1 0000 0000 (9 bits!) = +5v for this example). Assume the ADC divides the analog voltage range into evenly spaced ‘steps’ such that any analog voltage within a given ‘step’ is assigned the same unique digital value. For this example, how much voltage is there per step (known as the ‘step voltage’)? 0000 0000 (010) through 1 0000 0000 (25610) are 257 different numbers creating 256 steps Step voltage = (Voltage range) / (Number of steps) = (10 volts) / (256 steps) = 39.1 mV Gary Hecht Nyquist Sampling Theorem Homework #3 Answers Assume it is desired to build a sampling system that samples an analog signal, digitizes the samples, stores the digitized samples, and later plays back the digitized samples so as to re-create the original analog signal. The sampling system is to have the following general characteristics: Sampling rate = 10,000 samples/sec Guardband = 2 kHz Resolution per sample = 8 bits Questions: a. The anti-aliasing and reconstruction filters should be designed for what ‘cutoff’ frequency? Guardband = fs – 2•fc so fc = [fs – Guardband]/2 fc = [fs – Guardband] / 2 = [10 kHz – 2 kHz] / 2 = 4 kHz b. What is the ‘data rate’ (or ‘bandwidth’) of the sampled signal? Bandwidth = (10,000 samples/sec)•(8 bits/sample) = 80,000 bits/sec c. Assume the anti-aliasing and reconstruction filters each use a 0.2 μF capacitor. What value should be used for the resistor in these filters? Note: fc = 1/(2πRC) R = 1/[2π fc C] = 1/[2π(4•10+3)•(0.2•10-6)] = 0.199•10+3 = 199 ohms Further assume that 16 Mbit (total storage) memory ICs are used to store the samples where each 16 Mbit memory IC is "organized" "by 8" (i.e., 8 bits per memory location). Note: Total storage of a memory IC (in bits) = (Number of locations)•(Number of bits per location) d. How many samples can be stored in one 16 Mbit memory IC (“organized” “by 8”)? (Note that one sample can be stored in each memory location of a “by 8” memory IC since our samples consist of 8 bits per sample) 16 Mbits = (N locations)•(8 bits/location) so N = [16 Mbits] / [8 bits/location] = 2M locations and, therefore, 2M samples can be stored in one 16 Mbit memory IC 20 Note: 1 M = 2 = 1,048,576 e. How many 16 Mbit memory ICs are required to store one hour's worth of samples? Number of samples in 1 hour = (10,000 samples/sec)•(60 sec/min)•(60 min/hour) Number of samples in 1 hour = 36,000,000 samples Number of ICs = (36,000,000 samples) / (2•1,048,576 samples/IC) = 17.2 ICs So, 18 ICs would be needed