Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

© 2013 Pearson

Solution Education,
Manual for Inc., Upper Saddle to
Introduction River, NJ. All rights
Digital reserved.
Signal This publication
Processing Dickis Blandford,
protected by Copyright
John Parrand
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Chapter 4
Problem Solutions
Concept Problems
1. If a sample and hold circuit is not used in the A/D process, what kind of errors might result.
Solution
Assume and SAR converter similar to Figure 4.15. The error will be roughly proportional to the
amount of change in the signal.

2. Under what circumstances is a sample and hold circuit not necessary?


Solution
When the signal is changing by a small amount compared to the conversion time, no sample and
hold is needed. For example, if you are measuring temperature which changes a degree or so in
a matter of seconds almost any A/D will work without a sample and hold. In most cases, a flash
converter, which is very fast needs not sample and hold circuit.

3. You are asked to design a low pass filter that has 70db attenuation in the stop band. How
many bits are needed in the A/D converter?
Solution
As an approximation QSNR  6.02b  1.76
70 = 6.02b + 1.76 gives b = 11.3. So 12-bits is a minimum number.

4. Given a digital filter consisting of a sample and hold, an A/D converter, a computer, and a
D/A converter. You can observe the output with an oscilloscope and you can input sinusoids of
various frequencies. Give two ways that you could use to determine (measure) the sample rate
of the filter.
Solution
Assuming that you can bypass the anti-aliasing and anti-imaging filters you could:
First, since dc is aliased by the sampling frequency you could slowly increase the frequency of
the input sinusoids until you get an approximate dc output. This will be the approximate sample
frequency. Other aliasing frequency may also be used.
Second, you could input a sinusoid and use an oscilloscope to blow up the output signal in time
so that the stair step effect of the D/A register can be observed. Each step will be one sample
period long.

5. Suppose that a sample and hold circuit has a large amount of droop - say 10%. How would
this error on the input be manifest on the output? Consider both magnitude and phase response.
Solution
The input to the A/D is effectively moving lower as the conversion takes place. The binary
output will be in error. The number produced by the converter will be smaller than the real
number and the error should not exceed 10%.

6. Why is a sample and hold circuit not typically used with a flash converter?
Solution
Flash converters are generally fast enough that it is not necessary to hold the sample steady while
it is being converted.

Visit TestBankBell.com to get complete for all chapters


© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

7. Consider a low pass digital filter which has a sample frequency of 1,000Hz and a cut off
frequency of 200Hz. If the input is not pre-filtered, aliasing can occur when the input frequency
exceeds 500Hz. Thus an input frequency of 1,000 Hz would masquerade as dc and in input at
1,200Hz would look like an input at the cut off frequency. Why are the frequency ranges above
500Hz not useful. In other words, if we need a filter which passes 1,000Hz to 1,200Hz and stops
frequencies from 1,200Hz to 1,500Hz why is a sampling frequency of 1,000Hz not workable.
Solution
If a 1200 Hz signal is passed through a 1000 Hz sampled system the output will be 200 Hz – not
1200 Hz.

The process of under sampling – that is sampling below the frequency that produces aliasing can
be used in some circumstances. See chapter 7 section 7.8 on bandpass sampling for some
examples.

8. What is the purpose of an oversampling filter in CD player and why is it used? If there were
no oversampling filter what alternative would the designer have to achieve the same quality on
the output.
Solution
If a signal is sampled at a higher frequency there are smaller changes in amplitude between
successive samples. This lessens the restrictions on the D/A converter in that its slew rate need
not be as high. Further, if a signal is sampled at a higher frequency there are less restrictions on
the reconstruction filter.

9. In general why is D/A conversion approximately 10 time faster than A/D conversion for the
same number of bits.
Solution
Most D/A converters can be built with combinational logic where the output is a function only of
the input. For A/D converters the logic is usually sequential where the output is a function of the
input, the past inputs, and the past outputs. It is possible to build an A/D converter using only
combinational logic – this is the flash converter and these are comparable in speed to D/A
converters.

Most A/D converters, other than flash converters, have feedback and clocking signals whereas
most D/A converters do not require any feedback or clocked signals.

10. When you watch a movie you often see the wheel of vehicles moving backwards even
though the vehicle is moving forward. Explain this phenomenon in terms of aliasing. What is
being sampled and how is it aliased?
Solution
The camera which is taking the moving pictures is doing the sampling since it takes say 60
frames per second. Each picture represents a sample. If a wheel is moving at say 59.9 rotations
per second, it will appear to be moving backwards at 0.1 rotations per second. If the wheel were
moving at exactly 60 rotations per second it would appear to be standing still.
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

11. A high order anti-aliasing filter can be replaced with a lower order anti-aliasing filter if the
signal is oversampled. In this case the process of oversampling is said to change the anti-aliasing
filter from a hardware problem to a software problem. Explain why this is true.
Solution
Without the over sampling the solution in hardware is to build a better anti-aliasing filter. With
over sampling we can use a less restrictive anti-aliasing hardware filter and supplement it with a
digital filter with more rigorous requirements. The digital filter is generally done in software.

12. In the discussion of A/D converter error, four types of error were explained: Offset error,
Gain error, Differential nonlinearity error, and Integral nonlinearity error. Suppose and A/D with
a signal generator. Explain how you could measure each error by looking at the input and output
of the A/D.
Solution
Offset error – Apply zero input to the A/D. The converted number is the offset error.
Gain error – Apply full scale voltage and do a conversion. The difference between the
converted number and all ones is the gain error. If the all ones code appears before full scale is
reached the gain error is considered negative.
Differential nonlinearity error – This error is a measure of how far one code is from a
neighboring code. If an A/D is missing one code point, for example it jumps from 0001 to 0010,
it is said to have a DNL of 1 LSB. This is tedious to measure. A ramp signal is applied and
codes are recorded as well as the time at which they changed. Many A/Ds specify no missing
codes as an indication that the DNL is less than 1.
Integral nonlinearity error – This is the integral or sum of all of the differential nonlinearity
errors.

13. A sinusoid at 400 Hz is sampled at 5000 Hz. If the sinusoid is down sampled by a factor of
10 by removing 9 samples out of each set of 10, the frequency of the down sampled sinusoid will
be 100 Hz. Explain.
Solution
Down sampling by a factor of 10 produces a new sample rate of 500 Hz. The 400 Hz signal
aliases as a 100 Hz signal when sampled at 500 Hz.

14. The MATLAB® code below creates a 400 Hz sinusoid sampled at 5000 Hz and up samples it
by placing a zero between each sample. The code also plots the frequency response of the up
sampled signal (Figure E4.14). The spectrum shows the original signal at 400 Hz plus a second
signal at 4,600 Hz.
A) Explain the second signal in terms of aliasing.
B) Based on the results of part A) what will the frequency spectrum be if the signal
frequency is 200 Hz? or 2000 Hz?
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

fs = 5000;T = 1/fs;
fsig = 400;
t = 0:T:1000*T;
1
y = sin(2*pi*fsig*t);
y2 = upsample(y, 2);
t2 = 0:T/2:1000*T; 0.8

figure(1);clf;
yFFT = fft(y2); 0.6

L = length(yFFT);
k = 1:L; 0.4

yFFTmag = abs(yFFT)/max(abs(yFFT));
plot(k*2*fs/L, yFFTmag); 0.2
axis([0 fs 0 1.2]);
xlabel('frequency in Hz'); 0
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
ylable('gain'); frequency in Hz
title('FFT of signal');

Figure E4.14
MATLAB® code and spectrum of upsampled sinusoid.

Solution
A) Placing zeros between samples is up sampling by a factor of two. The original Nyquist
frequency was 2,500 Hz and 4,600 Hz is the first alias of 400 Hz. When the sample frequency is
doubled the alias now falls within the new Nyquist frequency.

B) A 200 Hz signal will have an alias at 4800 Hz and a 2000 Hz signal will have an alias at 3000
Hz.

15. The unit step response of a difference equation is given by


y ( nT ) xstep  {0.4, 1.0, 1.18, 1.09, 0.991, 0.97, 0.987, 1.003, 1.005, 1.00, 1.00, 1.00,...}
From looking at the step response alone, what can you conclude about the frequency response of
this difference equation?
Solution
After an initial transient the step function is d.c., or zero frequency. In this case the gain at 0 Hz
is 1.

16. What is wrong with the following statement of the sampling theorem?
In order to preserve information in a sampled signal the continuous time signal must be sampled
at a rate that is at least twice as high as its highest frequency.
Solution
First, no practical continuous time signal over a fixed period can be band limited. Band limiting
filters only reduce the amplitude outside of a band but they do not make it zero.
Second, the theorem states that the sampling rate must be more than twice as high as the highest
frequency – not equal to or greater than the highest frequency.

17. A spinning wheel has a single radial line painted on its face which goes from the wheel's
center to the perimeter. The wheel appears to be not moving when it is illuminated by a strobe
light that is flashing at 100 times per minute. What can you conclude about the rate at which the
wheel is rotating?
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Solution
The wheel is moving at 100N times per minute where N = 1, 2, 3, … All of these values are
aliasing 0 and the wheel appears to be standing still.

Analysis and Design Problems


4.1 A sinusoid at 1000 Hz is sampled at 44100 Hz. What are the frequency values of the first
three aliases for this signal?
Solution
For a signal at frequency fsig sampled at fs, the aliases are at f s  f sig , 2 f s  f sig , 3 f s  f sig , …
For this signal the first three aliases are at 43100Hz, 45100Hz, and at 87200 Hz

4.2 A signal is sampled and passed through an A/D, filtered, and passed through a D/A
converter. There is no anti-aliasing or anti-imaging filter. You can observe the input and output
with an oscilloscope and you find the first two frequencies which alias as f0 are at f1 and f2. What
are the relationships between f0, f1, f2, and fs?
Solution
f1  fs  f 0 and f 2  f s  f 0

4.3 Two signals x1(t) and x2(t) are both band limited to fs/2 and can be sampled at fs. Find the
minimum sample frequency for A) x1(kt) where k is a positive integer. B) x1(t/k). C)
x1  t  * x2  t  where * is the convolution operator.
Solution
A) kfs
B) fs/k
C) fs

4.4 What is the Nyquist frequency for the following signal:


f (t )  4 sin(200t   / 6)  3.2 cos(300t   / 6)
Solution
2πf0 = 300π.
f0 = 150 Hz.
Therefore the lowest sample frequency is 300 Hz and the lowest Nyquist frequency is 150 Hz.

4.5 A sampler, A/D, and D/A are connected together so that the output is a sampled version of
the input. The sampling frequency is set to 1000 Hz. Take the input to be the continuous signal
x(t) = sin(200πt). The output will by y(nT) = sin(200πnT) where T is the sampling period. Find
two other continuous time input signals that will produce an identical output.
Solution
2πf0 = 200π.
f0 = 100 Hz which will be alised at 1000 ±100 = 900 Hz and 1100 Hz
y1(nT) = sin(1800πnT) and y2(nT) = sin(2200πnT)

4.6 In Chapter 3 we wrote the Fourier series for a square wave with a 50% duty cycle and a
frequency of f0 as
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

N
4
f (kT )   k sin(2f kT )
k 1
0

k odd

Write the Nyquist frequency for this square wave as a function of N.


Solution
If N is odd the Nyquist frequency is Nf0.
If N is even the Nyquist frequency is (N-1)f0.

4.7 An 800Hz signal was sampled at 1000 Hz and the output was applied to a D/A converter.
What is the fundamental frequency of the output. How many samples would appear in the
output per cycle?
Solution
1000 – 800 = 200 Hz. The signal will appear as a 200 Hz sinusoid with 5 samples per cycle.

4.8 For a sample rate of 1000 Hz calculate the maximum voltage difference between successive
samples for an input sinusoid of frequency A) 50Hz, B) 0.001Hz. For low input frequencies
(relative to the sample rate) what are the implications for the number of significant digits.
Solution
A) The maximum slope of a sine wave occurs at 0, π, 2π, …If we sample at 1000 Hz, we could
have a sample at -.0005 seconds and another +.0005 seconds. For a 50 Hz sinusoid with an
amplitude of 1 the difference between samples is:
sin[100π(.0005)] - sin[-100π(.0005)] = 0.3129.
B) sin[.002π(.0005)] - sin[-.002π(.0005)] = 0.000006283
Signals that are sampled very fast need more bits to make a distinction between samples.

4.9 A signal has a frequency plot X(ω) as shown in Figure P4.9. The frequency ωs is the sample
frequency and the frequency ωB is the band limit frequency of the signal. In this figure ωB =
2ωs/3. Sketch the frequency spectrum of the sampled signal.

Figure P4.9
Find the frequency spectrum of the sampled signal.
Solution
The dark line indicates the final frequency response due to the overlapped spectra.
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

4.10 Suppose we use a 3rd order analog Butterworth filter as an anti-aliasing filter. The cutoff
frequency for the filter is 11025 Hz and the sample frequency for the system is 22050 Hz.
Suppose there is noise in the system and the noise frequency of 12127.5 Hz comes in with
amplitude 0.5. How will the system treat this noise signal?
Solution
22050 – 12127.5 = 9922.5 Hz
A low pass analog Butterworth filter of order three has a transfer function given by
1
HB( f ) 
1  ( f / f c )6
With f = 12127.5 and fc = 11025 the gain is
1
HB( f )   0.6
1  (12127.5 / 11025) 6
The signal has an amplitude of 0.5 so the Butterworth filter will reduce its amplitude to 0.6 x 0.5
= 0.3. The filter will see the signal as a sinusoid at 9922.5 Hz with an amplitude of 0.3.

4.11 In Example 4.3 we used MATLAB® to find the QSNR for a sinusoid which varied from -1
volt to +1 volt and was quantized to 10-bits. Find the QSNR for the same sinusoid if the
amplitude varies from -0.4 to +0.4 volts.
Solution
b = 10; % 10 bit A to D
fs = 22050; % Sample rate
T = 1/fs; % Sample period
f = 1000; % signal frequency
N = fs/f; %Number of samples in one period
% x is the signal - a 1KHz sin wave
% xq is the quantized signal - quantized to b bits
% Ps is the signal power. Pn is the noise power.
i = 1:N;
x = .4*sin(2*pi*f*(i-1)*T);
xq = round(x.*2^(b-1)); % truncate by rounding
xq = xq/(2^(b-1));
Ps = sum(x.^2);
Pn = sum((x - xq).^2);
Ps = Ps/N;
Pn = Pn/N;
db = 10*log10(Ps/Pn);
fprintf('The QSNR is %f \n', db);
Printed results are: The QSNR is 52.64

4.12 Modify the MATLAB® code in Example 4.3 so that the number of bits, b, is a variable that
ranges from 1 to 24. Plot the QSNR vs b.
Solution
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

fs = 22050; % Sample rate 140


QSNR vs number of bits

T = 1/fs; % Sample period


f = 1000; 120

Q = zeros(1, length(f));
100
b = 1:20;
for i = 1:20 80

QSNR
N = fs/f; %Samples in one period
60
j = 1:N;
x = sin(2*pi*f*(j-1)*T); 40

xq = round(x.*2^(b(i)-1));
20
xq = xq/(2^(b(i)-1));
Ps = sum(x.^2); 0
0 2 4 6 8 10 12 14 16 18 20
Pn = sum((x - xq).^2); bits

Ps = Ps/N;
Pn = Pn/N;
db = 10*log10(Ps/Pn);
Q(i) = db;
end
figure(1);clf;
plot(b, Q);
title('QSNR vs number of bits');
xlabel('bits');
ylabel('QSNR');

4.13 Modify the MATLAB® code in Example 4.3 so that it can be used to determine the QSNR
for a signal given by A) x is a square wave instead of a sinusoid. The square wave should have a
base frequency of 100 Hz and should be approximated by adding the first 10 harmonics of the
Fourier series. (see the MATLAB® function called fouriersq in Appendix D). B) x is a
triangular wave instead of a sinusoid. The triangular wave should have a base frequency of 100
Hz and should be approximated by adding the first 10 harmonics of the Fourier series. (see the
MATLAB® function called fouriertri in Appendix D).
Solution
b = 10; % 10 bit A to D
fs = 22050; % Sample rate
T = 1/fs; % Sample period
f0 = 100; % signal frequency
N = fs/f0; %Number of samples in one period
i = 1:N;
%x = fouriersq(fs, N, f0, 10);
x = fouriertri(fs, N, f0, 10);
figure(1);clf;
plot((i-1)*T, x);
xq = round(x.*2^(b-1)); % truncate by rounding
xq = xq/(2^(b-1));
Ps = sum(x.^2);
Pn = sum((x - xq).^2);
Ps = Ps/N;
Pn = Pn/N;
db = 10*log10(Ps/Pn);
fprintf('The QSNR is %f \n', db);
Prints
The QSNR is 64.983396 for the square wave
The QSNR is 53.684123 for the triangular wave
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

4.14 In equation 4.4 we showed that if the input signal is a sinusoid the quantized signal to noise
ratio was given by
QSNR  6.02b  1.76
If the input is not a sinusoid, we must take the value of   xmax / 2b . We can then write
QSNR  10 log10 [ Ps2 /( / 12) 2 ]
Show that this reduces to
QSNR  6.02b  10.81  20 log10 ( xmax / Ps )
Solution
2 2
 Ps   12  2 Ps 
b
   
  / 12   xmax 
QSNR  10 log10 (12  2b Ps / xmax ) 2
QSNR  20 log10 (12)  20 log10 (2)  20 log10 ( Ps / xmax )
QSNR  6.02b  10.81  20 log10 ( xmax / Ps )

4.15 We want to construct a 10-bit A/D converter using the SAR architecture shown in Figure
4.15. The 10-bit D/A converter requires 1 µsecond to complete a conversion and the control
logic in the feedback path can produce the next guess in 50 nsec.
A) Estimate the time required for a 10-bit conversion.
B) Suppose we only need 8-bits instead of 10. Does this require the same amount of time
for a conversion? If not, how much time would be required for an 8-bit result?
Solution
A) For a 10-bit conversion we need 10 guesses. Each guess requires a conversion (1 µsec) plus
the feedback logic time (0.05µsec). This gives 10 x (1.05) = 10.5 µsec.
B) If only an 8-bit conversion is needed we need only 8 guesses and the last two can be aborted.
This shortens the time to 8 x 1.05 = 8.4 µsec.

4.16 An 8-bit A/D converter is used to input data from a temperature sensor which has an
accuracy of 3% and a range of 0 volts to 8 volts. The A/D converter has a full scale dynamic
range of 0 to 10 volts. What is the accuracy of the digital signal coming from the A/D converter
if the quantization error is taken into consideration.
Solution
The temperature signal is good to ±3% over 8 volts which corresponds to ± 0.24 volts. The A/D
converter is good to ± half a bit out of 256 bits over a 10 volt range. This corresponds to
±(10/512) = ±0.0195 volts. In the worst case these errors add to give ± 0.2595 volts.

4.17 An A/D converter has an ENOB of 13.5 bits. If the A/D is preceded by an amplifier with a
voltage error of 0.1% and a sample and hold with a voltage error of 0.3%, what is the noise level
in decibels of the A/D output if a perfect sine wave is applied to the input.
Solution
We will assume an error budget made up of the square root of the sum of the squares of the
individual errors. This error is not worst case but it is generally regarded as realistic.
Error  a 2  s 2  ( A / D Error ) 2  0.0012  0.0032  ( A / D Error ) 2
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

The A/D is good to half a bit


(A/D Error) = 2 / 2 ENOB  2 / 213.5  1.726 x10 4
Error  0.0012  0.0032  (1.726 x104 )2  0.0032
10log10(0.0032) = -49.89db

4.18 An A/D converter is to be chosen for a sensor which puts out a voltage signal in the range
of 0 to 10 volts with only ±3% accuracy. What is the minimum number of bits needed in the
A/D converter so as not to make the total error greater than ±3.1% in the worst case.
Solution
Assume that the temperature sensor puts out a voltage of 0 to 10 volts so that it is matched to the
A/D converter. If the A/D is good to ± half a bit then for a b-bit converter we need
(1/2)/2b < 0.001. This gives 2b > 500 or b = 9.

4.19 A sensor puts out a voltage in the range of 0 to 5 volts. A 10-bit A/D converter is used with
an input voltage range of –10 to +10 volts. If the A/D converter is replaced with a b-bit
converter that has an input voltage range of 0 to 5 volts what value of b will give the same or
better accuracy as the 10-bit converter.

Solution
For the 10-bit converter the distance between bits in terms of voltage is 20 volts/210 = 0.0195
volts. We want
5/2b ≥ 0.0195.
This give 2b ≥ 256.41. b is approximately 8-bits

4.20 A system is sampled at 22050 Hz. What will be the stop band and pass band frequency
edges for the analog filter if we use 2 times oversampling? What will the edges be if we use 4
times oversampling?
Solution
Without oversampling we need a high order analog filter with a sharp cutoff at fs/2. With 2x
oversampling the analog filter could have a pass band from 0 to fs/2 and a stop band from fs to
infinity. With 4x over sampling we need a pass band from 0 to fs/2 and a stop band from 2fs to
infinity.

4.21 Oversampling reduces the constraints on the analog anti-aliasing filter but it does not
eliminate the need for this filter. If the ripple in the pass band for the anti-aliasing filter is ±Rpa
and the ripple for the pass band of the digital anti-aliasing filter is ±Rpd what is the ripple in the
effective anti-aliasing filter which is combination of these two..
Solution
The pass band gain of the two filters multiplies. The ripple will range from :
[1 - (1 – Rpa)(1 – Rpd)] to [(1 + Rpa)(1 + Rpd) -1] ≈ Rpa + Rpd.

4.22 Jitter in an A/D converter clock produces noise which is proportional to the amplitude of the
jitter and to the slope of the signal (frequency).
A) To illustrate this relationship between jitter amplitude and noise in MATLAB®, let the
sample frequency, sample period, and ideal signal be
fs = 11025;T = 1/fs;
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

t = 0:T:0.01;
fsig = 1000;
gIdeal = sin(2*pi*fsig*t);
To add jitter create a random variable r with amplitude k and add it to t like this:
r = k*(rand(size(t) - .5)*T;
g = sin(2*pi*fsig*(t+r));
Plot the jitter noise vs values of k where k varies from 0 to 1. Take the jitter noise as being
proportional to the rms value of the difference between the signal gIdeal and g.

B) Repeat part A but this time set k = 0.5 and vary the frequency of the input signal from 100
Hz to fs/2.
Solution
A)
fs = 11025;T = 1/fs; Jitter noise
2.5
fsig = 1000;Tsig = 1/fsig;
t = 0:T:10*Tsig;
r = rand(size(t)); 2
k = 0:.05:1;
s = zeros(1, length(k));
for i = 1:length(k) 1.5
r = k(i)*(r - .5)*T;
noise

gIdeal = sin(2*pi*fsig*t);
g = sin(2*pi*fsig*(t+r)); 1

n = (gIdeal - g).^2;
s(i) = (sum(n))^.5;
0.5
end
figure(1);clf;
plot(k, s); 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
title('Jitter noise'); k
xlabel('k');
ylabel('noise');

B)
fs = 11025;T = 1/fs; Jitter noise
6
fsig = 1000;Tsig = 1/fsig;
t = 0:T:10*Tsig;
r = rand(size(t)); 5

k = .5;
f = 100:100:5000; 4

s = zeros(1, length(f));
noise

for i = 1:length(f) 3
r = k*(r - .5)*T;
gIdeal = sin(2*pi*f(i)*t); 2
g = sin(2*pi*f(i)*(t+r));
n = (gIdeal - g).^2; 1
s(i) = (sum(n))^.5;
end
0
figure(2);clf; 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Frequency in Hz
plot(f, s);
title('Jitter noise');
xlabel('Frequency in Hz');
ylabel('noise');
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

4.23 As in Problem 4.22, create a sinusoid with jitter where the jitter amplitude k = 0.1, the
signal frequency is fs/4 and the sample frequency fs = 11025. Use a time vector such that the
sinusoid has at least 100 cycles. Plot the spectrum of the result as decibels vs frequency from 0
to fs/2.
Solution
fs = 11025;T = 1/fs; jitter
0
fsig = 2500;Tsig = 1/fsig;
figure(1);clf; -10
t = 0:T:.1;
r = rand(size(t)); -20
r = (r - .5)*T;
r = r*.1; -30

db gain
g = sin(2*pi*fsig*(t+r));
ft = fft(g)/length(g); -40
db = 20*log10(abs(ft));
k = 1:length(t); -50

plot(k*fs/length(t), db);
-60
axis([0 fs/2 -70 0]);
title('jitter');
-70
xlabel('frequency in Hz'); 0 1000 2000 3000 4000 5000
frequency in Hz
ylabel('db gain');

4.24 A sigma-delta A/D converter in Figure 4.20 can be simplified to the diagram shown in
Figure P4.24 where the integrator has been replaced with a system that approximates integration
using the addition of rectangles of width T. For this problem we want to use MATLAB® to
simulate the converter and produce the modulated output signal y1(t) if the input is a sinusoid.

Figure P4.24
This version of the sigma-delta converter uses rectangular integration as an approximation for
the integrator.

A) Verify that the integrator between nodes 1 and 2 represent an approximation to integration
by summing rectangles.

B) The signal at node 1 is n1 = x – y1. Write the equation of the signal at node 2 in terms of
x and y1 as a difference equation.

C) In MATLAB® create an input vector x which is a sinusoid at frequency 100 Hz sampled


at fs = 44100 Hz. You should have at least a tenth of second of sampled input data.
Write an iterative loop that finds the output vector y1 in terms of the input vector y. Plot
this output vector against time.
Solution
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

A)

If we take the variable y to represent the integral we can write:


nT ( n 1)T nT
y (nT )  
0
f (t )  dt  
0
f (t )  dt   f (t )  dt
( n 1)T

which can be written as


nT
y (nT )  y ([n  1]T )  
( n 1)T
f (t )  dt

If we approximate the integral with the area under the rectangle this equation becomes
y(nT )  y([n  1]T )  Tf (nT )
Take the z-transform to get the transfer function as
y ( z ) / f ( z )  Tz /( z  1)
Which is the same as the transfer function between nodes 1 and 2.

B) At node 2 we can write


fn2 = [x(n)-y1(n)]T + fn2(n-1)

C)
fs = 44100;T = 1/fs; Sigma-Delta simulation
fsig = 100;
t = 0:T:.2; 1
x = sin(2*pi*fsig*t);
n2 = 0; 0.8
y = zeros(1, length(t)); 0.6
error = zeros(1, length(t));
0.4
for n = 2:length(t)-1
error(n) = x(n) - y(n); 0.2
voltage

n2 = T*(x(n) - y(n)) + n2; 0


y(n+1) = 1;
-0.2
if(n2 <= 0)
y(n+1) = -1; -0.4
end -0.6
end
figure(1);clf; -0.8
plot(t, y); -1
hold on;
plot(t, x, 'r'); 0 0.005 0.01 0.015
axis([0 .015 -1.2 1.2]); time in seconds
title('Sigma-Delta
simulation');
xlabel('time in seconds');
ylabel('voltage');
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

4.25 In Problem 4.24 the integrator for the sigma delta converter was approximated using
rectangular integration. We can also approximate an integrator using trapezoids as we did when
we developed the BLT. In this case the transfer function for the integrator is given by
T z 1
H I ( z)  
2 z 1
Find the difference equation for the trapezoidal integrator and use it to repeat part C of
Problem 4.24.
Solution
For trapezoidal integration the difference equation is
y(n) = y(n-1) + (T/2)[x(n) + x(n-1)]
fs = 44100;T = 1/fs; Sigma-Delta simulation
fsig = 100; 1

t = 0:T:.2; 0.8
x = sin(2*pi*fsig*t);
n2 = 0; 0.6

y = zeros(1, length(t)); 0.4


error = zeros(1, length(t));
for n = 2:length(t)-1 0.2
voltage

error(n) = x(n) - y(n); 0


n2 = T*(error(n) + ...
error(n-1))/2 + n2; -0.2
y(n+1) = 1; -0.4
if(n2 <= 0)
y(n+1) = -1; -0.6
end -0.8
end
figure(1);clf; -1
0 0.005 0.01 0.015 0.02
plot(t, y); time in seconds
hold on;
plot(t, x, 'r');
axis([0 .015 -1.2 1.2]);
title('Sigma-Delta simulation');
xlabel('time in seconds');
ylabel('voltage');
axis([0 .02 -1 1]);

4.26 The successive approximation register A/D conversion technique shown in Figure 4.15.
Assuming an n-bit number with bn-1 being the most significant bit we can simulate the SAR
algorithm with the following pseudocode:
Set n = number of bits
k = n – 1
initialize input;
set guess to 0
while(k >= 0)
guess = guess + 2k
if(guess > in)
guess = guess – 2k
end
k = k - 1;
end
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Implement this code using MATLAB® and plot the value of guess against the counter k when the
input is 1023 and n = 10 bits.
Solution
n = 10; %10 bits 1200
Guess value vs Guess number for SAR

k = 9; %n-1
in = 1023; 1000
guess = 0;
saveGuess = zeros(1,k); 800
saveGuess(k) = guess;

Guess value
while(k >= 0) 600
guess = guess + 2^k;
if(guess > in) 400

guess = guess - 2^k;


end 200

k = k - 1;
if(k > 0) 0
1 2 3 4 5 6 7 8 9
saveGuess(k) = guess; Guess number

end
end
figure(1);clf;
i = 9:-1:1;
plot(i, saveGuess);
title('Guess value vs Guess number for
SAR');
xlabel('Guess number');
ylabel('Guess value');

4.27 It is possible to combine two flash converters together to double the number of bits
converted as shown in Figure P4.27. This scheme is not without problems of its own. What is
the accuracy of the 4-bit D/A converter and analog subtractor if the accuracy of the 8-bit result is
to the nearest half bit.

Figure P4.27
Two 4-bit flash converters are ganged together to form an 8-bit converter.
Solution
For the sake of mostly round numbers that we can do in our head consider that we have a 256
volt system so that the 8 output bits give us a number good to the nearest half volt. For a 4-bit
D/A we would normally expect 16 ouput levels for the 256 volt system and each bit would be
good to the nearest 8 volts. In this case the 4-bit D/A, analog subtractor and final 4-bit flash
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

converter need to be accurate to the nearest half volt. The 4-bit D/A therefore needs to have 16
times the accuracy than we would expect – nearest 1/2 volt instead of the nearest 8 volts.
4.28 Adding a register to the output of a D/A converter to hold each sample until the next one
appears creates a stair step output function. Write the transfer function for such a device and
determine its frequency response. Plot the magnitude as a function of frequency.
Solution
The impulse response for the hold register is shown in the figure. This can be written as
h(t) = u(t) – u(t – T) which has a LaPlace transform of
1  e  jT
H ( s) 
s

The following code in MATLAB® plots the frequency response.


fs = 1;T = 1/fs;
f = .01:.1:3*fs;
w = 2*pi*f;
H = (1 - exp(-j*w*T))./(j*w);
figure(1);clf;
H = abs(H)/max(abs(H));
plot(f, H);
hold on;
xlabel('Frequency');
ylabel('Normalized magnitude');
title('Response of the D/A and hold
register');
axis([0 3*fs 0 1.2]);

4.29 A D/A with a hold register on the output effectively passes the output signal through a low
pass filter whose frequency response is shown in Figure P4.29. If the ideal low pass filter has a
gain of unity in the range 0  fs/2 and a gain of 0 elsewhere, sketch the frequency response of a
compensating filter which, when used in conjunction with the hold register, will produce an ideal
response.
© 2013 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This publication is protected by Copyright and
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Figure P4.29
Frequency response function for a register and D/A converter which produces a stair step output.
Solution
fs = 1;T = 1/fs; Response of the D/A and hold register

f = .01:.1:3*fs; 1.6

w = 2*pi*f; Compensating filter


1.4
H = (1 - exp(-j*w*T))./(j*w);
Ideal = ones(1, length(H)); Normalized magnitude 1.2

figure(1);clf; 1
H = abs(H)/max(abs(H));
0.8
plot(f, H);
hold on; 0.6 Hold register response

Hc = Ideal./abs(H); 0.4
plot(f, Hc);
0.2
xlabel('Frequency');
ylabel('Normalized magnitude'); 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
title('Response of the D/A and hold Frequency

register');
axis([0 fs/2 0 1.7]);

4.30 Suppose a 10-bit A/D converter accepts input signals in the range of -3 volts to +3 volts and
converts -3 volts to 00 0000 0000 in binary. What binary number will the A/D produce if the
input is 0.514 volts. Find the quantization error for this voltage.
Solution
3  0.514 x

6 1024
x  599.7227
The nearest integer is 600 = 10 0101 1000

4.31 Suppose that two identical low pass filters which have the frequency response shown in the
Figure P4.31 are connected together in series. Find the steady state output if a sinusoid of
amplitude 3.0 and frequency 250 Hz is applied to the input of the first filter.
© 2013 Pearson
Solution Education,
Manual for Inc., Upper Saddle to
Introduction River, NJ. All rights
Digital reserved.
Signal This publication
Processing Dickis Blandford,
protected by Copyright
John Parrand
written permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information
regarding permission(s), write to: Rights and Permissions Department, Pearson Education, Inc., Upper Saddle River, NJ 07458.

Figure P4.31
Gain vs. frequency for a low pass filter.

Solution
At 250 Hz the gain is 0.05. The total gain passing through two such filters in series will be 0.052
= 0.0025. The initial amplitude is 3.0. The output will be a sinusoid with an amplitude of 3.0 x
0.0025 = 0.0075.

Visit TestBankBell.com to get complete for all chapters

You might also like