Introduction To Digital Signal Processing 1st Edition Blandford Solutions Manual
Introduction To Digital Signal Processing 1st Edition Blandford Solutions Manual
https://testbankfan.com/product/applied-digital-signal-processing-1st-
edition-manolakis-solutions-manual/
https://testbankfan.com/product/digital-signal-processing-using-
matlab-3rd-edition-schilling-solutions-manual/
https://testbankfan.com/product/digital-signal-processing-using-
matlab-a-problem-solving-companion-4th-edition-ingle-solutions-manual/
https://testbankfan.com/product/discrete-time-signal-processing-3rd-
edition-oppenheim-solutions-manual/
Wavelet Tour of Signal Processing 3rd Edition Mallat
Solutions Manual
https://testbankfan.com/product/wavelet-tour-of-signal-processing-3rd-
edition-mallat-solutions-manual/
https://testbankfan.com/product/introduction-to-digital-
communications-1st-edition-pursley-solutions-manual/
https://testbankfan.com/product/introduction-to-digital-
communications-1st-edition-grami-solutions-manual/
https://testbankfan.com/product/introduction-to-digital-
communication-2nd-edition-ziemer-solutions-manual/
https://testbankfan.com/product/digital-radiography-an-
introduction-1st-edition-seeram-test-bank/
© 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.
Chapter 7
Problems Solutions
Concept Problems
1. We down-sample a signal by deleting some samples. This obviou8sly deletes some
information. Is this information redundant? Is any information lost?
Solution
If the frequencies in the signal are less than half of the down sampled sample frequencies no
information is lost. Removing some samples therefore takes out redundant information. If
however, the frequencies in the signal are greater than or equal to half of the down sampled
sample frequency then the original signal can no longer be recovered and the information is lost.
2. When we up-sample a signal we do so by first inserting zeros between the existing samples
and follow with a low pass filter which "fills in" the zeroed sample points. Are we creating new
information? If so, does it accurately reflect the true value of the signal. Is there any difference
between say, sampling a signal which is band limited to 0 to 100 Hz at 1 KHz and sampling the
same signal at 500 Hz and using an interpolator to up-sample it to 1 KHz?
Solution
We are not creating new information when we insert zeros between samples and pass the result
through a low pass filter. We are however, changing the sample rate to make the signal
compatible with other systems. The sampling theorem tells us that if we sample a sinusoid with
at least 2 samples per cycle we have effectively captured all of its information and there is
nothing to be gained with regard to information content by sampling faster.
A sinusoid sampled at 1 KHz is the same as a sinusoid sampled at 500 Hz and up sampled to 1
KHz provided the up sampling and interpolator are ideal. Every practical interpolator adds
some small amount of distortion to a signal.
3. List the errors that may be introduced in the decimation process that are not present in a
sampled signal that is not decimated.
Solution
The errors associated with decimation are in the decimation filter which can never be ideal.
There is always some, albeit small, amount of aliasing that takes place because frequencies
above the down sampled Nyquist rate have not been completely set to zero.
4. List the errors in the interpolation process that are not present in a sampled signal that is not
interpolated.
Solution
The interpolation filter can never be ideal so that higher frequencies introduced when zeros are
inserted between samples will never be exactly set to zero and therefore alias back into the
signal.
5. Why are IIR filters inappropriate for interpolation filters even when linear phase is not a
requirement.
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.
An IIR filter has feedback so any zeros inserted into the signal can be fed back to reverberate
many times over. While this is not a problem with regard to accuracy it is a problem with regard
to efficiency since we will be multiplying by zero. With FIR filters we can alter the
implementation architecture so that we do not multiply by zero.
6. Show that for a cascade of N decimation filters each of which has a pass band ripple of Rp1,
the decimated signal will have a ripple given by R p NR p1 .
Solution
If we assume that N cascaded filters all have a pass band ripple of Rp, the pass band gain for the
cascade will be (1 – Rp)N = 1 – NRp + {terms which include higher powers of Rp}. If Rp << 1 we
can write (1 – Rp)N ≈ 1 – NRp so that R p NR p1
7. In the figure below the signal x is up sampled by U and down sampled by D to produce y1 and
it is down sampled by D followed by up sampling by U to produce y2. Sketch a 1 Hz sinusoid
that is sampled at 10 Hz. Show that if U = D = 2, y1 is not the same as y2 but if U = 3 and D =
2, y1 is the same as y2? Explain.
Solution
In the figures below MATLAB® was used to construct the plots.
© 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.
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
Upsample by 2 Downsample by 2
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
Downsample by 2 Upsample by 2
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Upsample by 3 Downsample by 2
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Downsample by 2 Upsample by 3
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
If D and U are not mutually prime, up sampling by U will introduce zeros, some of which will be
removed when the signal is down sampled by D. If, on other hand, you down sample by D first
you remove not zeros but part of the signal which has a non-zero amplitude. Up sampling then
places zeros between the samples. The two cannot be the same because down sampling first,
removes non-zero portions of the signal which are not replaced by up sampling.
If D and U are mutually prime, down sampling removes non-zero portions of the signal which
are the same in both cases.
8. In Chapter five the following equation was given as an estimate of the order of a Parks-
McClellan FIR filter. In this equation ε1 is the pass band ripple and ε2 is the stop band ripple.
The transition band width is given by Δf. And fs is the sample frequency. Use this equation to
justify down sampling a narrow band signal before applying a filter to it.
20 log10 ( 1 2 ) 13
N
14.6f / f s
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.
Making the sample frequency smaller increases the size of the denominator and reduces the
value of N. In the case of narrow band filters the value of N may to too high to implement in
real time in practice. Reducing the sample frequency, filtering, and increasing the sample
frequency is a solution.
9. Suppose you have a sinusoid at 100 Hz which is sampled at 1200 Hz. We want to up-sample
this signal by a factor of 3 to 3,600 Hz using hold interpolation. A) Estimate how the frequency
content of the signal will be altered by applying hold interpolation to the sinusoid. B) Verify
your estimates by using MATLAB® and finding the discrete Fourier transform of the two
signals.
Solution
(a) Hold interpolation will introduce higher frequency content into the signal spectrum because
of the sharp corners at each hold.
(b) The MATLAB code below shows the original signal sampled at 800 Hz, the interpolated
signal sampled at 3600 Hz, the spectrum of each. The high frequencies introduced by the hold
interpolation are circled in the last figure.
fs = 1200;T = 1/fs;
fsig = 100;
n = 0:4096;
nT = n*T;
Tmax = nT(length(nT));
x = sin(2*pi*fsig*nT);
%Hold interpolation
fsup = 3600;Tup = 1/fsup;
n1 = 0:fix(Tmax/Tup);
n1T = n1*Tup;
xup = zeros(1, length(n1T));
i = 1;j = 1;
while (i <= length(n1T) && j <= length(nT))
if(n1T(i) < nT(j))
xup(i) = x(j-1);
i = i + 1;
else
j = j + 1;
end
end
figure(1);clf;
subplot(2, 2, 1);
stem(nT, x, 'MarkerSize', 1);
title('Original signal at 800 Hz');
axis([0 .02 -1.2 1.2]);
subplot(2, 2, 3);
stem(n1T, xup, 'MarkerSize', 1);
title('Hold interpolation to 2400 Hz')
axis([0 .02 -1.2 1.2]);
%
%FFT
subplot(2, 2, 2);
xFFT = fft(x);
k = 0:length(x)-1;
xFFT = xFFT/max(abs(xFFT));
plot(k*fs/length(xFFT), abs(xFFT));
axis([0 fs/2 0 1.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.
title('Original signal');
xlabel('frequency in Hz');
ylabel('magnitude');
subplot(2, 2, 4);
xupFFT = fft(xup);
k = 0:length(xup)-1;
xupFFT = xupFFT/max(abs(xupFFT));
plot(k*3*fs/length(xupFFT), abs(xupFFT));
axis([0 3*fs/2 0 1.2]);
title('Up sampled spectrum');
xlabel('frequency in Hz');
ylabel('magnitude');
10. When we do up-sampling and down-sampling to change the sample rate by a rational factor
we do the up-sampling first and follow with the down-sampling. Would we get the same result if
we down-sample first and follow with up-sampling? Explain.
Solution
We would get the same solution if everything was ideal. The down-side to doing the down
sampling first is that we need additional filters. Down sampling first requires the following
cascade: Anti-alias filter → Down sample → Up sample → Anti-imaging filter.
By doing the Up sampling first we are able to merge the Anti-alias filter with the Anti-imaging
filter into the same filter.
© 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. Suppose you have a square wave that has been passed through an appropriate anti-aliasing
filter so that aliasing by harmonics is not a problem. What is the difficulty in up-sampling such a
signal?
Solution
A square wave is made up of a base sinusoid plus the weight sum of its odd harmonics. If the
square wave has been passed through an anti-aliasing filter then all of its harmonics beyond fs/2
have been cut off. You can up sample this wave and increase its sample frequency but up
sampling does not restore the high frequency harmonics.
(b) The MATLAB® code below shows the spectrum of the original signal and the down-sampled
version.
fs = 10000;T = 1/fs; Original signal
t = 0:T:1; 1
f1 = 1000;
magnitude
f2 = 3000; 0.5
s = sin(2*pi*f1*t) + sin(2*pi*f2*t);
figure(1);clf;
0
subplot(2, 1, 1); 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
frequency in Hz
sfft = fft(s); Original signal
k = 0:length(s)-1;
1
sfft = sfft/max(abs(sfft));
magnitude
plot(k*fs/length(s), abs(sfft));
0.5
axis([0 fs/2 0 1.2]);
title('Original signal');
0
xlabel('frequency in Hz'); 0 500 1000 1500 2000 2500
frequency in Hz
ylabel('magnitude');
%
sd = downsample(s, 2);
k = 0:length(sd)-1;
sdfft = fft(sd);
sdfft = sdfft/max(sdfft);
subplot(2, 1, 2);
plot(k*(fs/2)/length(sdfft),
abs(sdfft));
axis([0 fs/4 0 1.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.
title('Original signal');
xlabel('frequency in Hz');
ylabel('magnitude');
7.2 Given a signal that is sampled at fs = 44100 Hz which contains, among other frequencies,
some low frequency sensor data in the range 0 to 100 Hz. We want to design a decimator that
will lower the sample frequency to 11025 Hz and will introduce a ripple of 0.01 or less to the
sensor frequency band. Design the decimator. Use MATLAB® to demonstrate that your
decimator meets specifications. Note that care must be taken that frequencies in a stop band that
are aliased back into the pass band do not cause the ripple specification to be exceeded.
Solution
Since the stop band will get folded back into the pass band when the signal is down sampled, we
need a pass band and stop band ripple of 0.01/2 = 0.005. The pass band for the decimation filter
will go from 0 Hz to 100 Hz and the stop band will go from 11025 to fs/2. These specifications
can be met with a 15th order Parks McClellan filter. The MATLAB® code below designs the
filter and plots the pass and stop bands to show that specifications for ripple in these bands is
met.
fs = 44100; Low pass Parks-McClelland filter
fps = 100;
fst = 11025/2;
Rps = .005; 1
Rst = .005;
F = ([fps fst]); 0.8
M = ([1 0]);
Dev = [Rps Rst];
gain
disp(N);
N = 15; 0.4
num = firpm(N, F, A, W);
figure(1);clf;
0.2
[H f] = freqz(num, 1, 1024, fs);
H = H/max(abs(H));
plot(f, abs(H)); 0
0 0.5 1 1.5 2
axis([0 fs/2 0 1.2]); frequency in Hz
x 10
4
xlabel('frequency in Hz');
pass band
ylabel('gain'); 1.005
title('Low pass Parks-McClelland
filter');
figure(2);clf; 1
subplot(2, 1, 1);
plot(f, abs(H));
0.995
axis([0 fps 1-Rps 1+Rps]); 0 20 40 60 80 100
plot(f, abs(H)); 4
0
1 1.5 2
4
x 10
© 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.3 The Fourier series can be used to approximate a square wave from the equation:
N
4
x (t ) sin( k0t )
k 1 k
k odd
Solution
The highest frequency will be (2*terms – 1)*f0 = 900 Hz so we will get aliasing if fs < 1800 Hz.
The sample frequency is 8000 Hz. 8000/1800 = 4.44. so we need to down sample by a factor of
5 to get aliasing. The square wave is made up of sinusoids at 100 Hz, 300 Hz, 500 Hz, 700 Hz,
and 900 Hz. With a sample frequency of 1600 Hz the 900 Hz sinusoid will be aliased to 700 Hz
adding to the amplitude of the 7th harmonic.
fs = 8000;T = 1/fs; Original square wave
1
f0 = 100;
points = 4096; 0.5
voltage
terms = 5; 0
0
plot(nT, squarewave);
-0.5
title('Original square wave');
-1
xlabel('time in seconds'); 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04
ylabel('voltage'); time in seconds
7.4 Example 7.1 created a swept frequency signal that ranged from 10 Hz to 2000 Hz that was
sampled at 11025 Hz. When this signal is down-sampled by a factor of 4 the down sampled
Nyquist rate is 1378.1 Hz. Since this is lower than the highest frequency in the signal, aliasing
occurs and severely distorts the signal. Design a low pass filter which will approximately
remedy the aliasing problem. Your filter should meet the following specifications.
Sample frequency : 22050 Hz
Pass band : 0 – 1178 Hz
Stop band : 1578 Hz – fs /2
Pass band ripple : 0.02
Stop band ripple : 0.01
Pass the original signal through your filter using the MATLAB® filter function before down-
sampling by 4. Produce the following plots: (a) Original signal vs time, (b) FFT of the original
signal vs frequency (overlay this plot with a frequency plot of a Butterworth and an elliptic low
pass filter which meets the specifications, (c) the FFT of the down sampled signal (by a factor of
4), (d) the FFT of the filtered down sampled signal using the Butterworth filter, (e) the FFT of
the filtered down-sampled signal using the elliptic filter.
Solution
The following MATLAB® code produces the required filters and plots.
N = 1000;
fs = 11025;T = 1/fs;
t = 0:T:(N-1)*T;
y = chirp(t, 10, (N-1)*T, 2000);
figure(1);clf
subplot(1, 2, 1);
stem(t, y, 'MarkerSize', 1);
axis([0 .02 -1.2 1.2]);
xlabel('time in seconds');
ylabel('amplitude');
title('Chirp signal');
subplot(1, 2, 2);
yDFT = fft(y);
f = 0:fs/N:fs-fs/N;
yDFTNorm = abs(yDFT)/max(abs(yDFT));
plot(f, yDFTNorm);
axis([0 fs/2 0 1.2]);
xlabel('frequency in Hz')
ylabel('magnitude');
title('Frequency spectrum of chirp signal');
%
yDn = downsample(y, 4);
figure(2);clf;
subplot(1, 2, 1);
t1 = 0:4*T:(N-1)*T;
stem(t1, yDn, 'MarkerSize', 1);
axis([0 .02 -1.2 1.2]);
xlabel('time in seconds');
ylabel('amplitude');
title('Chirp signal down sampled by 4');
subplot(1, 2, 2);
yDDFT = fft(yDn);
f1 = 0:fs/N:fs/4-(fs/4)/N;
yDDFTNorm = abs(yDDFT)/max(abs(yDDFT));
© 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.
plot(f1, yDDFTNorm);
axis([0 fs/8 0 1.2]);
xlabel('frequency in Hz')
ylabel('magnitude');
title('Frequency spectrum of down sampled chirp signal');
%Butterworth anti-aliasing
fc = fs/8;
Rp = .02; RpDB = -20*log10(1-Rp);
Rs = .01; RsDB = -20*log10(Rs);
fpass = fs/8-300;
fstop = fs/8+400;
[Nb fc] = buttord(fpass/(fs/2), fstop/(fs/2), RpDB, RsDB);
[num den] = butter(Nb, fc);
yf = filter(num, den, y);
yfDn = downsample(yf, 4);
figure(1);
subplot(1, 2, 2)
hold on;
[H f] = freqz(num, den, 1024, fs);
plot(f, abs(H));
figure(3);clf;
subplot(1, 2, 1);
t1 = 0:4*T:(N-1)*T;
stem(t1, yfDn, 'MarkerSize', 1);
axis([0 .02 -1.2 1.2]);
xlabel('time in seconds');
ylabel('amplitude');
title('Chirp signal down sampled by 4');
subplot(1, 2, 2);
yDDFT = fft(yfDn);
f1 = 0:fs/N:fs/4-(fs/4)/N;
yDDFTNorm = abs(yDDFT)/max(abs(yDDFT));
plot(f1, yDDFTNorm);
axis([0 fs/8 0 1.2]);
xlabel('frequency in Hz')
ylabel('magnitude');
title('Frequency spectrum of down sampled chirp signal');
%Elliptic anti-aliasing
fc = fs/8;
Rp = .02; RpDB = -20*log10(1-Rp);
Rs = .01; RsDB = -20*log10(Rs);
fpass = fs/8-200;
fstop = fs/8+200;
[Ne fp] = ellipord(fpass/(fs/2), fstop/(fs/2), RpDB, RsDB);
[num den] = ellip(Ne, RpDB, RsDB, fp);
yf = filter(num, den, y);
yfDn = downsample(yf, 4);
figure(1);
subplot(1, 2, 2)
hold on;
[H f] = freqz(num, den, 1024, fs);
plot(f, abs(H));
figure(4);clf;
subplot(1, 2, 1);
t1 = 0:4*T:(N-1)*T;
stem(t1, yfDn, 'MarkerSize', 1);
axis([0 .02 -1.2 1.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.
xlabel('time in seconds');
ylabel('amplitude');
title('Chirp signal down sampled by 4');
subplot(1, 2, 2);
yDDFT = fft(yfDn);
f1 = 0:fs/N:fs/4-(fs/4)/N;
yDDFTNorm = abs(yDDFT)/max(abs(yDDFT));
plot(f1, yDDFTNorm);
axis([0 fs/8 0 1.2]);
xlabel('frequency in Hz')
ylabel('magnitude');
title('Frequency spectrum of down sampled chirp signal');
Chirp signal Spectrum of chirp signal
1.2
1
1
0.5
0.8
magnitude
amplitude
0 0.6
0.4
-0.5
0.2
-1
0
0 0.005 0.01 0.015 0.02 0 2000 4000
time in seconds frequency in Hz
Chirp down sampled by 4 Down sampled chirp spectrum
1.2
1
1
0.5
0.8
magnitude
amplitude
0 0.6
0.4
-0.5
0.2
-1
0
0 0.005 0.01 0.015 0.02 0 500 1000
time in seconds frequency in 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.
0.5
0.8
magnitude
amplitude
0 0.6
0.4
-0.5
0.2
-1
0
0 0.005 0.01 0.015 0.02 0 500 1000
time in seconds frequency in Hz
0.5
0.8
magnitude
amplitude
0 0.6
0.4
-0.5
0.2
-1
0
0 0.005 0.01 0.015 0.02 0 500 1000
time in seconds frequency in Hz
7.5 In Example 7.2, we did down-sampling by a factor of 4 and 5 and we used two low pass
filters whose pass and stop bands are shown in Figure P7.5. If the pass and stop band ripple for
these two filters are designed to be 0.01, calculate the ripple to be expected for the pass and stop
and of the final cascaded filter.
Figure P7.5
Low pass filter bands.
Solution
Since the two filters are cascaded the gains multiply. The final pass band ripple will be
© 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.6 Consider a signal with a pass band of 0 to 500 Hz which has noise from 800 Hz to 10,000Hz
and is sampled at 22050 Hz. We want to down-sample this signal by a factor of 20. To do this
down-sample first by a factor 4 followed by a factor 5. Calculate the band edges of the two low-
pass filters and use a ripple of 0.01 in both the pass and stop bands. Plot the final down-sampled
signal and show that the noise is removed and it does not have aliasing.
To create a signal for this problem we will use the Fourier series expansion for a triangular wave
and limit the summation to terms with frequencies less than or equal to 500 Hz.
5
8
tri (nT ) cos(200nT )
k 1 ( k )
2
k odd
To add noise to the signal we will use the Fourier expansion for a square wave and limit the sum
to the frequencies from 800 Hz to 10 KHz.
99
4
sq(nT ) 0.2 sin(200nT )
k 9 k
k odd
Solution
The following MATLAB® code produces the necessary filters and plots. Parks McClellan
filters are used. The first is of order 8 and has a pass band from 0 to 550 Hz and a stop band
from 2756 Hz to fs/2. The pass band and stop band ripple is 0.01. The second filter is of order
72 and has a pass band from 0 to 500 Hz and a stop band from800 Hz to 2756 Hz. The ripple in
both bands is 0.01.
%Create the approximate triangular wave from -1 to 1
T = 1/fs;
n = 1:4096;
nT = n*T;
w = 200*pi;
tr = fourierTri(fs, 4096, 100, 3);
%Create the noise from the upper frequencies of a square wave
n = 0:4095;
nT = n*T;
sq = zeros(1, length(nT));
for k = 9:2:99
sq = sq + (4/(k*pi))*sin(k*w*nT);
end
%Add noise to triangle to create trn and plot
trn = tr + .2*sq;
figure(1);clf;
subplot(3, 1, 1);
plot(nT, tr);
axis([0 .1 -1.2 1.2]);
title('Original triangle wave');
xlabel('time in seconds');
© 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.
ylabel('voltage');
subplot(3, 1, 2);
plot(nT, .2*sq);
axis([0 .1 -.4 .4]);
title('noise');
xlabel('time in seconds');
ylabel('voltage');
subplot(3, 1, 3);
plot(nT, trn);
axis([0 .1 -1.5 1.5]);
xlabel('time in seconds');
ylabel('amplitude');
title('Approximate triangular wave with noise');
% Down sample by 4. Needs a low pass
% pass band 0 - 550 stop band 11025/4 = 2756 to fs/2
% Take rp = rs = .01
fpass = 550;fstop = 2756;
rpass = 0.01;rstop = 0.01;
F = ([fpass fstop]);M = ([1 0]);
Dev = [rpass rstop];
[N F A W] = firpmord(F, M, Dev, fs);
disp(N);
h1 = firpm(N, F, A, W);
trnD4 = filter(h1, 1, trn);
trnD4 = downsample(trnD4, 4);
nt1 = downsample(nT, 4);
figure(2);clf;
subplot(2, 1, 1);
plot(nt1, trnD4);
axis([0 .1 -1.2 1.2]);
title('Down sample by 4');
xlabel('time in seconds');
ylabel('voltage');
% Down sample by 5. Needs a low pass
% pass band 0 - 500 stop band 800 to 11025/4 = 2756
fpass = 500;fstop = 800;
rpass = 0.01;rstop = 0.01;
F = ([fpass fstop]);M = ([1 0]);
Dev = [rpass rstop];
[N F A W] = firpmord(F, M, Dev, fs);
disp(N);
h2 = firpm(N, F, A, W);
trnD20 = filter(h2, 1, trnD4);
trnD20 = downsample(trnD20, 5);
nt2 = downsample(nt1, 5);
subplot(2, 1, 2);
plot(nt2, trnD20);
axis([.2 .3 -1.2 1.2]);
title('Down sample by 20');
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.
Down sample by 4
Original triangle wave 1
voltage
1
0
0.5
voltage
-1
0
0 0.02 0.04 0.06 0.08 0.1
-0.5 time in seconds
Down sample by 20
-1
1
0 0.02 0.04 0.06 0.08 0.1
voltage
time in seconds 0
noise
0.4
-1
0.2 0.2 0.22 0.24 0.26 0.28 0.3
time in seconds
voltage
-0.2
-0.4
0 0.02 0.04 0.06 0.08 0.1
time in seconds
Approximate triangular wave with noise
1
amplitude
-1
7.7 Consider a signal which has a pass band of 0 to 100 Hz. The sample frequency is 40,000 Hz
and we wish to reduce this sample frequency to just 1000 Hz, or a factor of D = 40. We want a
decimator with a pass band ripple of rp = 0.01 and a stop band ripple of rs = 0.001. Determine
the filter specifications if the decimator is implemented as a cascade of 2-4-5 using Parks-
McClellan filters.
Solution
The pass band will be 0 to 100 Hz for all three filters. For the first filter when D = 2 the stop
band will go from 10 KHz to 20 KHz. The new sample frequency after down sampling will be
20 KHz. For the second filter with D = 4, the stop band will go from 2.5 KHz to 10 KHz. The
new sample frequency after down sampling will be 5 KHz. For the final filter with D = 5 the
stop band will go from 500 Hz to 2.5 KHz.
© 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.
Since the three filters are cascaded the ripple numbers multiply to form the ripple for the final
filter. For the pass band we have (1 – Rp1)(1 – Rp2)(1 – Rp3) = (1 – Rpfinal). Since the ripple is
small compared to 1 and if we make Rp1 = Rp2 = Rp3 = Rp then Rpfinal ≈ 3Rp. For this case we
want 3Rp < 0.01 or Rp < 0.0033.
For the stop band we have Rst1 x Rst2 x Rst3 = Rstfinal. If we make Rst1 = Rst2 = Rst3 = Rst then
Rstfinal = Rst1/3. For this case we want Rst = 0.0011/3 making Rst = 0.1.
However, we must also take into account that the stop band ripple in each case can be folded
back into the pass band by aliasing. Thus we want Rp + Rst < 0.0033. making Rp = 0.001 and
Rst = 0.002 will satisfy these requirements.
7.8 Figure P7.8 shows a decimator which increases the sampling rate by a factor D. Show that
M
the output y can be written as y[n] bi x[nD i ] where the bi terms are the coefficients of the
i 0
decimation filter.
Figure P7.8
A decimation filter and a down-sampler.
Solution
M
y[n] bi x[n i ] [n i ]
i 0
Solution
A 1000 Hz signal sampled at 5000 Hz will have its first two aliases at 4000 Hz and 6000 Hz. If
the sample frequency is double the alias at 4000 Hz will become part of the spectrum below the
Nyquist frequency. If the sample frequency is tripled the 4000 Hz and the 6000 Hz aliases will
become part of the spectrum below the Nyquist frequency.
fs = 5000;T = 1/fs;
fsig = 1000; fs = 5000
t = 0:T:.4; 1
x = sin(2*pi*fsig*t);
gain
0.5
yup2 = upsample(x, 2);
yup3 = upsample(x, 3); 0
0 500 1000 1500 2000 2500
figure(1);clf; Frequency in Hz
subplot(3, 1, 1); fs = 10000
xfft = fft(x);
1
xfft = xfft/max(abs(xfft));
gain
k = 0:length(x)-1; 0.5
plot(k*fs/length(x), 0
abs(xfft)/max(abs(xfft))); 0 1000 2000 3000 4000 5000
axis([0 fs/2 0 1.2]); Frequency in Hz
xlabel('Frequency in Hz'); fs = 10000
ylabel('gain'); 1
gain
(a) The MATLAB® code below shows a 1 Hz signal sampled at 10 Hz. The signal is upsampled
by 2 and the frequency spectrum of the up-sampled signal is shown. The up-sampled signal has
frequency components at 1 Hz and 9 Hz = fsig + (fs – fsig)
fs = 10;T = 1/fs; fs = 10Hz fs = 10Hz
fsig = 1; 1
n = 0:4*fsig/T; 1
0.5
u = sin(2*pi*fsig*n*T);
Voltage
gain
gain
0
subplot(2, 2, 3); 0.5
n1 = 0:8*fsig/T+1; -0.5
t = 0:.05:4.05; -1
0
stem(t, yup); 0 0.5 1 1.5 2 0 5 10
axis([0 2 -1.2 1.2]); Time in Seconds Frequency in Hz
xlabel('Time in Seconds');
ylabel('Voltage');
title('fs = 20Hz');
%
subplot(2, 2, 2);
ftu = fft(u);
k = n*fs/length(ftu);
stem(k,
abs(ftu)/max(abs(ftu)));
axis([0 fs 0 1.2]);
xlabel('Frequency in Hz');
ylabel('gain');
title('fs = 10Hz');
© 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.
subplot(2, 2, 4);
ft2u = fft(yup);
k1 = n1*2*fs/length(yup);
stem(k1,
abs(ft2u)/max(abs(ft2u)));
axis([0 fs 0 1.2]);
xlabel('Frequency in Hz');
ylabel('gain');
title('fs = 20Hz');
(b) The MATLAB® code below shows a 1 Hz signal sampled at 10 Hz. The signal is upsampled
by 3 and the frequency spectrum of the up-sampled signal is shown. The up-sampled signal has
frequency components at 1 Hz and 9 Hz and 11 Hz = fsig + (fs ± fsig)
fs = 10;T = 1/fs; fs = 10Hz fs = 10Hz
fsig = 1; 1
1
n = 0:4*fsig/T; 0.5
u = sin(2*pi*fsig*n*T);
Voltage
gain
0
yup = upsample(u, 3); 0.5
-0.5
figure(2);clf;
subplot(2, 2, 1); -1
0
0 0.5 1 1.5 2 0 5 10
t = 0:.1:4; Time in seconds Frequency in Hz
stem(t, u); fs = 20Hz fs = 30Hz
axis([0 2 -1.2 1.2]); 1
1
xlabel('Time in seconds'); 0.5
ylabel('Voltage');
Voltage
gain
0
title('fs = 10Hz'); 0.5
-0.5
subplot(2, 2, 3);
-1
n1 = 0:12*fsig/T+2; 0
0 0.5 1 1.5 2 0 5 10 15
t = 0:.1/3:4.08; Time in Seconds Frequency in Hz
stem(t, yup);
axis([0 2 -1.2 1.2]);
xlabel('Time in Seconds');
ylabel('Voltage');
title('fs = 20Hz');
%
subplot(2, 2, 2);
ftu = fft(u);
k = n*fs/length(ftu);
stem(k, abs(ftu)/max(abs(ftu)));
axis([0 fs 0 1.2]);
xlabel('Frequency in Hz');
ylabel('gain');
title('fs = 10Hz');
subplot(2, 2, 4);
ft2u = fft(yup);
k1 = n1*3*fs/length(yup);
stem(k1,
abs(ft2u)/max(abs(ft2u)));
axis([0 3*fs/2 0 1.2]);
xlabel('Frequency in Hz');
ylabel('gain');
title('fs = 30Hz');
Exploring the Variety of Random
Documents with Different Content
rasvapilkkujen tahraama pöytä oli täynnä hujan hajan heitettyjä
astioita; ja pitkin seinävartta olivat viinurit panneet likaisia lautasia ja
tyhjiä pulloja, niin että se näytti roskaläjältä, joka oli pöydältä
lakaistu ja sinne kaadettu. Oli hyvin kuuma. Miehet riisuivat takkinsa
ja jatkoivat syöntiään paitahihasillaan.
Silloin Coupeau sanoi, että juokoon, joka haluaa, mutta että sitä
ennen oli ensin tehtävä tili ateriasta. Siten vältettäisiin riidat.
Oikeiden ihmisten ei tarvinnut maksaa juoppojen edestä. Ja siinäpä
kävikin ilmi, että juuri Saapas kopeloituaan kauvan taskujaan ei
löytänyt kuin kolme francia seitsemän souta. Mutta minkästähden
hänen oli annettu värjötellä Saint-Denis'n tiellä? Eihän hän voinut
jäädä sinne hukkumaan. Hän oli särkenyt sadan soun rahansa. Se oli
toisten syy, ja sillä hyvä. Vihdoin hän antoi kolme francia säästäen
loput, seitsemän sonta huomiseksi tupakkarahoikseen. Raivoissaan
olisi Coupeau lyönyt häntä, ellei Gervaise säikähtyneenä ja
rukoilevana olisi vetänyt häntä takista. Hän päätti pyytää lainaksi
kaksi francia Lorilleux'ltä, joka ensin kieltäytyi, mutta sitten
kumminkin salaa antoi, sillä hänen vaimonsa ei tietysti olisi koskaan
siihen suostunut.
— Se on tyttö.