You are on page 1of 582

Solution Manual for

SIGNALS AND SYSTEMS


USING MATLAB

Luis F. Chaparro
Copyright 2014, Elsevier, Inc. All rights reserved.
Chapter 0

From the Ground Up

0.1 Basic Problems


0.1 (a) i. Re(z) + Im(v) = 8 − 2 = 6

ii. |z + v| = |17 + j1| = 172 + 1

iii. |zv| = |72 − j16 + j27 + 6| = |78 + j11| = 782 + 112

iv. ∠z + ∠v = tan−1 (3/8) − tan−1 (2/9)


√ √
v. |v/z| = |v|/|z| = 85/ 73

vi. ∠(v/z) = − tan−1 (2/9) − tan−1 (3/8)


√ −1
(b) i. z + v = 17 + j = 172 + 1ej tan (1/17)
√ −1
ii. zv = 78 + j11 = 782 + 112 ej tan (11/78)
√ −1 √ −1
iii. z ∗ = 8 − j3 = 64 + 9(e−j tan (3/8) )∗ = 73ej tan (3/8)
iv. zz ∗ = |z|2 = 73
√ −1
v. z − v = −1 + j5 = 1 + 25e−j tan (5)

1
Chaparro — Signals and Systems using MATLAB 0.2

0.2 (a) z = 6ejπ/4 = 6 cos(π/4) + j6 sin(π/4)



i. Re(z) = 6 cos(π/4) = 3 2

ii. Im(z) = 6 sin(π/4) = 3 2
(b) i. Yes, Re(z) = 0.5(z + z ∗ ) = 0.5(2Re(z)) = Re(z) = 8
ii. Yes, Im(v) = −0.5j(v − v ∗ ) = −0.5j(2jIm(v)) = Im(v) = −2
iii. Yes, Re(z + v ∗ ) = Re(Re(z) + Re(v ∗ ) + Im(z) − Im(v)) = Re(z + v) = 17
iv. Yes, Im(z + v ∗ ) = Im(17 + j5) = Im(z − v) = Im(−9 + j5) = 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.3

0.3 (a) Representing the complex number z = x + jy = |z|ejθ then |x| = |z|| cos(θ)| and since | cos(θ)| ≤ 1
then |x| ≤ |z|, the equality holds when θ = 0 or when z = x, i.e., it is real.
(b) Adding two complex numbers is equivalent to adding two vectors to create a triangle with two sides
the two vectors being added and the other side the vector resulting from the addition. Unless the two
vector being added have the same angle, in which case |z| + |v| = |z + v|, it holds that |z| + |v| > |z + v|.

!z + !v !v

!z

Figure 1: Addition of two vectors illustrating the triangular inequality.

(c) The answer to both is yes. Indeed,


√ √ √
(a) |z + v| = 13 ≤ |z| + |v| = 2 + 5
√ √
(b) |z − v| = | − 1| = 1 ≤ |z| + |v| = 2 + 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.4

0.4 (a) We have


i. cos(θ − π/2) = 0.5(ej(θ−π/2) + e−j(θ−π/2) ) = −j0.5(ejθ − e−jθ ) = sin(θ)
ii. − sin(θ − π/2) = 0.5j(ej(θ−π/2) − e−j(θ−π/2) ) = 0.5j(−j)(ejθ + e−jθ ) = cos(θ)
iii. sin(θ + π/2) = (jejθ + je−jθ )/(2j) = cos(θ)
(b) i. cos(2πt) sin(2πt) = (1/4j)(ej4πt − e−j4πt ) so that
Z 1
1 ej4πt 1 1 e−j4πt 1
cos(2πt) sin(2πt)dt = |0 + | =0+0=0
0 4j 4πj 4j 4πj 0

ii. We have
1 j4πt 1
cos2 (2πt) = (e + 2 + e−j4πt ) = (1 + cos(4πt))
4 2
so that its integral is 1/2 since the integral of cos(4πt) is over two of its periods and it is zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.5

0.5 (a) i. 2 cos(α + β) = ej(α+β) + e−j(α+β) = (ejα ejβ ) + (ejα ejβ )∗ = 2Re(ejα ejβ ) and
Re[ejα ejβ ] = Re[(cos(α) + j sin(α))(cos(β) + j sin(β))] = cos(α) cos(β) − sin(α) sin(β)
so that
cos(α + β) = cos(α) cos(β) − sin(α) sin(β)
ii. 2j sin(α + β) = ejα ejβ − (ejα ejβ )∗ = 2jIm[ejα ejβ ], and the imaginary is
sin(α) cos(β) + cos(α) sin(β) = sin(α + β)
(b) Z 1
ej2πt 1 ej2π − 1
ej2πt dt = |0 = =0
0 j2π j2π
also Z Z Z
1 1 1
ej2πt dt = cos(2πt)dt + j sin(2πt)dt = 0 + j0
0 0 0
since the integrals of the sinusoids are over a period.
(c) i. Yes, (−1)n = (ejπ )n = ejnπ = cos(nπ) + j sin(nπ) = cos(nπ) since sin(nπ) = 0 for any
integer n.
ii. Yes, ej0 = −ejπ and ejπ/2 = −ej3π/2 so they add to zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.6

0.6 (a) Using Euler’s identity the product

ejα ejβ = (cos(α) + j sin(α))(cos(β) + j sin(β))


= [cos(α) cos(β) − sin(α) sin(β)] + j[sin(α) cos(β) + cos(α) sin(β)]

while

ej(α+β) = cos(α + β) + j sin(α + β)

so that equating the real and imaginary parts of the above two equations we get the desired trigonometric
identities.

(b) We have

cos(α) cos(β) = 0.5(ejα + e−jα ) 0.5(ejβ + e−jβ )


= 0.25(ej(α+β) + e−j(α+β) ) + 0.25(ej(α−β) + e−j(α−β) )
= 0.5 cos(α + β) + 0.5 cos(α − β)

Now,

sin(α) sin(β) = cos(α − π/2) cos(β − π/2)


= 0.5 cos(α − π/2 + β − π/2) + 0.5 cos(α − π/2 − β + π/2)
= 0.5 cos(α + β − π) + 0.5 cos(α − β)
= −0.5 cos(α + β) + 0.5 cos(α − β)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.7

0.7 (a) Replacing zk = |α|1/N ej(φ+2πk)/N in z N we get zkN = |α|ej(φ+2πk) = |α|ej(φ) = α for any value
of k = 0, · · · , N − 1.
(b) Applying the above result we have:
• For z 2 = 1 = 1ej2π the roots are zk = 1ej(2π+2πk)/2 , k = 0, 1. When k = 0, z0 = ejπ = −1 and
z1 = ej2π = 1.
• When z 2 = −1 = 1ejπ the roots are zk = 1ej(π+2πk)/2 , k = 0, 1. When k = 0, z0 = ejπ/2 = j,
and z1 = ej3π/2 = −j.
• For z 3 = 1 = 1ej2π the roots are zk = 1ej(2π+2πk)/3 , k = 0, 1, 2. When k = 0, z0 = ej2π/3 ; for
k = 1, z1 = ej4π/3 = e−j2π/3 = z0∗ ; and for k = 2, z2 = 1ej(2π) = 1.
• When z 3 = −1 = 1ejπ the roots are zk = 1ej(π+2πk)/3 , k = 0, 1, 2. When k = 0, z0 = ejπ/3 ; for
k = 1, z1 = ejπ = −1; and for k = 2, z2 = 1ej(5π)/3 = 1ej(−π)/3 = z0∗
(c) Notice that the roots are equally spaced around a circle of radius r and that the complex roots appear
as pairs of complex conjugate roots.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.8

0.8 (a) We have


i. z 3 = −1 = ejπ(2k+1) for k = 0, 1, 2, so roots are zk = ejπ(2k+1)/3 , k = 0, 1, 2, i.e., on a
circle of unit radius and separated π/3 with one at −1.
ii. z 2 = 1 = ej2πk for k = 0, ±1, ±2, · · · , so roots are zk = ejπk =, i.e., on a circle of unit
radius and separated π , one at zero and the other at −1
p
iii. z 2 + 3z + 1 = (z + 1.5)2 + (1 − 1.52 ) = 0 so the roots are z1,2 = ± (1.52 − 1) − 1.5
(b) The log (using the Naperian base) of a product is the sum of the logs of the terms in the product,
and the log and the exponential are the opposite of each other so the last term in the equation.
Using the given expression for the log of a complex number (log of real numbers is a special case):

log(−2) = log(2e±jπ ) = log(2) ± jπ


√ √
log(1 + j1) = log( 2ejπ/4 ) = log( 2) + jπ/4 = 0.5 log(2) + jπ/4
log(2ejπ/4 ) = log(2) + jπ/4

(c) z = −1 = 1ejπ thus


i. log(z) = log(1ejπ ) = log(1) + jπ = jπ
ii. From above result, elog(z) = ejπ = −1
(d) i. z 2 /4 = (2ejπ/4 )2 /4 = 4ejπ/2 /4 = j
ii. Yes, (cos(π/4)+j sin(π/4))2 = (z/2)2 , and (z/2)2 = (cos(π/4)+j sin(π/4))2 = cos(π/2)+
j sin(π/2) = j

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.9

0.9 (a) If w = ez then


log(w) = z = 1 + j1
given that the log and e functions are the inverse of each other.
The real and imaginary of w are

w = ez = e1 ej1 = e cos(1) +j e sin(1)


| {z } | {z }
real part imaginary part

(b) The imaginary parts are cancelled and the real parts added twice in

w + w∗ = 2Re[w] = 2e cos(1)

(c) Replacing z
w = ez = e1 ej1
so that |w| = e and ∠w = 1.
Using the result in (a)
| log(w)|2 = |z|2 = 2
(d) According to Euler’s equation
 
j −j w w∗
cos(1) = 0.5(e + e ) = 0.5 +
e e

which can be verified using w + w∗ obtained above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.10

0.10 (a) Shifting to the right a cosine by a fourth of its period we get a sinusoid, thus

sin(Ω0 t) = cos(Ω0 (t − T0 /4)) = cos(Ω0 t − Ω0 T0 /4) = cos(Ω0 t − π/2)

since Ω0 = 2π/T0 or Ω0 T0 = 2π.


(b) The phasor that generates a sine is Ae−jπ/2 since

y(t) = Re[Ae−jπ/2 ejΩ0 t ] = Re[Aej(Ω0 t−π/2) ] = A cos(Ω0 t − π/2)

which equals A sin(Ω0 t).


(c) The phasors corresponding to −x(t) = −A cos(Ω0 t) = A cos(Ω0 t + π) is Aejπ . For

−y(t) = −A sin(Ω0 t) = −A cos(Ω0 t − π/2) = A cos(Ω0 t − π/2 + π) = A cos(Ω0 t + π/2)

the phasor is Aejπ/2 . Thus, relating any sinusoid to the corresponding cosine, the magnitude and
angle of this cosine gives the magnitude and phase of the phasor that generates the given sinusoid.
(d) If z(t) = x(t) + y(t) = A cos(Ω0 t) + A sin(Ω0 t), the phasor corresponding to z(t) is the sum
of the phasors Aej0 , corresponding
√ to A cos(Ω0 t), with the phasor Ae−jπ/2 , corresponding to
−jπ/4
A sin(Ω0 t), which gives 2Ae (equivalently the sum of a vector with length A and angle 0
with another vector of length A and angle −π/2). We have that
h√ i √
z(t) = Re 2Ae−jπ/4 ejΩ0 t = 2A cos(Ω0 t − π/4)

(e) i. Phasor 4ejπ/3


ii. −4 sin(2t + π/3) = 4 cos(2t + π/3 + π/2) with phasor 4ej5π/6
iii. We have

4 cos(2t + π/3) − 4 sin(2t + π/3) = Re[(4ejπ/3 + 4ej(π/2+π/3) )ej2t ]


= Re[4ejπ/3 (1 + ejπ/2 ) ej2t ]
| {z }

2ejπ/4
√ j7π/12 j2t
= Re[4 2e e ]

so that the phasor is 4 2ej7π/12

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.11

0.11 (a) Assuming a maximum frequency of 22.05 kHz for the acoustic signal, the numbers of bytes (8 bits
per byte) for two channels (stereo) and a 75 minutes recording is greater or equal to: 2 × 22, 050
samples/channel/second × 2 bytes/sample × 2 channels × 75 minutes × 60 seconds/minute = 7.938 ×
108 bytes. Multiplying by 8 we get the number of bits. CD quality means that the signal is sampled at
44.1 kHz and each sample is represented by 16 bits or 2 bytes.

(b) The raw data would consist of 8 (bits/sample) ×10, 000 (samples/sec)=80, 000 bits/sec. The vocoder
is part of a larger unit called a digital signal processor chip set. It uses various procedures to reduce the
number of bits that are transmitted while still keeping your voice recognizable. When there is silence it
does not transmit, letting another signal use the channel during pauses.

(c) Texting between cell phones is possible by sending short messages (160 characters) using the short
message services (SMS). Whenever your cell-phone communicates with the cell phone tower there is an
exchange of messages over the control channel for localization, and call setup. This channel provides
a pathway for SMS messages by sending packets of data. Except for the cost of storing messages, the
procedure is rather inexpensive and convenient to users.

(d) For CD audio the sampling rate is 44.1 kHz with 16 bits/sample. For DVD audio the sampling rate is
192 kHz with 24 bits/sample. The sampling process requires getting rid of high frequencies in the signal,
also each sample is only approximated by the binary representation, so analog recording could sound
better in some cases.

(e) The number of pixels processed every second is: 352 × 240 pixels/frame ×60 frames/sec.
The number of bits available for transmission every second is obtained by multiplying the above answer
by 8 bits/pixel. There many compression methods JPEG, MPEG, etc.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.12

0.12 (a) If α = 1 then


N
X −1
S= 1 = 1 + 1 + ··· + 1 = N
| {z }
n=0
N times

(b) The expression

S(1 − α) = S − αS
= (1 + α + · · · + αN −1 ) − (α + α2 + · · · + αN −1 + αN )
= 1 − αN

as the intermediate terms cancel. So that


1 − αN
S= , α 6= 1
1−α
Since we do not want the denominator 1 − α to be zero, the above requires that α 6= 1. If α = 1 the sum
was found in (a). As a finite sum, it exists for any finite values of α.
Putting (a) and (b) together we have

(1 − αN )/(1 − α) α 6= 1
S=
N α=1

(c) If N is infinite, the sum is of infinite length and we need to impose the condition that |α| < 1 so that
αn decays as n → ∞. In that case, the term αN → 0 as N → ∞, and the sum is
1
S= |α| < 1
1−α
If |α| ≥ 1 this sum does not exist, i.e., it becomes infinite.
(d) The derivative becomes
X∞
dS 1
S1 = = nαn−1 = .
dα n=0 (1 − α)2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.13

0.2 Problems using MATLAB

0.13 As we will see later, the sampling period of x(t) with a frequency of Ωmax = 2πfmax = 2π should
satisfy the Nyquist sampling condition

1
fs = ≥ 2fmax = 2 samples/sec
Ts

so Ts ≤ 1/2 (sec/sample). Thus when Ts = 0.1 the continuous-time and the discrete-time signals look
very much like each other, indicating the signals have the same information — such a statement will be
justified in the chapter on sampling where we will show that the continuous-time signal can be recovered
from the sampled signal. It is clear that when Ts = 1 the information is lost. Although it is not clear
from the figure that when we let Ts = 0.5 the discrete-time signal keeps the information, this sampling
period satisfies the Nyquist sampling condition and as such the original signal can be recovered from the
sampled signal. The following MATLAB script is used.

% Pr. 0._13
clear all; clf
T=3; Tss= 0.0001; t=[0:Tss:T];
xa=4*cos(2*pi*t); % continuous-time signal
xamin=min(xa);xamax=max(xa);
figure(1)
subplot(221)
plot(t,xa); grid
title(’Continuous-time Signal’); ylabel(’x(t)’); xlabel(’t sec’)
axis([0 T 1.5*xamin 1.5*xamax])
N=length(t);

for k=1:3,
if k==1,Ts= 0.1; subplot(222)
t1=[0:Ts:T]; n=1:Ts/Tss: N; xd=zeros(1,N); xd(n)=4*cos(2*pi*t1);
plot(t,xa); hold on; stem(t,xd);grid;hold off
axis([0 T 1.5*xamin 1.5*xamax]); ylabel(’x(0.1 n)’); xlabel(’t’)
elseif k==2, Ts=0.5; subplot(223)
t2=[0:Ts:T]; n=1:Ts/Tss: N; xd=zeros(1,N); xd(n)=4*cos(2*pi*t2);
plot(t,xa); hold on; stem(t,xd); grid; hold off
axis([0 T 1.5*xamin 1.5*xamax]); ylabel(’x(0.5 n)’); xlabel(’t’)
else,Ts=1; subplot(224)
t3=[0:Ts:T]; n=1:Ts/Tss: N; xd=zeros(1,N); xd(n)=4*cos(2*pi*t3);
plot(t,xa); hold on; stem(t,xd); grid; hold off
axis([0 T 1.5*xamin 1.5*xamax]); ylabel(’x(n)’); xlabel(’t’)
end
end

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.14

Analog Signal
6 6
4 4
2 2

x(0.1 n)
x(t)
0 0
−2 −2
−4 −4
−6 −6
0 1 2 3 0 1 2 3
t sec t

6 6
4 4
2 2
x(0.5 n)

x(n)
0 0
−2 −2
−4 −4
−6 −6
0 1 2 3 0 1 2 3
t t

Figure 2: Problem 13: Analog continuous-time signal (top left); continuous-time and discrete-time signals
superposed for Ts = 0.1 sec (top right) and Ts = 0.5 sec and Ts = 1 sec (bottom left to right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.15

0.14 The derivative is

dx(t)
y(t) = = −8π sin(2πt)
dt

which has the same frequency as x(t), thus the sampling period should be like in the previous problem,
Ts ≤ 0.5.

% Pr. 0_14
clear all
% actual derivative
Tss=0.0001;t1=0:Tss:3;
y=-8*pi*sin(2*pi*t1);
figure(2)
% forward difference
Ts=0.01;t=[0:Ts:3];N=length(t);
subplot(211)
xa=4*cos(2*pi*t); % sampled signal
der1_x=forwardiff(xa,Ts,t,y,t1);

clear der1_x
% forward difference
Ts=0.1;t=[0:Ts:3];N=length(t);
subplot(212)
xa=4*cos(2*pi*t); % sampled signal
der1_x=forwardiff(xa,Ts,t,y,t1);

The function forwardiff computes and plots the forward difference and the actual derivative.

function der=forwardiff(xa,Ts,t,y,t1)
% % forward difference
% % xa: sampled signal using Ts
% % y: actual derivative defined in t
N=length(t);n=0:N-2;
der=diff(xa)/Ts;
stem(n*Ts,der,’filled’);grid;xlabel(’t, nT_s’)
hold on
plot(t1,y,’r’); legend(’forward difference’,’derivative’)
hold off

For Ts = 0.1 the finite difference looks like the actual derivative but shifted, while for Ts = 0.01 it does
not.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.16

40
forward difference
20 derivative

−20

−40
0 0.5 1 1.5 2 2.5 3
t, nTs

40
forward difference
20 derivative

−20

−40
0 0.5 1 1.5 2 2.5 3
t, nTs

Figure 3: Problem 14: Ts = 0.01 sec (top) and Ts = 0.1 sec (bottom)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.17

0.15 (a) The backward finite difference (let Ts = 1 for simplicity)

∆1 [x(n)] = x(n) − x(n − 1)

is connected with the forward finite difference ∆[x(n)] given in the chapter as follows

∆1 [x(n + 1)] = x(n + 1) − x(n) = ∆[x(n)]

That is, ∆[x(n)] is ∆1 [x(n)] shifted one sample to the left.


(b) (c) The average of the two finite differences gives

0.5 {∆1 [x(n)] + ∆[x(n)]} = 0.5[x(n + 1) − x(n − 1)]

which gives a better approximation to the derivative than either of the given finite differences. The
following script is used to compute ∆1 and the average.

% Pr. 0_15
% compares forward/backward differences
% with new average difference
Ts=0.1;
for k=0:N-2,
x1=4*cos(2*pi*(k-1)*Ts);
x2=4*cos(2*pi*k*Ts);
der_x(k+1)=x2-x1; % backward difference
end
der_x=der_x/Ts;
Tss=0.0001;t1=0:Tss:3;
y=-8*pi*sin(2*pi*t1); % actual derivative
n=0:N-2;
figure(3)
subplot(211)
stem(n*Ts,der_x,’k’);grid
hold on
stem(n*Ts,der1_x,’b’,’filled’) % derv1_x forward difference
% from Pr. 0.2
hold on
plot(t1,y,’r’); xlabel(’t, nT_s’)
legend(’bck diff’,’forwd diff’, ’derivative’)
hold off
subplot(212)
stem(n*Ts,0.5*(der_x+der1_x));grid;xlabel(’t, nT_s’) % average
hold on
plot(t1,y,’r’)
hold off
legend(’average diff’,’derivative’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.18

30
bck diff
20
forwd diff
10 derivative

−10

−20

−30
0 0.5 1 1.5 2 2.5 3
t, nTs

30
average diff
20
derivative
10

−10

−20

−30
0 0.5 1 1.5 2 2.5 3
t, nTs

Figure 4: Problem 15: Comparison of different finite differences.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.19

0.16 (a) According to Kirchoff’s current law

vL (t)
is (t) = iR (t) + iL (t) = + iL (t)
R
but vL (t) = LdiL (t)/dt so that the ordinary differential equation relating the input is (t) to the output
current in the inductor iL (t) is
diL (t)
+ iL (t) = is (t)
dt
after replacing L = 1 and R = 1. Notice that this d.e. is the dual of the one given in the Chapter, so that
the difference equation is

Ts 2 − Ts
iL (nTs ) = [is (nTs ) + is ((n − 1)Ts )] + iL ((n − 1)Ts ) n≥1
2 + Ts 2 + Ts
iL (0) = 0

cos(1/2 π t)
1
input current 1
is(t),iL(t)

output current
0.5 filter gain 0.5

0
0
0 10 20 30 40 50 60 70 80 90 100
t −0.5

1 −1
input current
is(t),iL(t)

output current 0 10 20 30 40 50 60 70 80 90 100


0 filter gain t
2
−...+2 (2 cos(1/2 π t)+π sin(1/2 π t))/(4+π )
−1 1
0 10 20 30 40 50 60 70 80 90 100
t 0.5
1
input current 0
is(t),iL(t)

output current
0 filter gain
−0.5
−1
0 10 20 30 40 50 60 70 80 90 100 −1
t 0 10 20 30 40 50 60 70 80 90 100
t

Figure 5: Problem 16: Left (top to bottom): solution of difference equation for Ω0 = 0.005, 0.05, 0.5
(rad/sec). Right: input (top), solution of ordinary differential equation (bottom).

(b)(c) The scripts to solve the difference and ordinary differential equations are the following.

% Pr. 0_16
clear all
% solution of difference equation
Ts=0.01;
t=[0:Ts:100];
figure(4)
for k=0:2;
if k==0, subplot(311)
elseif k==1, subplot(312)
else, subplot(313)
end
W0= 0.005*10ˆk*pi; % frequency of source
is=cos(W0*t); % source

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.20

a=[1 (-2+Ts)/(2+Ts)]; % coefficients of i_L(n), i_L(n-1)


b=[Ts/(2+Ts) Ts/(2+Ts)]; % coefficients of i_s(n), i_s(n-1)
il=filter(b,a,is); % current in inductor computed by
% MATLAB function ’filter’
H=1/sqrt(1+W0ˆ2)*ones(1,length(t)); % filter gain at W0
plot(t,is,t,il,’r’,t,H,’g’); xlabel(’t’); ylabel(’i_s(t),i_L(t)’)
axis([0 100 1.1*min(is) 1.1*max(is)])
legend(’input current’,’output current’,’filter gain’); grid
pause(0.1)
end
%%%%
% solution of ordinary differential equation for cosine input of frequency 0.5pi
clear all
syms t x y
x=cos(0.5*pi*t);
y=dsolve(’Dy+y=cos(0.5*pi*t)’,’y(0)=0’,’t’)
figure(5)
subplot(211)
ezplot(x,[0 100]);grid
subplot(212)
ezplot(y,[0 100]);grid
axis([0 100 -1 1])

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.21

0.17 (a) The distributive and the associative laws are equivalent to the ones for integrals, indeed
X X
cak = c(· · · + a−1 + a0 + a1 + · · · ) = c ak
k k

since c does not depend on k. Likewise


X X X
[ak + bk ] = (· · · + a−1 + b−1 + a0 + b0 + a1 + b1 · · · ) = ak + bk
k k k

Finally, when adding a set of numbers the order in which they are added does not change the result. For
instance,
a0 + a1 + a2 + a3 = a0 + a2 + a1 + a3
PN
(b) Gauss’ trick can be shown in general as follows. Let S = k=0 k then
N
X 0
X
2S = k+ k
k=0 k=N

letting ` = −k + N in the second summation we have


N
X N
X N
X N
X
2S = k+ (N − `) = (k + N − k) = N 1 = N (N + 1)
k=0 `=0 k=0 k=0

where we let the dummy variables of the two sums be equal. We thus have that for N = 104

N (N + 1) 104 (104 + 1)
S= = ≈ 0.5 × 108
2 2

(c) Using the above properties of the sum,


N
X N
X N
X
S1 = (α + βk) = α 1+β k
k=0 k=0 k=0
N (N + 1)
= α(N + 1) + β
2
(d) The following script computes numerically and symbolically the various sums.

% Pr. 0_17
clear all
% numeric
N=100;
S1=[0:1:N];
S2=[N:-1:0];
S=sum(S1+S2)/2
% symbolic
syms S1 N alpha beta k
simple(symsum(alpha+beta*k,0,N))
% computing sum for specific values of alpha, beta and N
subs(symsum(alpha+beta*k,0,N),{alpha,beta,N},{1,1,100})

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.22

S = 5050

((2*alpha + N*beta)*(N + 1))/2

5151

The answers shown at the bottom.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.23

0.18 (a) The following figure shows the upper and lower bounds when approximating the integral of t:

1 x(t) = t

0.75 upper bound

0.5

lower bound
0.25

t
0 0.25 0.5 0.75 1

Figure 6: Problem 18: Upper and lower bounds of the integral of t when N = 4.

(b) (c) The lower bound for the integral is


N
X −1 N
X −1 N
X −2
S` = (nTs )Ts = Ts2 n = Ts2 (` + 1)
n=1 n=1 `=0
 
(N − 1)(N − 2)
= Ts2 + (N − 1)
2
The definite integral is
Z 1
1
tdt =
0 2
The upper bound is
N
X
Su = (nTs )Ts = S` + N Ts2
n=1

Letting N Ts = 1, or Ts = 1/N we have then that


   
(N − 1)(N − 2) + 2(N − 1) 1 (N − 1)(N − 2) + 2(N − 1) 1
≤ ≤ +
2N 2 2 2N 2 N

for large N the upper and the lower bound tend to 1/2.
The following script computes the lower and upper bound of the integral of t.

% Pr. 0_18
clear all
Ts=0.001;N=1/Ts;
% integral of t from 0 to 1 is 0.5
syms S1 n T k
% lower bound
n=subs(N);T=subs(Ts);
y=simple(symsum(k*Tˆ2,1,n-1));
yy=subs(y)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.24

% upper bound
z=simple(symsum(k*Tˆ2,1,n));
zz=subs(z)
% average
int= 0.5*(yy+zz)

giving the following results (the actual integral is 1/2).

yy = 0.4995
zz = 0.5005
int = 0.5000

(d) For y(t) = t2 , 0 ≤ t ≤ 1, the following script computes the upper and the lower bounds and their
average:

%% integral of tˆ2 from 0 to 1 is 0.333


% lower bound
y1=simple(symsum(kˆ2*Tˆ3,1,n-1));
yy1=subs(y1)
% upper bound
z1=simple(symsum(kˆ2*Tˆ3,1,n));
zz1=subs(z1)
% average
int= 0.5*(yy1+zz1)

giving the following results, in this case the value of the definite integral is 1/3.

yy1 = 0.3328
zz1 = 0.3338
int = 0.3333

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.25

0.19 The indefinite integral equals 0.5t2 . Computing it in [0, 1] gives the same value as the sum of the integrals
computed between [0, 0.5] and [0.5, 1].
As seen before, the sum
100
X 100(101)
S= n= = 5050
n=0
2
while

S1 = S + 50 = 5100
S2 = S

the first sum has an extra term when n = 50 while the other does not. To verify this use the following
script:

% Pr. 0_19
clear all
N=100;
syms n,N
S=symsum(n,0,N)
S1=symsum(n,0,N/2)+symsum(n,N/2,N)
S2=symsum(n,0,N/2)+symsum(n,N/2+1,N)

giving

S = 5050
S1 = 5100
S2 = 5050

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.26

0.20 (a)(b) We have that


0 < e−αt < e−βt
for α > β ≥ 0.

% Pr. 0_20
clear all
% compare two exponentials
t=[0:0.001:10];
x=exp(-0.5*t);
x1=exp(-1*t);
figure(6)
plot(t,x,t,x1,’r’);
legend(’Exponential Signal, a=-0.5’,’Exponential Signal, a=-1’)
grid
axis([0 10 0 1.1 ]); xlabel(’time’)

Exponential Signal, a=−0.5


1 Exponential Signal, a=−1

0.8

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
time

Figure 7: Problem 20: Comparison of exponentials e−0.5t and e−t for t ≥ 0 and 0 otherwise.

(c) Sampling x(t) = eat using Ts = 1, we get

x(t)|t=n = ean = αn

where α = ea > 0
(d) The voltage in the capacitor is given by
Z t
1
vc (t) = e−0.5τ dτ + vc (0)
C 0

with a initial voltage vc (0) = 0. Letting C = 1, we have

e−0.5τ t
vc (t) = | = 2(1 − e−0.5t )
−0.5 0
so that at t = 1 the voltage in the capacitor is vc (1) = 2 − 2e−0.5 = 0.79.
(e) Letting N Ts = 1, the definite integral is approximated, from below, by
N
X −1
Ts e−0.5(n+1)Ts
n=0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.27

if we let α = e−0.5Ts the above sum becomes


N
X −1
1 − αN
Ts αn+1 = Ts α
n=0
1−α

which is computed using the following script:

% compute value of Int (the integral)


N=1000;Ts=1/N;alpha=exp(- 0.5*Ts);
Int=Ts*alpha*(1-alphaˆN)/(1-alpha)

Int = 0.7867

approximating the analytic result found above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.28

0.21 (a) The point (1,1) in the two-dimensional plane corresponds to z = 1 + j. The magnitude and phase are
√ √
|z| = 1 + 1 = 2
∠z = tan−1 (1) = π/4

(b) For the other complex numbers:



|w| = 2, ∠w = π − π/4 = 3π/4

|v| = 2, ∠v = π + π/4 = 5π/4

|u| = 2, ∠u = −π/4

The sum of these complex numbers


z+w+v+u=0
(c) The ratios
√ jπ/4
z 1+j 2e
= =√ = 1e−jπ/2 = −j
w −1 + j 2ej3π/4
√ j3π/4
w −1 + j 2e
= =√ = 1e−jπ/2 = −j
v −1 − j 2ej5π/4
√ −jπ/4
u 1−j 2e
= = √ = 1e−jπ/2 = −j
z 1+j 2ejπ/4
Also, multiplying numerator and denominator by the by the conjugate of the denominator we get the
above results. For instance,
z 1+j (1 + j)(−1 − j) −1 − j − j − j 2 −2j
= = = = = −j
w −1 + j 2 2 2
and similarly for the others. Using these ratios we have
u u z
= × = (−j)(−j) = −1.
w z w

(d) y = 10−6 = j10−6 = 10−6 z so that

|y| = 10−6 |z| = 10−6


∠y = π/4

Although the magnitude of y is negligible, its phase is equal to that of z.


The results are verified by the following script:

% Pr. 0_21
z=1+j; w=-1+j; v=-1-j;u=1-j;
figure(1)
compass(1,1)
hold on
compass(-1,1,’r’)
hold on
compass(-1,-1,’k’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.29

hold on
compass(1,-1,’g’)
hold off
% part (a)
abs(z)
angle(z)
% part (b)
abs(w)
angle(w)
abs(v)
angle(v)
abs(u)
angle(u)
r=z+w+v+u
%part (c)
r1=z/w
r2=w/v
r3=u/z
r4=u/z
r5=u/w
figure(2)
compass(real(r1),imag(r1))
hold on
compass(real(r2),imag(r2),’r’)
hold on
compass(real(r3),imag(r3),’k’)
hold on
compass(real(r4),imag(r4),’g’)
hold on
compass(real(r5),imag(r5),’b’)
hold off
% part (c)
z
y=z*1e-16
abs(y)
angle(y)/pi

90 90
1.5 1
120 60 120 60
0.8
1
0.6
150 30 150 30
0.4
0.5
0.2

180 0 180 0

210 330 210 330

240 300 240 300

270 270

Figure 8: Problem 21: Results of complex calculations in parts (a) z, w, v, u and (b) z/w, w/v, u/z, z/w

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.30

0.22 (a)(b) Since

x(t) = (1 + jt)2 = 1 + j2t + j 2 t2 = 1 − t2 +j |{z}


2t
| {z }
real imag.

its derivative with respect to t is

dx(t) dRe[x(t)] dIm[x(t)]


y(t) = = −2t + 2j = +j
dt dt dt

% Pr. 0_22
clear all
t=[-5: 0.001:5];
x=(1+j*t).ˆ2;
xr=real(x);
xi=imag(x);
figure(7)
subplot(211)
plot(t,xr); title(’Real part of x(t)’); grid
subplot(212)
plot(t,xi); title(’Imaginary part of x(t)’); xlabel(’Time’); grid
% Warning when plotting complex signals
figure(8)
disp(’Read warning. MATLAB is being nice with you, this time!’)
plot(t,x); title(’COMPLEX Signal x(t)?’); xlabel(’Time’)

When plotting the complex function x(t) as function of t, MATLAB ignores the imaginary part. One
should not plot complex functions as functions of time as the results are not clear when using MATLAB.
See Fig. 9 for plots.
(c) Using the rectangular expression of x(t) we have

Z 1 Z 1 Z 1 Z 1
t3 2t2 1 2
x(t)dt = (1 − t2 + 2jt)dt = (1 − t2 )dt + 2j t dt = t − +j = + j1
0 0 0 0 3 2 0 3

(d) The integral

Z 1 Z 1 Z 1 Z 1
∗ 2 2 t3 2t2 1 2
x (t)dt = (1 − t − 2jt)dt = (1 − t )dt − 2j t dt = t − −j = − j1
0 0 0 0 3 2 0 3

which is the complex conjugate of the integral calculated in (c). So yes, the expression is true.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.31

Real part of x(t) COMPLEX Signal x(t)?


5 5

−5
0
−10

−15

−20 −5

−25
−5 −4 −3 −2 −1 0 1 2 3 4 5
−10
Imaginary part of x(t)
10

−15
5

0
−20
−5

−10 −25
−5 −4 −3 −2 −1 0 1 2 3 4 5 −5 −4 −3 −2 −1 0 1 2 3 4 5
Time Time

Figure 9: Problem 22: Real and imaginary parts of x(t) (left); complex signal x(t) ignoring imaginary part.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.32

0.23 (a) Using Euler’s identity

ejπn = cos(πn) + j sin(πn) = cos(πn) = (−1)n

so it is a real signal.

ejπn

··· ···
1 3
n
0 2

−1

Figure 10: Problem 23: The complex exponential ejπn = cos(πn) which is real.

(b) Replacing the sines by exponentials we have


1 jα
sin(α) sin(β) = (e − e−jα )(ejβ − e−jβ )
−4
1 h j(α+β) i
= e + e−j(α+β) − ej(α−β) − ej(−α+β)
−4
1
= [2 cos(α + β) − 2 cos(α − β)]
−4
1
= [cos(α − β) − cos(α + β)]
2
(c) Similarly
1 jα
cos(α) sin(β) = (e + e−jα )(ejβ − e−jβ )
4j
1 h j(α+β) i
= e − e−j(α+β) − ej(α−β) + ej(−α+β)
4j
1
= [2j sin(α + β) − 2j sin(α − β)]
4j
1
= [sin(α + β) − sin(α − β)]
2
If α = β then cos(α) sin(α) = (1/2) sin(2α) since sin(0) = 0. We have that T0 = 2 is the period of
sin(πt), cos(πt) as well as sin(2πt) (indeed, sin(2π(t + 2)) = sin(2πt + 4π) = sin(2πt)), therefore the
integral
Z T0 Z 2
sin(πt) cos(πt)dt = 0.5 sin(2πt)dt = 0.
0
|0 {z }
area under two periods of sin(2πt)

Thus sin(πt) and cos(πt) are orthogonal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.33

0.24
1 −θ
cos(jθ) = (e + eθ ) = cosh(θ)
2
(b) The hyperbolic sine is defined as
1 θ
sinh(θ) = (e − e−θ )
2
which is connected with the circular sine as follows
1 −θ
sin(jθ) = (e − eθ ) = j sinh(θ) ⇒ sinh(θ) = −j sin(jθ)
2j

(c) Since e±θ > 0 then cosh(θ) = cosh(−θ) > 0, the smallest value is for θ = 0 which gives cosh(0) =
1
(d) Indeed,
1
sinh(−θ) = (e−θ − eθ ) = − sinh(θ)
2

1/2 exp(θ)+1/2 exp(−θ)


6000
5000
4000
3000
2000
1000
0
−10 −8 −6 −4 −2 0 2 4 6 8 10
θ
1/2 exp(θ)−1/2 exp(−θ)

2000

1000

−1000

−2000

−10 −8 −6 −4 −2 0 2 4 6 8 10
θ

Figure 11: Problem 24: cosh(θ) (top) and sinh(θ) (bottom).

% Pr. 0_24
clear all
theta=sym(’theta’);
x= 0.5*(exp(-theta)+exp(theta));
y= 0.5*(exp(theta)-exp(-theta));
figure(9)
subplot(211)
ezplot(x,[-10,10])
grid
subplot(212)
ezplot(y,[-10,10])
grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 0.34

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 1

Continuous–time Signals

1.1 Basic Problems


1.1 Notice that 0.5[x(t) + x(−t)], the even component of x(t), is discontinuous at t = 0, it is 1 at t = 0 but
0.5 at t ±  for  → 0. Likewise the odd component of x(t), or 0.5[x(t) − x(−t)], must be zero at t = 0
so that when added to the even component one gets x(t).
z(t) equals x(t). See Fig. 1.

x(t) x(t + 1) x(t − 1)


1 1
1

t t t
1 −1 1 2

x(−t) 0.5[x(t) + x(−t)] 0.5[x(t) − x(−t)]

1 1 0.5
−1 0
t t t
−1 −1 1 1
−0.5
x(2t) x(0.5t) y(t)

1 1
(1)
1
t t t
0.5 2
−1

Figure 1.1: Problem 1

1
Chaparro — Signals and Systems using MATLAB 1.2

1.2 (a) If x(t) = t for 0 ≤ t ≤ 1, then x(t + 1) is x(t) advanced by 1, i.e., shifted to the left by 1 so that
x(0) = 0 occurs at t = −1 and x(1) = 1 occurs at t = 0.

x(t) x(t + 1)
1 1

t t
0 1 −1 0

x(−t) x(−t + 1)
1 1

t t
−1 0 0 1 2

Figure 1.2: Problem 2: Original signal x(t), shifted versions x(t + 1), x(−t) and x(−t + 1).

The signal x(−t) is the reversal of x(t) and x(−t+1) would be x(−t) advanced to the right by 1. Indeed,

t x(−t + 1)
1 x(0)
0 x(1)
−1 x(2)

The sum y(t) = x(t + 1) + x(−t + 1) is such that at t = 0 it is y(0) = 2; y(t) = x(t + 1) for t < 0; and
y(t) = x(−t + 1) for t > 0. Thus,

y(t) = x(t + 1) = t + 1 0 ≤ t + 1 < 1 or − 1 ≤ t < 0


y(0) = 2
y(t) = x(−t + 1) = −t + 1 0 ≤ −t + 1 < 1 or 0 < t ≤ 1

or

 t+1 −1 ≤ t < 0
y(t) = 2 t=0

−t + 1 0<t≤1

(b) Except for the discontinuity at t = 0, y(t) looks like the even triangle signal Λ(t), their integrals are

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.3

y(t)

−1 1 t

Figure 1.3: Problem 2: Triangular signal y(t) with discontinuity at the origin.

identical as the discontinuity of y(t) does not add any area.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.4

1.3 (a) We have that


i. x(t) is causal because it is zero for t < 0. It is neither even nor odd.
ii. Yes, the even component of x(t) is

xe (t) = 0.5[x(−t) + x(t)]


= 0.5[et u(−t) + e−t u(t)] = 0.5e−|t|

(b) x(t) = cos(t) + j sin(t) is a complex signal, xe (t) = 0.5[ejt + e−jt ] = cos(t) so xo (t) = j sin(t).
(c) The product of the even signal x(t) with the sine, which is odd, gives an odd signal and because of
this symmetry the integral is zero.
(d) Yes, because x(t) + x(−t) = 2xe (t), i.e., twice the even component of x(t), and multiplied by the
sine it is an odd function.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.5

1.4 The signal x(t) = t[u(t) − u(t − 1)] so that its reflection is

v(t) = x(−t) = −t[u(−t) − u(−t − 1)]

and delaying v(t) by 2 is

y(t) = v(t − 2) = −(t − 2)[u(−(t − 2)) − u(−(t − 2) − 1)]


= (−t + 2)[u(−t + 2) − u(−t + 1)] = (2 − t)[u(t − 1) − u(t − 2)]

On the other hand, the delaying of x(t) by 2 gives

w(t) = x(t − 2) = (t − 2)[u(t − 2) − u(t − 3)]

which when reflected gives

z(t) = w(−t) = (−t − 2)[u(−t − 2) − u(−t − 3)]

Comparing y(t) and z(t) we can see that these operations do not commute, that the order in which these
operations are done cannot be changed, so that y(t) 6= z(t) as shown in Fig. 1.4.

v(t) y(t)

1 1

−1 t 1 2 t

w(t) z(t)
1 1

1 2 3 t −3 −2 −1 t

Figure 1.4: Problem 4: Reflection and delaying do not commute, y(t) 6= z(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.6

1.5 (a) x(t) is called causal because it is zero for t < 0, it repeats every 0.5 sec. for t ≥ 0.

x(t)

1
···
0.5 1
xe (t)
0.5
··· ···
−0.5 0.5 1
xo (t)
0.5
−0.5 ···
··· 0.5 1
−0.5

Figure 1.5: Problem 5.

(b) Even component xe (t) = 0.5[x(t) + x(−t)] is periodic of fundamental period Te = 0.5. The odd
component is xo (t) = 0.5[x(t) − x(−t)] is not periodic.
(c) xe (t) and xo (t) are non-causal signals as they are different from zero for negative times.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.7

1.6 (a) Using Ω0 = 2πf0 = 2π/T0 for


i. cos(2πt): Ω0 = 2π rad/sec, f0 = 1 Hz and T0 = 1 sec.
ii. sin(t − π/4): Ω0 = 1 rad/sec, f0 = 1/(2π) Hz and T0 = 2π sec.
iii. tan(πt) = sin(πt)/ cos(πt): Ω0 = π rad/sec, f0 = 1/2 Hz and T0 = 2 sec.
(b) The fundamental period of sin(t) is T0 = 2π, and T1 = 2π/3 is the fundamental period of sin(3t),
T1 /T0 = 1/3 so 3T1 = T0 = 2π is the fundamental period of z(t).
(c) i. y(t) is periodic of fundamental period T0 = 1.
ii. w(t) = x(2t) is x(t) compressed by a factor of 2 so its fundamental period is T0 /2 = 1/2, the
fundamental period of z(t).
iii. v(t) has same fundamental period as x(t), T0 = 1, indeed v(t + kT0 ) = 1/x(t + kT0 ) =
1/x(t).
(d) i. x(t) = 2 cos(t), Ω0 = 2πf0 = 1 so f0 = 1/(2π)
ii. y(t) = 3 cos(2πt + π/4), Ω0 = 2πf0 = 2π so f0 = 1
iii. c(t) = 1/ cos(t), of fundamental period T0 = 2π, so f0 = 1/(2π).
(e) ze (t) is periodic of fundamental period T0 , indeed

ze (t + T0 ) = 0.5[z(t + T0 ) + z(−t − T0 ))]


= 0.5[z(t) + z(−t)]

Same for zo (t) since zo (t) = z(t) − ze (t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.8

1.7 (a) i. x(t) = cos(t + π/4), Ω0 = 1 = 2π/T0 so T0 = 2π,


x(t + kT0 ) = cos(t + k2π + π/4) = x(t)
ii. y(t) = 2 + sin(2πt), Ω0 = 2π, T0 = 1
y(t + kT0 ) = 2 + sin(2πt + 2πk) = y(t)
iii. z(t) = 1 + (cos(t)/ sin(3t)), T0 = 2π fundamental period of cosine, T1 = 2π/3 fundamental
period of the sine, then T0 /T1 = 3 or T0 = 3T1 = 2π is the fundamental period of z(t),

cos(t + 2πk)
z(t + 2πk) = 1 + = z(t)
sin(3t + 6πk)
(b) i. z1 (t) is periodic of period 10T0 , indeed

z1 (t + 10T0 ) = x1 (t + 10T0 ) + 2y1 (t + 10T0 )


= x1 (t) + 2y1 (t)

ii. v1 (t) is periodic of fundamental period 10T0 as

x1 (t + 10T0 ) x1 (t)
v1 (t + 10T0 ) = =
y1 (t + 10T0 ) y1 (t)

iii. w1 (t) is periodic of fundamental period T0 , since y1 (10T0 ) is compressed by a factor of 10 so


its fundamental period is T0 the same as x1 (t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.9

1.8 (a) x(t) is a causal decaying exponential with energy


Z ∞
1
Ex = e−2t dt =
0 2
and zero power as
Ex
Px = lim =0
T →∞ 2T
(b)
Z ∞ Z ∞
−2|t|
Ez = e dt = 2 e−2t dt
−∞ 0
| {z }
Ez1

(c) i. If y(t) = sign[x1 (t)], it has the same fundamental period as x1 (t), i.e., T0 = 1 and y(t) is a
train of pulses so its energy is infinite, while
Z 1
Py = 1 dt = 1
0

ii. Since x2 (t) = cos(2πt − π/2) = cos(2π(t − 1/4)) = x1 (t − 1/4), the energy and power of
x2 (t) coincide with those of x1 (t).
(d) v(t) = x1 (t) + x2 (t) is periodic of fundamental period T0 = 2π, and its power is
Z 2π Z 2π
1 1
Pv = (cos(t) + cos(2t))2 dt = (cos2 (t) + cos2 (2t) + 2 cos(t) cos(2t))dt
2π 0 2π 0
Using
1 1
cos2 (θ) = + cos(2θ)
2 2
1
cos(θ) cos(φ) = (cos(θ + φ) + cos(θ − φ))
2
we have
Z 2π Z 2π Z 2π
1 1 1
Pv = cos2 (t)dt + cos2 (2t)dt + 2 cos(t) cos(2t))dt
2π 0 2π 0 2π 0
| {z } | {z } | {z }
Px1 Px2 0

1 1
= + +0=1
2 2
(e) Power of x(t)
Z T0
1
Px = x2 (t)dt
T0 0
Z 1
= cos2 (2πt)dt
0
Z 1
= (1/2 + cos2 (4πt)dt = 0.5 + 0 = 0.5
0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.10

Power of f (t)
Z T
1
Pf = lim y 2 (t)dt
T →∞ 2T −T
Z N T0
1
= lim y 2 (t)dt
N →∞ 2(N T0 ) 0
Z T0
1
= y 2 (t)dt = 0.5Ps
2T0 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.11

1.9 This problem can be done in the time domain or in the phasor domain. The series connection of the
source vs (t) = cos(t), the resistor R and the inductor L is equivalent to the connection of a phasor
source Vs = 1ej0 , and impedances R and jΩL = jL (the frequency of the source is Ω = 1). The
corresponding to the current across the resistor and the inductor, in steady state, is

Vs
I=
R + jL

(a) L = 1, R = 0 —intuitively, the power used by the inductor is zero since only the resistor uses power.

+
Vs = 1ej0 _ I jL

Figure 1.6: Problem 9: Phasor circuit.

In this case, the current i(t) has a phasor

1
I= = −j = 1e−jπ/2
j

so that the current across the inductor in steady state is given by

i(t) = cos(t − π/2)

We can compute the average power Pa in time by finding the instantaneous power as

1
p(t) = i(t)vs (t) = cos(t − π/2) cos(t) = (cos(π/2) + cos(2t − π/2))
2
so that
Z T0
1
Pa = p(t)dt
T0 0
Z 2π
1 1
= [cos(π/2) + cos(2t − π/2)]dt = 0
2π 0 2

since cos(π/2) = 0 and the area under cos(2t − π/2) in a period is zero.
You probably remember from Circuits that the average power is computed using the equivalent expres-
sion
Vsm Im
Pa = cos(θ)
2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.12

where Vsm and Im are the peak-to-peak values of the phasors corresponding to Vs and I, and θ is the
angle in the impedance of the inductor, i.e, j1 = ejπ/2 or θ = π/2, and the average power is then

Pa = 0.5 cos(π/2) = 0

Confirming our intuition!


(b) For L = 1, R = 1, the phasor √
Vs 2 −jπ/4
I= = e
1+j 2
and so in the phasor domain,

Vsm Im 2/2 √ 1
Pa = cos(π/4) = 2/2 =
2 2 4
(c) L = 0, R = 1, in this case the power used by the resistor will be the power provided by the source.
in this case the phasor for the current across the resistor is

I = Vs = 1ej0 so that i(t) = cos(t)

in the steady state. Thus,


Z T0
1
Pa = p(t)dt
T0 0
Z 2π
1 1
= [cos(0) + cos(2t)]dt = 0.5
2π 0 2

In the phasor domain, the average power is


2
Vsm 1
Pa = cos(0) =
2 2
(d) The complex power supplied to the circuit is given by

1 1 |I|2 |Z| jθ
P = Vs I ∗ = (IZ)I ∗ = e
2 2 2
where Z = |Z|ejθ = R + jΩL is the input impedance.
Since Ω = 1, then for

• R = 0, L = 1, Z = j, I = −j so P = 12 ejπ/2 = 0 + j0.5 and Pa = Re[P ] = 0.



• R = 1, √L = 1, Z = 1√+ j, I = 1/(1 + j) so |I|2 = 1/2, Z = 2, θ = π/4 so that P =
0.5(0.5) 2ejπ/4 = 0.25 2(cos(π/4) + j sin(π/4)) and Pa = Re[P ] = 0.25.
• R = 1, L = 0, Z = 1, I = 1 so P = 12 ej0 = 0.5 + j0 and Pa = Re[P ] = 0.5.
The real part of the complex power corresponds to the average power used by the resistors, while the
imaginary part corresponds to the reactive power which is due to inductor and capacitors only.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.13

1.10 (a) Let x(t) = x1 (t) + x2 (t) = cos(2πt) + 2 cos(πt), so that x1 (t) is a cosine of frequency Ω1 = 2π or
period T1 = 1, and x2 (t) is a cosine of frequency Ω2 = π or period T2 = 2. The ratio of these periods
T2 /T1 = 2/1 is a rational number so x(t) is periodic of fundamental period T0 = 2T1 = T2 = 2.
The average power of x(t) is given by
Z T0 Z 2
1 2 1
Px = x (t)dt = [x21 (t) + x22 (t) + 2x1 (t)x2 (t)]dt
T0 0 2 0

Using the trigonometric identity cos(α) cos(β) = cos(α − β) + cos(α + β) we have that the integral
Z 2 Z 2
1 1
2x1 (t)x2 (t)dt = 4 cos(2πt) cos(πt)dt
2 0 2 0
Z 2
= [cos(πt) + cos(3πt)]dt = 0
0

since cos(πt) + cos(3πt) is periodic of period 2 and so its area under a period is zero. Thus,
Z 2
1
Px = [x21 (t) + x22 (t)]dt
2 0
Z Z 1
1 2 2 1
= x1 (t)dt + 2 x2 (t)]dt
2 0 2 0 2
= Px 1 + Px 2

so that the power of x(t) equals the sum of the powers of x1 (t) and x2 (t) which are sinusoids of different
frequencies, and thus orthogonal as we will see later.
Finally,
Z 2 Z 1
1
Px = cos2 (2πt)dt + 4 cos2 (πt)dt
2 0 0
Z Z 1
1 2
= [0.5 + 0.5 cos(4πt)]dt + 4[0.5 + 0.5 cos(2πt)]dt
2 0 0
= 0.5 + 2 = 2.5

remembering that the integrals of the cosines are zero (they are periodic of period 0.5 and 1 and the
integrals compute their areas under one or more periods, so they are zero).
(b) The components of y(t) have as periods T1 = 2π and T2 = 2 so that T1 /T2 = π which is not rational
so y(t) is not periodic. In this case we need to find the power of y(t) by finding the integral over an
infinite support of y 2 (t) which will as before give

Py = Py1 + Py2

In the case of harmonically related signals we can use the periodicity and compute one integral. However,
in either case the power superposition holds.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.14

1.11 (a) Yes, expressing ej2πt = cos(2πt) + j sin(2πt), periodic of fundamental period T0 = 1, then the
integral is the area under the cosine and sine in one or more periods (which is zero) when k 6= 0
and integer. If k = 0, the integral is also zero.
(b) Yes, whether t0 = 0 (first equation) or a value different from zero, the two integrals are equal as
the area under a period is the same. In the case x(t) = cos(2πt), both integrals are zero.
(c) It is not true, cos(2πt)δ(t − 1) = cos(2π)δ(t − 1) = δ(t − 1).
(d) It is true, considering x(t) the product of cos(t) and u(t) its derivative is

dx(t) d cos(t) du(t)


= u(t) + cos(t)
dt dt dt
= − sin(t)u(t) + cos(0)δ(t)

(e) Yes,
Z ∞ Z ∞
 −t   −2 
e u(t) δ(t − 2)dτ = e δ(t − 2)dτ
−∞ 0
= e−2

(f) Yes,

dx(t)
= 0.5[et u(t) + et δ(t)] + 0.5[−e−t u(t) + e−t δ(t)]
dt
= 0.5[et − e−t ]u(t) + δ(t) = sinh(t)u(t) + δ(t)

(g) The even component xe (t) is a periodic full-wave rectified signal of amplitude 1/2 and fundamental
period T1 = π.
Power of x(t)
 Z π 
1 2
Px = 0.5 x (t)dt
π 0

Power of xe (t)
Z π
1
Px e = (0.5x(t))2 dt = 0.5Px
π 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.15

1.12 (a) See Fig. 12a


x(t) = |t| [u(t + 2) − u(t − 2)] Derivative
| {z }
p(t)

x(t)

t
−2 2
y(t)

1
(2)
t
−2 2
−1 (−2)

Figure 1.7: Problem 12

dx(t)
y(t) = = 2δ(t + 2) − u(t + 2) + 2u(t) − u(t − 2) − 2δ(t − 2)
dt
(b) Integral

Z 0

 t < −2
t 
−t −2 ≤ t < 0
y(t0 )dt0 =
−∞ 
 t 0≤t<2

0 t≥2

which equals x(t).


(c) Yes, because x(t) is an even function of t.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.16

1.13 (a) The signal x(t) is




 0 t < −1

t+1 −1 ≤ t ≤ 0
x(t) =

 −1 0<t≤1

0 t>1

there are discontinuities at t = 0 and at t = 1. The derivative


dx(t)
y(t) =
dt
= u(t + 1) − u(t) − 2δ(t) + δ(t − 1)

indicating the discontinuities at t = 0, a decrease from 1 to −1, and at t = 1 an increase from −1


to 0.
(b) The integral
Z t Z t
y(τ )dτ = [u(τ + 1) − u(τ )
−∞ −∞
−2δ(τ ) + δ(τ − 1)]dτ = x(t)

x(t)
1
1
t
−1

−1

y(t)
1
(1)

t
−1 1
(−2)

Figure 1.8: Problem 13

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.17

1.14 (a) x(t), −∞ < t < ∞, is a continuous signal and its derivative exists and it is

d cos(Ω0 t)
y(t) = = −Ω0 sin(Ω0 t)
dt
(b) x1 (t) has a discontinuity at t = 0, and so its derivative will have a δ(t) function. Indeed, its derivative
is
d cos(Ω0 t)u(t)
z(t) =
dt
d cos(Ω0 t) du(t)
= u(t) + cos(Ω0 t)
dt dt
= −Ω0 sin(Ω0 t)u(t) + cos(Ω0 t)δ(t)
= −Ω0 sin(Ω0 t)u(t) + cos(0)δ(t)
= −Ω0 sin(Ω0 t)u(t) + δ(t)

(c) The integral of z(t) is zero for t < 0, and


Z t Z t Z t
z(t0 )dt0 = −Ω0 sin(Ω0 t0 )dt0 + δ(t0 )dt0
−∞ 0 0−
= [cos(Ω0 t) − 1] + 1 = cos(Ω0 t) t>0

or cos(Ω0 t)u(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.18

1.15 (a) The signal x(t) = t for 0 ≤ t ≤ 1, zero otherwise. Then



2t 0 ≤ 2t ≤ 1 or 0 ≤ t ≤ 1/2
x(2t) =
0 otherwise

that is, the signal has been compressed — instead of being between 0 and 1, it is now between 0 and 0.5.
(b) Likewise, the signal 
t/2 0 ≤ t/2 ≤ 1 or 0 ≤ t ≤ 2
x(t/2) =
0 otherwise
i.e., the signal has been expanded, its support has doubled.
The following figure illustrates the compressed and expanded signals x(2t) and x(t/2).

x(2t) x(t/2)

1 1

0.5 1 t 1 2 t

Figure 1.9: Problem 15: Compressed x(2t), expanded x(t/2) signals.

(c) If the acoustic signal is recorded in a tape, we can play it faster (contraction) or slower (expansion)
than the speed at which it was recorded. Thus the signal can be made to last a desired amount of time,
which might be helpful whenever an allocated time is reserved for broadcasting it.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.19

1.16 (a) Because of the discontinuity of x(t) at t = 0 the even component of x(t) is a triangle with xe (0) = 1,
i.e., 
 0.5(1 − t) 0 < t ≤ 1
xe (t) = 0.5(1 + t) −1 ≤ t < 0

1 t=0
while the odd component is

 0.5(1 − t) 0<t≤1
xo (t) = −0.5(1 + t) −1 ≤ t < 0

0 t=0

xe (t) x0 (t)

0.5 0.5
−1

−1 1 t 1 t
−0.5

Figure 1.10: Problem 16: Even and odd decomposition of x(t).

(b) The energy of x(t) is


Z ∞ Z ∞
x2 (t)dt = [xe (t) + xo (t)]2 dt
−∞ −∞
Z ∞ Z ∞ Z ∞
2 2
= xe (t)dt + xo (t)dt + 2 xe (t)xo (t)dt
−∞ −∞ −∞

where the last equation on the right is zero, given that the integrand is odd.
(c) The energy of x(t) = 1 − t, 0 ≤ t ≤ 1 and zero otherwise, is given by
Z ∞ Z 1
t3 1
2
x (t)dt = (1 − t)2 dt = t − t2 + 10 =
−∞ 0 3 3
The energy of the even component is
Z ∞ Z 0 Z 1 Z 1
2 2 2
xe (t)dt = 0.25 (1 + t) dt + 0.25 (1 − t) dt = 0.5 (1 − t)2 dt
−∞ −1 0 0

where the discontinuity at t = 0 does not change the above result. The energy of the odd component is
Z ∞ Z 0 Z 1 Z 1
2 2 2
xo (t)dt = 0.25 (1 + t) dt + 0.25 (1 − t) dt = 0.5 (1 − t)2 dt
−∞ −1 0 0

so that
Ex = Exe + Exo

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.20

1.17 (a) The function g(t) corresponding to the first period of x(t) is given by

g(t) = u(t) − 2u(t − 1) + u(t − 2)

(b) The periodic signal x(t) is

x(t) = g(t) + g(t − 2) + g(t − 4) + · · ·


X∞
+ g(t + 2) + g(t + 4) + · · · = g(t + 2k)
k=−∞

(c) Yes, the signals y(t), z(t) and v(t) are periodic of period T0 = 2 as can be easily verified.
(d) The derivative of x(t) is

dx(t)
dt
2

··· ···
−1 1
t
2

−2

Figure 1.11: Problem 17: Derivative of x(t).

w(t) = 2δ(t) − 2δ(t − 1) + 2δ(t − 2) + · · ·


− 2δ(t + 1) + 2δ(t + 2) + · · ·

which can be seen to be periodic of period T0 = 2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.21

1.18 (a) Ω0 = 2π = 2πf0 (rad/sec), so f0 = 1/T0 = 1 (Hz) and T0 = 1 sec.


The sum

z(t) = x(t) + y(t)


= (2 cos(2πt) + cos(πt)) + j(2 sin(2πt) + sin(πt)

is also periodic of period T1 = 2.


(b) v(t) = x(t)y(t) = 2ej3πt with frequency Ω3 = 3π so that

T3 = 2π/Ω3 = 2/3

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.22

1.19 (a) The derivative signal y(t) = dx(t)/dt is a train of rectangular pulses. Indeed, if x1 (t) = r(t) −
2r(t − 0.5) + r(t − 1) is the first period of x(t) then

X
x(t) = x1 (t − k)
k=−∞

its derivative is

X
dx(t) dx1 (t − k)
y(t) = =
dt dt
k=−∞

where
dx1 (t − k)
= u(t − k) − 2u(t − 0.5 − k) + u(t − 1 − k)
dt
(b) The signal x(t) − 0.5 has an average of zero, so its integral
Z 1
z(t) = lim N (x(t) − 0.5)dt = 0
N →∞ 0

(c) Neither is a finite energy signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.23

1.2 Problems using MATLAB


1.20 The given signal x(t) = e−|t| is even, positive and decays to zero as t → ±∞
(a) The signal is finite energy as
Z ∞ Z ∞
e−2t ∞
Ex = 2
x (t)dt = 2 e−2t dt = 2 | =1
−∞ 0 −2 0

(b) The signal x(t) is absolutely integrable as


Z ∞ Z ∞
e−2t ∞
|x(t)|dt = 2 e−t dt = 2 | =2
−∞ 0 −1 0

Notice that 0 < x2 (t) < x(t) and so the knowledge that x(t) is absolutely integrable (i.e., that the above
integral is finite) would imply that x(t) has finite energy (i.e., the integral calculated in (b) is finite).
(c) The energy of y(t) is
Z ∞ Z ∞
Ey = e−2t cos2 (2πt)dt < e−2t dt = Ex /2 = 1/2
0 0

since cos2 (2πt) ≤ 1 (the decaying sinusoid is bounded by the envelope e−2t u(t)).

% Pr. 1_20
clear all; clf
syms x y t z
x=exp(-abs(t));
% computation of integrals
% for increasing values of time
for k=1:100,
zi=2*int(x,t,0,k/10);
yi=2*int(xˆ2,t,0,k/10);
vi=int((exp(-t)*cos(2*pi*t))ˆ2,0,k/10);
zz(k)=subs(zi);
yy(k)=subs(yi);
vv(k)=subs(vi);
end
t1=[1:100]/10;
figure(1)
subplot(221)
ezplot(x,[-10,10]);grid
axis([-10 10 0 1]);title(’x(t)=eˆ{-|t|}’)
subplot(222)
plot(t1,zz);grid;title(’integral of |x(t)|’);xlabel(’t’)
subplot(223)
plot(t1,yy);grid;title(’integral of |x(t)|ˆ2’);xlabel(’t’)
subplot(224)
plot(t1,vv);grid;title(’integral of |eˆ{-t}cos(2\pit)|ˆ2’);xlabel(’t’)
figure(2)
ezplot((exp(-t)*cos(2*pi*t))ˆ2,[0,5]);grid
axis([0 5 0 1])
hold on

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.24

ezplot((exp(-t))ˆ2,[0,5])
axis([0 5 0 1]);title(’envelope of |y(t)|ˆ2’)
hold off

x(t)=e−|t| integral of |x(t)| envelope of |y(t)|2


1 2 1

0.8 0.9
1.5
0.6
1 0.8
0.4
0.5 0.7
0.2
0.6
0 0
−10 −5 0 5 10 0 2 4 6 8 10
t t 0.5
integral of |x(t)|2 integral of |e−tcos(2πt)|2
1 0.4

0.8 0.3
0.3
0.25
0.6
0.2 0.2
0.4
0.15
0.2 0.1
0.1

0 0.05 0
0 2 4 6 8 10 0 2 4 6 8 10 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t t t

Figure 1.12: Problem 20: signal x(t), and the integrals of |x(t)|, |x(t)|2 and |y(t)|2 (left). Right: envelope of
|y(t)|2 .

(d) For a value C for the capacitor, considering the initial condition the source for the RC circuit the KVL
equation for t ≥ 0 is:
Z
1 t
vR (t) + i(τ )dτ = 1, or
C 0
Z t
1
e−t + e−τ dτ = 1
CR 0

after replacing the voltage and current in the resistor. Solving the integral we obtain
1
e−t + (1 − e−t ) = 1
RC
so that for t = 0 we get an identity indicating the initial condition is satisfied by the solution. For t → ∞
we get 1/RC = 1. So that R = 1/C in general, for C = 1 mF then R = 1 KΩ and for C = 1µ = 10−6 F,
then R = 106 Ω or 1 MΩ.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.25

1.21 (a) The signal x1 (t) = 4 cos(πt) has frequency Ω1 = 2π/2 so that the period of x1 (t) is T1 = 2.
Likewise the signal x2 (t) = − sin(3πt + π/2) has frequency Ω2 = 3π = 2π/(2/3) so that it is
periodic of period T2 = 2/3. The signal x(t) is periodic of fundamental period T0 = 2 as the ratio
T1 /T2 = 2/(2/3) = 3 so that T0 = 3T2 = T1 = 2.
(b) The ratio of the two periods is
T1 3 1
= =
T2 3×4 4
so that
T0 = 4T1 = T2
is the period of x(t) = x1 (t) + x2 (t).
(c) In general, if the ratio of the periods of two periodic signals is
T1 M
=
T2 K
for integers M and K, not divisible by each other, then T0 = KT1 = M T2 is the period of the sum of
the periodic signals. If the ratio is not rational (i.e., M and/or K are not integers) then the sum of the two
periodic signals is not periodic.
The following script is used to show that x1 (t) + x2 (t) is periodic, while x3 (t) + x4 (t) is not.

% Pr. 1_21
clear all; clf
syms x1 x2 x3 x4 t
x1=4*cos(2*pi*t); x2=-sin(3*pi*t+pi/2);
x3=4*cos(2*t);x4=x2;
figure(3)
subplot(211)
ezplot(x1+x2,[0 10]);grid
subplot(212)
ezplot(x3+x4,[0 10]);grid

4 cos(2 π t)−cos(3 π t)
5

−5
0 1 2 3 4 5 6 7 8 9 10
t
4 cos(2 t)−cos(3 π t)
5

−5
0 1 2 3 4 5 6 7 8 9 10
t

Figure 1.13: Problem 21: periodic x1 (t) + x2 (t) (top), non–periodic x3 (t) + x4 (t) (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.26

1.22 (a) The triangular pulse has a width of 2∆ and a height of 1/∆, its area is 1. The following MATLAB
script can be used to see the limit as ∆ → 0

% Pr. 1_22
clear all; clf
% part (a)
delta=0.1;
t=[-delta:0.05:delta];N=length(t);
lambda=zeros(1,N);
figure(5)
for k=1:6,
lambda=(1-abs(t/delta))/delta;
delta=delta/2;
plot(t,lambda);xlabel(’t’)
axis([-0.1 0.1 0 330]);grid
hold on
pause(0.5)
end
grid
hold off

(b) The signal S∆ (t) = 1/∆s(t/∆) so that


1 sin(πt/∆) sin(πt/∆)
S∆ (t) = =
∆ πt/∆ πt
and so
cos(πt/∆)
S∆ (0) = lim (π/∆) = 1/∆
t→ 0 π
and S∆ (t) is zero at
πt/∆ = ±kπ k 6= 0 integer
or t = ±k∆ and finally the integral
Z ∞ Z ∞
sin(τ π)
S∆ (t)dt = ∆dτ = 1
−∞ −∞ π∆τ
where we used τ = t/∆. The following script illustrates the limit as ∆ → 0.

% part (b)
syms S t
delta=1;
figure(6)
for k=1:4,
delta=delta/k;
S=(1/delta)*sinc(t/delta);
ezplot(S,[-2 2])
axis([-2 2 -8 30])
hold on
I=subs(int(S,t,-100*delta, 100*delta)) % area under sinc
pause(0.5)
end
grid;xlabel(’t’)
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.27
sin(24 π t)/π/t
30

300 25

250 20

200 15
λ(t)

10
150

5
100

0
50

−5
0
−0.1 −0.08 −0.06 −0.04 −0.02 0 0.02 0.04 0.06 0.08 0.1
t −2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t

Figure 1.14: Problem 22: approximation of δ(t) using triangular (left) or sinc (right) functions

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.28

1.23 (a) The sampling signal is a sequence of unit impulses at uniform times kT , for t > 0. The integral
Z t ∞
X ∞ Z
X t ∞
X
ssT (t) = δ(t − kT )dt = δ(t − kT )dt = u(t − kT )
−∞ k=0 k=0 −∞ k=0

This signal is called the “stairway to the stars” (ssT (t)) for obvious reasons.
(b)(c) The following script will display the signal ss(t) and the conversion to analog (just uncomment
the desired signal and comment the not desired signal).

% Pr. 1_23 parts (b) and (c)


clear all; clf
T=0.1; t=0:T:10;
%f=t; % part (b)
f=cos(2*pi*t); % part (c)
figure(6)
stairs(t,f);grid
%axis([0 10 0 10]) % part (b)
axis([0 10 -1.1 1.1]) % part (c)
hold on
plot(t,f,’r’)
hold off

When f (t) = t + 1 the output looks like a digitized line with unit slope and cut at 1 (see figure below),
similarly when f (t) = cos(2πt) the output looks like a digitized sinusoid.
10
1
9
0.8
8
0.6
7
0.4

6 0.2

5 0

4 −0.2

−0.4
3
−0.6
2
−0.8
1
−1
0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Figure 1.15: Problem 23: ‘Digitized’ ramp and cosine signals using ’stairway to stars’

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.29

1.24 (a) The expanded signal x(t/2) is periodic. The first period of x(t) is x1 (t) for 0 ≤ t ≤ 2, and so the
period of x(t/2) is x1 (t/2) which is supported in 0 ≤ t/2 ≤ 2 or 0 ≤ t ≤ 4, so the period of x(t/2) is
4.
(b) The compressed signal x(2t) is periodic. The first period of x(t), x1 (t) for 0 ≤ t ≤ 2, becomes
x1 (2t) for 0 ≤ 2t ≤ 2 or 0 ≤ t ≤ 1, its support is halved. So the period of x(2t) is 1.

% Pr. 1_24, part(b)


clear all; clf
t=0:0.002:8;
t1=0:0.001:8; t2=0:0.004:8;
x=cos(pi*t);
x1=cos(pi*t1/2);
x2=cos(pi*2*t2);
figure(7)
subplot(211)
plot(t1,x1)
hold on
plot(t,x,’r’)
xlabel(’t (sec)’)
ylabel(’x(t/2), x(t)’)
legend(’expanded signal’, ’original signal’)
subplot(212)
plot(t2,x2)
hold on
plot(t,x,’r’)
xlabel(’t (sec) ’)
ylabel(’x(2t), x(t)’)
hold off
legend(’compressed signal’, ’original signal’)

1
expanded signal
original signal
0.5
x(t/2), x(t)

−0.5

−1
0 1 2 3 4 5 6 7 8
t (sec)

1
compressed signal
original signal
0.5
x(2t), x(t)

−0.5

−1
0 1 2 3 4 5 6 7 8
t (sec)

Figure 1.16: Problem 24: expanded and compressed sinusoids vs original sinusoid.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.30

1.25 (a) The power of the full-wave rectified signal is


Z 1
Py = | sin(πt)|2 dt
0

because the period of y(t) is T = 1. A simpler expression for sin2 (πt) can be computed using Euler’s
equation
 2
ejπt − e−jπt
sin2 (πt) =
2j
−1  j2πt 
= e − 2 + e−j2πt
4
= 0.5(1 − cos(2πt))

Since cos(2πt) has a period 1 its integral over a period is zero, thus

Py = 0.5

(b) A pulse ρ(t) = u(t) − u(t − 1) covers one of the periods of y(t) and thus the area under the full-wave
rectified signal is Py < 1 the area of the pulse squared.
(c) The following script is used to calculate the power which is found to be 1/2

% Pr. 1_25, part (c)


clear all;clf
syms x t
x=sin(pi*t); T=1;
figure(8)
ezplot(xˆ2,[0,5*T]);grid
P=int(xˆ2,t,0,T)/T
sin(π t)2

0.8

0.6

0.4

0.2

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5


t

Figure 1.17: Problem 25: magnitude squared signal used to compute power.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.31

1.26 The sampling rate Fs in sample/second is given with the discretized signal. To get one second of the
signal we need to take N = Fs samples from the given signal. The corresponding number of samples
N N for τ = 0.5 sec. is then calculated and the signal y(t) computed and displayed as function of time
as shown in the following script. For Fs = 8, 192 samples/sec, N N = 4, 096 samples

% Pr. 1_26
clear all; clf
load handel; Fs % test signal and sampling freq
N=Fs; y=y(1:N)’; % one second of handel
NN=fix(0.5*Fs) % delay in samples
% delaying signals
t=0:1/Fs:(N-1)/Fs;
tt=0:1/Fs:(N-1)/Fs+2*NN/Fs;
y1=[y zeros(1,2*NN)];
y2=0.8*[zeros(1,NN) y zeros(1,NN)];
y3=0.5*[zeros(1,2*NN) y];
yy=y1+y2+y3;
figure(9)
subplot(211)
plot(t,y); title(’original signal’);grid
subplot(212)
plot(tt,yy); title(’multipath signal’);grid
xlabel(’t (sec)’)
sound(yy,Fs)

original signal
1

0.5

−0.5

−1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

multipath signal
2

−1

−2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t (sec)

Figure 1.18: Problem 26: original ’handel’ signal (top); two-path affected signal (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.32

1.27 (a) (b) Adding 1 to the phasor 0.7ejφt gives a phasor of continuously varying magnitude and phase. Part
(a) of the script below shows it.
We have
1 + 0.7ejφt = 1 + 0.7 cos(φt) + j0.7 sin(φt) = A(t)ejθ(t)
where p p
A(t) = (1 + 0.7 cos(φt))2 + (0.7 sin(φt))2 = 1.49 + 1.4 cos(φt)
and  
−1 0.7 sin(φt)
θ(t) = tan
1 + 0.7 cos(φt)
which are computed as indicated in the script below.
(c) In this case we consider the effects of having two paths, the attenuation and the delays in time and in
frequency.

% Pr. 1_27
clear all; clf
% part (a)
t1=0;T=0.5;
m=1;
figure(10)
for k=1:512,
B=0.7*exp(j*pi*t1/100);
A=1+B;
A1(k)=abs(A);
Theta(k)=angle(A)*180/pi;
if k==20*m,
compass(real(A),imag(A),’r’)
hold on
compass(real(B),imag(B))
hold on
compass(1,0,’k’)
legend(’A=B+1’,’B’,’1’)
m=m+1;
pause(0.1)
else
t1=t1+T;
hold off
end
end
t=0:T:511*T;
% part (b)
figure(11)
subplot(211)
plot(t,A1);title(’Magnitude of 1+eˆ{j\phi t}’);grid
axis([0 max(t) 0 1.1*max(A1)])
subplot(212)
plot(t,Theta);title(’Phase (degrees) of 1+eˆ{j\phi t}’);grid
axis([0 max(t) 1.1*min(Theta) 1.1*max(Theta)]);xlabel(’t’)
% part (c)
y0=0.7*exp(j*(pi+pi/100)*t);
y1=real(exp(j*pi*t)+[zeros(1,100) y0(1:length(y0)-100)]);

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.33

t1=0:T:(length(y1)-1)*T;
figure(12)
plot(t1,y1);title(’Multi-path effects’);grid
axis([0 max(t1) 1.1*min(y1) 1.1*max(y1)]); ylabel(’y_1(t)’);xlabel(’t’)

Magnitude of 1+ejφ t
90
1.5 A=B+1
120 60 B 1.5
1
1 1
150 30
0.5
0.5

0
0 50 100 150 200 250
180 0
Phase (degrees) of 1+ejφ t
40

20
210 330
0

−20
240 300
270 −40
0 50 100 150 200 250
t
Multi−path effects

1.5

0.5
y1(t)

−0.5

−1

−1.5

0 50 100 150 200 250


t

Figure 1.19: Problem 27: phasor plot (top–left); magnitude and phase of 1 + ejφt (top–right); resulting signal
due to multipath (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.34

1.28 (a) The following script generates the signal y(t) for N P = 101 players, and ∆ = 0.02 Hz (changing
the N P to 51 we obtain the corresponding signal).

% Pr. 1_28
clear all; clf
NP=101 % number of players
% NP=51
A=10; delta=2/(NP-1);
F=160-(NP-1)/2*delta:delta:160+(NP-1)/2*delta;
t=0:0.1:200;
y=zeros(1,length(t));
figure(13)
for k=1:NP,
y=y+A*cos(2*pi*F(k)*t);
plot(t,y);grid
pause(0.1)
end
ylabel(’y(t)’); xlabel(’t’)

The final signal looks like a sequence of very narrow pulses.


(b) In this part, one can think of a multipath with N P paths, with no attenuation but a different Doppler
shift, ranging from −1 Hz to 1 Hz, in increments of 0.02 Hz.
1200

1000

800

600
y(t)

400

200

−200

−400
0 20 40 60 80 100 120 140 160 180 200
t

Figure 1.20: Problem 28: pulsation effect when N P = 101 and ∆ = 0.02 Hz.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.35

1.29 (a)(b) The following script generates the chirps

% Pr. 1_29
clear all;clf
t=0:0.05:40;
% chirps
y=cos(2*t+t.ˆ2/4);
y1=cos(2*t- 2*sin(t));
figure(14)
subplot(211)
plot(t,y); title(’linear chirp’)
axis([0 20 1.1*min(y) 1.1*max(y)]);grid
subplot(212)
plot(t,y1);title(’sinusoidal chirp’);xlabel(’t’)
axis([0 20 1.1*min(y1) 1.1*max(y1)]);grid
% instantaneous frequencies
IF=2+2*t/4;
IF1=2-2*cos(2*t);
figure(15)
subplot(211)
plot(t,IF);title(’IF of linear chirp’)
ylabel(’frequency’); xlabel(’t’);grid
subplot(212
plot(t,IF1);title(’IF of sinusoidal chirp’)
ylabel(’frequency’);xlabel(’t’);grid

linear chirp IF of linear chirp


1 25

20
0.5
frequency

15
0
10
−0.5
5
−1
0
0 2 4 6 8 10 12 14 16 18 20 0 5 10 15 20 25 30 35 40
t
sinusoidal chirp IF of sinusoidal chirp
1 4

0.5 3
frequency

0 2

−0.5 1

−1
0
0 2 4 6 8 10 12 14 16 18 20 0 5 10 15 20 25 30 35 40
t t

Figure 1.21: Problem 29: linear and sinusoidal chirps (left) and their corresponding instantaneous frequencies
(right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 1.36

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 2

Continuous–time Systems

2.1 Basic Problems


2.1 (a) The y(t)-x(t) relation is a line through the origin between −10 to 10 and a constant before and after
that. The system is non-linear, for instance if x(t) = 7 the output is y(t) = 700 but if we double the
input, the output is not 2y(t) = 1400 but 1000.
(b) If the inputs is always between −10 and 10 the system behaves like a linear system. In this case the
output is chopped whenever x(t) is above 10 or below −10. Se Fig. 2.1.
(c) Whenever the input goes below −10 or above 10 the output is −1000 and 1000, otherwise the output
is 2000 cos(2πt)u(t).
(d) If the input is delayed by 2 the clipping will still occur, simply at a later time. So the system is time
invariant.
1000

800 x(t)
y(t)
600

400

200

−200

−400

−600

−800

−1000

−2 −1 0 1 2 3 4
t

Figure 2.1: Problem 1: input and output of amplifier.

1
Chaparro — Signals and Systems using MATLAB 2.2

2.2 (a) Input x1 (t) = δ(t) gives



Z t  2 t<0
y1 (t) = δ(τ )dτ + 2 = 3 0≤t≤1
t−1 
2 t>1

x2 (t) = 2x1 (t) gives



Z t  2 t<0
y2 (t) = 2 δ(τ )dτ + 2 = 4 0≤t≤1
t−1 
2 t>1

Since y2 (t) 6= 2y(t) system is non-linear.

x1 (t) y1 (t)

3
2 2
(1)
t t
1
x2 (t) y2 (t)
4
(2) 2 2

t t
1

Figure 2.2: Problem 2

(b) If x3 (t) = u(t) − u(t − 1) then y3 (t) = 2 + r(t) − 2r(t − 1) + r(t − 2) . If x4 (t) = x3 (t − 1)
then the corresponding output is y3 (t − 1), so the system is time-invariant.
(c) Non-causal, although y(t) depends on present and past inputs, it is not zero when x(t) = 0, due to
the bias of 2.
(d) If |x(t)| < M we have
Z t
|y(t)| ≤ |x(τ )|dτ + 2 < M + 2 < ∞
t−1

The system is BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.3

2.3 (a) x(t) = sin(2πt)u(t) is zero for t < 0 and repeats periodically every T0 = 1. Thus,

X
y(t) = p(t − k), p(t) = u(t) − 2u(t − 0.5) + u(t − 1)
k=0

If the input is 2x(t) the output is the same as before, so the system is non-linear.
(b) The system is time-invariant: if input x(t − τ ) the output is y(t − τ ) for any value of τ .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.4

2.4 (a) Derivative


dz(t)
= w(t) − w(t − 1)
dt
which excludes the initial condition of 2. System is LTI if initial condition is zero.

(b) i. If input is i(t − µ) then the output is letting η = τ − µ


Z t Z 0 Z t−µ
i(τ − µ)dτ = i(η)dη + i(η)dη = vc (t − µ)
0 −µ 0

that is, provided that i(t) = 0 for t < 0, the system is time-invariant.
Rt
ii. If i(t) = u(t) then vc (t) = 0 u(τ )dτ = r(t). If we shift the inputs i1 (t) = i(t−1) = u(t−1)
the previous output is shifted, so system is time-invariant.
(c) If x(t) = u(t) then y(t) = sin(2πt)u(t) while corresponding to x(t − 0.5) = u(t − 0.5) is
y1 (t) = sin(2πt)u(t − 0.5) indicating the system is not time-invariant as y1 (t) is not y(t − 0.5).
sin(2 π t) heaviside(t)

−0.5 0 0.5 1 1.5


t
heaviside(t − 1/2) sin(2 π t)

−0.5 0 0.5 1 1.5


t

Figure 2.3: Problem 4(c)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.5

2.5 (a) See Fig. 1. The circuit is a series connection of a voltage source x(t) with a resistor R = 1/2 Ω,
and capacitor C = 1F. Indeed, the mesh current is i(t) = dy(t)/dt so

x(t) = Ri(t) + y(t) = Rdy(t)/dt + y(t)

i(t) R = 1/2

+
x(t) +
_ C = 1F y(t)

Figure 2.4: Problem 5

(b) The output is


y(t) = e−2t 0.5 e2τ |t0 = 0.5(1 − e−2t )u(t)
and
dy(t)
= e−2t u(t) + 0.5(1 − e−2t )δ(t)
dt
= e−2t u(t)
dy(t)
+ 2y(t) = e−2t u(t) + u(t) − e−2t u(t)
dt
= u(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.6

2.6 (a) i. z(t) = Av(t) + B, system is linear if B = 0, non-linear otherwise.


ii. z(t) = v(t) cos(Ω0 t) is linear but time-varying.
iii. If f (t) = v(t) = u(t) − u(t − 1), B = 0 then z(t) = u(t) − u(t − 1), and if we shift v(t) so
the input is v1 (t) = u(t − 2) − u(t − 3) the output is z1 (t) = v1 (t)f (t) = 0 which is different
from z(t − 2), so the system is time-varying.
(b) i. The system is linear:
Z Z Z
1 t A t B t
[Ax1 (τ ) + Bx2 (τ )]dτ = x1 (τ )dτ + x2 (τ )dτ = Ay1 (t) + By2 (t)
T t−T T t−T T t−T

where yi (t), i = 1, 2, are the corresponding outputs to xi (t),i = 1, 2.


ii. If x(t) = u(t) then y(t) = r(t) − r(t − 1) and if x1 (t) = u(t − 2) the corresponding output
is y1 (t) = y(t − 2). System is time-invariant.
In general, if x1 (t) = x(t − λ) the output is
Z t Z t−λ
1 1
x1 (τ ) dτ = x(ν)dν
T t−T | {z } T t−T −λ
x(t−λ)

(using ν = τ − λ) which is the same as y(t − λ), so time-invariant.


iii. y(t) depends on present and past inputs, and zero if input is zero, so the system is causal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.7

2.7 (a) The charge is


q(t) = C(t)v(t)
so that
dq(t) dv(t) dC(t)
i(t) =
= C(t) + v(t)
dt dt dt
(b) If C(t) = 1 + cos(2πt) and v(t) = cos(2πt), the current is

dv(t) dC(t)
i1 (t) = C(t) + v(t)
dt dt
= (1 + cos(2πt))(−2π sin(2πt)) − cos(2πt)(2π sin(2πt))
= −2π sin(2πt)[1 + 2 cos(2πt)]

(c) When the input is


v(t − 0.25) = cos(2π(t − 1/4)) = sin(2πt)
the output current is

dv(t − 0.25) dC(t)


i2 (t) = C(t) + v(t − 0.25)
dt dt
= (1 + cos(2πt))(2π cos(2πt)) − 2π sin2 (2πt)
= 2π cos(2πt) + 2π[cos2 (2πt) − sin2 (2πt)]

which is not
i1 (t − 0.25) = 2π cos(2πt)[1 + sin(2πt)]
so the system is time varying.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.8

2.8 (a) The system is LTI since the input x(t) and the output y(t) are related by a convolution integral with
h(t − τ ) = e−(t−τ ) u(t − τ ) or h(t) = e−t u(t).
Another way: to show that the system is linear let the input be x1 (t) + x2 (t), and x1 (t) and x2 (t) have
as outputs Z t
yi (t) = e−(t−τ ) xi (τ )dτ i = 1, 2
0

The output for x1 (t) + x2 (t) is


Z t
e−(t−τ ) (x1 (τ ) + x2 (τ ))dτ = y1 (t) + y2 (t)
0

To show the time invariance let the input be x(t − t0 ), its output will be
Z t Z 0 Z t−t0
e−(t−τ ) x(τ − t0 )dτ = e−((t−t0 )−µ) x(µ)dµ + e−((t−t0 )−µ) x(µ)dµ
0 −t0 0
Z t−t0
= e−((t−t0 )−µ) x(µ)dµ = y(t − t0 )
0

by letting µ = τ − t0 and using the causality of the input. The system is then TI.
Finally the impulse response is found by letting x(t) = δ(t) so that the output is
Z t Z t  −t
−(t−τ ) −(t−0) e × 1 = e−t t ≥ 0
h(t) = e δ(τ )dτ = e δ(τ )dτ =
0 0 0 otherwise

(b) Yes, this system is causal as the output y(t) depends on present and past values of the input.
(c) Letting x(t) = u(t), the unit-step response is
Z t Z t
−t+τ −t
s(t) = e u(τ )dτ = e eτ dτ = 1 − e−t
0 0

for t ≥ 0 and zero otherwise. The impulse response as indicated before is h(t) = ds(t)/dt = e−t u(t).
The BIBO stability of the system is then determined by checking whether the impulse response is abso-
lutely integrable or not, Z Z
∞ ∞
|h(t)|dt = e−t dt = −e−t |∞
0 =1
−∞ 0

so yes it is BIBO stable.


(d) Using superposition, the response to the pulse x1 (t) = u(t) − u(t − 1) would be

y1 (t) = y(t) − y(t − 1) = (1 − e−t )u(t) − (1 − e−(t−1) )u(t − 1)

which starts at zero, grows to a maximum of 1 − e−1 at t = 1 and goes down to zero as t → ∞.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.9

2.9 (a) Letting x(t) = δ(t) the impulse response is


Z t+T /2
1
h(t) = δ(τ )dτ
T t−T /2
Z t Z t+T /2
1 1
= δ(τ )dτ + δ(τ )dτ
T t−T /2 T t

If t > 0, and t − T /2 < 0 the first integral includes 0, while the second does not. Thus
Z t
1 1
h(t) = δ(τ )dτ + 0 = t > 0 and t − T /2 < 0, or 0 < t < T /2
T t−T /2 T

Likewise when t < 0 then t − T /2 < −T /2 and t + T /2 < T /2 the reverse of the previous case happens
and so
Z
1 t+T /2 1
h(t) = 0 + δ(τ )dτ = t < 0 and t + T /2 > 0, or − T /2 < t < 0
T t T

so that
1
h(t) =[u(t + T /2) − u(t − T /2)]
T
indicating that the system is non-causal as h(t) 6= 0 for t < 0.
(b) If x(t) = u(t) then the output of the averager is
Z t+T /2
1
y(t) = u(τ )dτ
T t−T /2

If t + T /2 < 0 then y(t) = 0 since the argument of the unit step signal is negative. If t + T /2 ≥ 0 and
t − T /2 < 0 then
Z t+T /2
1
y(t) = u(τ )dτ = (t + T /2)
0 T
and finally when t − T /2 ≥ 0 then
Z t+T /2
1
y(t) = u(τ )dτ = 1
T t−T /2

The unit-step response of the noncausal averager is



 0 t < −T /2
1
y(t) = T (t + T /2) −T /2 ≤ t < T /2

1 t ≥ T /2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.10

2.10 The input to all the systems is x(t) = cos(t), −∞ < t < ∞
(a) The system is non-linear, as the output

y(t) = cos2 (t) = 0.5(1 + cos(2t))

has frequency components of frequencies 0 and 2 (rad/sec) which are not in the input.
(b) The output is
y(t) = 0.5 cos(t) + 0.5 cos(t − 1)
having the same frequencies as the input so it is LTI.
(c) The output
y(t) = cos(t)u(t)
is not LTI. This is not a periodic signal, and it has frequencies different from the one at the input due to
the multiplication by the u(t).
(d) The output is

y(t) = 0.5 sin(τ )|tt−2 = 0.5 sin(t) − 0.5 sin(t − 2)

having the same frequency as the input so it is LTI.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.11

2.11 (a) Since f (t) is not a constant, the system is a modulator thus linear but time varying. Linearity is clearly
satisfied. If x(t) 6= 0 is the input and we shift it to get as input x(t − 11) the corresponding output is
zero different from y(t − 11). Thus the system is time varying. Since y(t) depends on x(t) the system is
causal. For x(t) bounded, i.e., |x(t)| < M < ∞, the output is also bounded, |y(t)| < M |f (t)| < ∞ so
the system is BIBO stable.
(b) The modulated signal is

x(t)f (t) = 2[cos((π/2 + 6π/7)t) + cos((6π/7 − π/2)t) = 2(cos(19πt/14) + cos(5πt/14)

with periods of T0 = 28/19 and T1 = 28/5 for the two components. The ratio

T0 5
=
T1 9
i.e., it is rational so the modulated signal is periodic of period 5T1 = 19T0 = 28, which is easily verified.
The frequencies at the output are not present at the input so the system is linear but not time–invariant
(f (t) is a function of t).
(c) If x(t) = u(t), the modulated signal is y(t) = u(t) − u(t − 2), and if we shift the input so that it is
x(t − 3) = u(t − 3) the corresponding output is u(t − 3)[u(t) − u(t − 2)] = 0 different from the previous
output shifted by 3, therefore the system is time-varying.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.12

2.12 (a) If y(0) = 0 the system is linear, indeed for an input αx1 (t) + βx2 (t) with y1 (t) the response due
to x1 (t) and y2 (t) the response due to x2 (t) we have
Z t
e−(t−τ ) [αax1 (τ ) + βx2 (τ )]dτ = αy1 (t) + βy2 (t)
0

If y(0) 6= 0, the output for input αx1 (t) is


Z t
−t
y(0)e + e−(t−τ ) αx1 (τ )dτ = y(0)e−t + αy1 (t)
0

which is not αy1 (t) thus it is not linear.


(b) If the input is x(t) = 0, then y(t) = y(0)e−t u(t) is the zero-input response, due completely to the
initial condition. If y(0) = 0 the response
Z t
y(t) = e−(t−τ ) x(τ )dτ
0

(which is the convolution integral of the impulse response h(t) = e−t u(t) with x(t)) is the zero-
state response.
(c) The impulse response, obtained when y(0) = 0, x(t) = δ(t), and y(t) = h(t) is
Z t Z t  −t
−(t−τ ) −t 0 e t≥0
h(t) = e δ(τ )dτ = e e δ(τ )dτ =
0− 0− 0 otherwise

(d) If x(t) = u(t) and y(0) = 0, then y(t) = s(t) given by


Z t
s(t) = e−(t−τ ) dτ = (1 − e−t )u(t)
0

Notice the relation between the unit-step and the impulse response:
−heaviside(t) (1/exp(t) − 1)

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

−1 0 1 2 3 4 5 6 7 8 9 10
t

Figure 2.5: Problem 12

ds(t)
= δ(t) − e−t δ(t) + e−t u(t)
dt
= e−t u(t) = h(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.13

2.13 (a) To find the differential equation let y(0) = 0, so that


Z t
−2t
y(t) = 2e e2τ x(τ )dτ
0

and its derivative is


Z t
dy(t)
= −4e−2t e2τ x(τ )dτ + 2e−2t e2t x(t) = −2y(t) + 2x(t)
dt 0

giving the differential equation


dy(t)
+ 2y(t) = 2x(t)
dt
(b) Finding the integral after replacing x(τ ) = u(τ ) we have that

e2τ t
y(t) = y(0)e−2t + 2e−2t = y(0)e−t + (1 − e−2t )
2 0
so that in the steady state, i.e., when t → ∞, the output is 1, independent of the value of the initial
condition.
(c) From the given input-output equation, letting x(t) = δ(t) and y(0) = 0 the output is the impulse
response of the system
Z t Z t
−2(t−τ ) −2t
h(t) = 2 e δ(τ )dτ = 2e δ(τ )dτ = 2e−2t u(t)
0 0

Computing the convolution integral as


Z ∞
y(t) = x(t − τ )h(τ )dτ
−∞

it can be obtained graphically by reflecting the input x(t) = u(t) and shifting it linearly from −∞ to ∞
to get
• for t < 0 then y(t) = 0
• for t ≥ 0 Z t
y(t) = 2e−2τ dτ = 1 − e−t
0

and so in the steady state the output goes to 1.


(d) The zero-input response is
yzi (t) = y(0)e−2t u(t)
and it is bounded for any finite value of the initial condition y(0), in particular for y(0) = 1, therefore
the system that depends on the initial condition is BIBO.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.14

2.14 (a) Yes. Using the convolution integral the output is


Z ∞ Z 1 Z t
y(t) = h(τ ) x(t − τ )dτ = x(t − τ )dτ = x(η)dη
−∞ |{z} 0 t−1
u(τ )−u(τ −1)

where we changed the variable to η = t − τ .


(b) If x(t) = u(t) then the step-response is

 0 t<0
y(t) = t 0≤t<1

1 t ≥ 1.

i.e., the unit-step response is s(t) = r(t) − r(t − 1) and the impulse response is

ds(t)
h(t) = = u(t) − u(t − 1)
dt

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.15

2.15 (a) x1 (t) = x(t) − x(t − 2) so y1 (t) = y(t) − y(t − 2), two triangular pulses, the second multiplied
by −1.

x1 (t) y1 (t)
1
1

2 3 t
2 4
t
1

1
x2 (t) y2 (t)

1
1

1 2
t t
1 1

1
1

Figure 2.6: Problem 15

(b) x2 (t) = x(t + 1) − x(t) then y2 (t) = y(t + 1) − y(t) (they overlap between 0 and 1).
(c) x3 (t) = δ(t) − δ(t − 1) so y3 (t) = dy(t)/dt = u(t) − 2u(t − 1) + u(t − 2). Considering that
the output of x(t) is y(t), i.e., y(t) = S[x(t)], and that the integrator and the differentiator are
LTI systems Fig. 2.7 shows how to visualize the result in this problem by considering that you can
change the order of the cascading of LTI systems.

dy(t) dy(t)
Z x(t) y(t) dt Z dt
d d
dx(t)
S
dt
⌘ S
dt
x3 (t) = dx(t) dy(t)
dt x3 (t) = dt
dt | {z }
1

Figure 2.7: Problem 15

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.16

P9
2.16 (a) If x(t) = k=0 δ(t − kT ) then by superposition and time-invariance
9
X
y(t) = h(t − kT )
k=0

(b) If T = 1, y(t) = u(t) − u(t − 10), while when t = 0.5


9
X 9
X
y(t) = h(t − 0.5k) = [u(t − 0.5k) − u(t − 0.5k − 1)]
k=0 k=0

h(t ⌧) x(⌧ )

1
···

t T 2T 9T
y(t)
T =1
1

t
0 10
y(t)
T = 0.5

1
t
0 0.5

Figure 2.8: Problem 16

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.17

2.17 (a) By the definition of the derivative


Z  "Z Z 
t t+h t
d 1
f (τ )dτ = lim f (τ )dτ − f (τ )dτ
dt 0 h→0 h 0 0
"Z #
t+h
1
= lim f (τ )dτ
h→0 h t

f (t)h
= lim = f (t)
h→0 h

(b) y(t) satisfies the ordinary differential equation, indeed


 Z 
dy(t) d −at t aτ
= −ay(0)e−at + e e x(τ )dτ
dt dt 0
Z t
= −a[y(0)e−at + e−at eaτ x(τ )dτ ] + x(t) = −ay(t) + x(t)
0
| {z }
y(t)

(c) Multiplying the two terms of the ordinary differential equation by eat we get

eat dy(t)/dt + aeat y(t) = eat x(t)


| {z }
d(eat y(t))/dt
Z t
eat y(t) = eaτ x(τ )dτ + y(0)
0

solving for y(t) we obtain the solution.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.18

2.18 (a) For x1 (t) = u(t) − u(t − 2) and zero initial conditions, we can use the convolution integral
Z t
y1 (t) = h(τ )x1 (t − τ )dτ
0
∞ Z t
X
= h1 (τ − 2k)x(t − τ )dτ
k=0 0

for k = 0, we find graphically the integral to be


Z t
z(t) = h1 (τ )x1 (t − τ )dτ = r(t) − 2r(t − 1) + 2r(t − 3) − r(t − 4)
0

graphically. So that

X
y1 (t) = z(t − 2k) = r(t) − 2r(t − 1) + r(t − 2)
k=0

(b) For x2 (t) = δ(t) − δ(t − 2), the output is

y2 (t) = h(t) − h(t − 2)


X∞ ∞
X
= h1 (t − 2k) − h1 (t − 2(k + 1))
k=0 k=0

X ∞
X
= h1 (t) + h1 (t − 2k) − h1 (t − 2k 0 )
k=1 k0 =1
= h1 (t)

where we changed to the variable k 0 = k + 1 in the second summation.


Also since x2 (t) = dx1 (t)/dt the output

dy1 (t)
y2 (t) = = u(t) − 2u(t − 1) + u(t − 2) = h1 (t)
dt

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.19

2.19 (a) The output is the sum of two modulated signals, and as such it is time-varying as each modulator is
time-varying.
(b) If we let m1 (t) = m2 (t) = m(t), the output is equal to the sum of two modulators so it is linear
since the modulators are liner. Also

s(t) = m(t)(cos(Ωc t) + sin(Ωc t)) = 2m(t) cos(Ωc t − π/4)

i.e., one modulator with a phase. This system is known to be linear.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.20

2.20 (a) We can either find the impulse response or show that the output is bounded for any input signal that
is bounded. To find the impulse response change the variable to σ = t − τ which gives
Z 0 Z T
−1 1
y(t) = x(t − σ)dσ = x(t − σ)dσ
T T 0 T

which is a convolution integral with h(t) = (1/T )[u(t) − u(t − T )]. This impulse response is absolutely
integrable as
Z ∞ Z T
1
|h(t)|dt = dt = 1
0 0 T
Likewise, if we assume that x(t) is bounded, i.e., there is a value M < ∞ such that |x(t)| < M , then
Z t Z t
1 M
|y(t)| ≤ |x(τ )|dτ ≤ dτ = M < ∞
T t−T T t−T

so system is BIBO stable.


(b) The ramp is not bounded, there is no M such that |r(t)| < M < ∞. So when we compute the output
of the stable system to the ramp we do not expect it to be bounded either. Indeed
Z
1 t t2 − (t − T )2 T
y(t) = τ dτ = =t−
T t−T 2T 2

increases as t increases, so it is unbound.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.21

2.21 (a) The following block diagram represents the echo system:

x(t) y(t)
+

τ –delay

y(t − τ )
α1 ..
.

τ –delay
y(t − (N − 1)τ )
αN −1
τ –delay
y(t − N τ )

αN

Figure 2.9: Problem 21: recursive model for echo system.

(b) When N = 1, τ = 1 and α = 0.1 the input/output equation for the echo system is

y(t) = x(t) + 0.1y(t − 1)

To check the LTI we need an explicit expression of the output in terms of the input. This can be obtained
by recursively replacing y(t − k), k = 1, 2, · · · in the right by the a delayed version of the input/output
equation, i.e.,

y(t) = x(t) + 0.1y(t − 1) = x(t) + 0.1x(t − 1) + 0.01x(t − 2) · · ·


X∞
= (0.1)k x(t − k)
k=0

Using this expression we have that if the input is x(t) = x1 (t) + x2 (t), with corresponding outputs y1 (t)
and y2 (t), then

X
(0.1)k [x1 (t − k) + x2 (t − k)] = y1 (t) + y2 (t)
k=0

so the echo system is linear. If we shift the input to x(t − n0 ) then the output will be

X
(0.1)k x(t − n0 − k) = y(t − n0 )
k=0

i.e., time-invariant. The system is then overall LTI.


(c) The non-recursive model can be written as
M
X
z(t) = βk x(t − kτ ) β0 = 1
k=0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.22

x(t − τ ) x(t − (M − 1)τ ) x(t − M τ )

x(t) τ –delay τ –delay ··· τ –delay

β1 β2 βM

z(t)

Figure 2.10: Problem 21: non-recursive model for echo system.

We have a finite representation of the output in terms of the inputs, attenuated and shifted in time. The
system resembles that in (b), and as in there it can be shown to be LTI.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.23

2.2 Problems using MATLAB


2.22 (a) The output voltage when the switch closes at t = 0 is

vo (t) = −R(t)u(t) = −(1 + 0.5 cos(20πt))u(t)

The initial value of the voltage is v(0) = −1.5.


(b) If the switch closes at t = 50 msec, the output voltage is

vo1 (t) = −R(t)u(t − 50 × 10−3 )



−(1 + 0.5 cos(20πt)) t ≥ 50 × 10−3
=
0 otherwise

with an initial value of vo1 (50 × 10−3 ) = −0.5.


(c) The initial values are different, and v01 (t) 6= vo (t − 50 × 10−3 ) so the system is time varying.
The following script is used for the plotting in (a) and (b)

%% Pr 2_22
t=0:0.01:0.2;M=length(t);
v0=-(1+0.5*cos(20*pi*t));
t1=0:0.01:0.05;
N=length(t1);
v01=[zeros(1,N) v0(N+1:M)];
figure(1)
subplot(211)
plot(t,v0); grid; axis([0 max(t) -1.7 0.2]); ylabel(’v_0(t)’)
subplot(212)
plot(t,v01); grid;axis([0 max(t) -1.7 0.2]); xlabel(’t’); ylabel(’v_{01}(t)’)

−0.5
v0(t)

−1

−1.5

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

−0.5
v01(t)

−1

−1.5

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
t

Figure 2.11: Problem 22

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.24

2.23 (a) The zener diode clips any signal that exceeds a set threshold, in this case 0.5, thus if we have a
sinusoid with amplitude 0.3, less than the threshold, the output of the zerner diode would be the same as
the input. When the amplitude of the input is 1 the output is a sinusoid clipped at 0.5, but when it is 0.3
is not a clipped sinuosoid. Thus, the system is non-linear as scaling does not hold.
(b) The zener diode would do the same thresholding to a signal x(t) or to a shifted version of it x(t − τ ),
so the system is time invariant.

%% Pr 2_23
t=0:0.001:4;
vs=cos(pi*t); x=vs;
% vs=0.3*cos(pi*t);x=vs; % for a second input get rid of %
N=length(t);
for k=1:N,
if abs(vs(k))>=0.5,
if vs(k)<0,
vs(k)=-0.5;
else
vs(k)=0.5;
end
end
end
y=vs;
figure(2)
plot(t,x); grid; hold on
plot(t,y,’or’); axis([0 4 -1.1 1.1]); legend(’x(t)’,’y(t)’); xlabel(’t’)
hold off

1 x(t)
y(t)
0.8

0.6

0.4

0.2

−0.2

−0.4

−0.6

−0.8

−1

0 0.5 1 1.5 2 2.5 3 3.5 4


t

Figure 2.12: Problem 23: input x(t) and output y(t) of the zener diode.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.25

2.24 (a) No, the diode is non-linear. For v(t) > 0 doubling the voltage does not double the current i(t)
because the voltage-current relation is not a 45o line.
(b) To get the current to be close to zero when the voltage is negative we would need that Is → 0 because
eqv(t)/kT − 1 ≤ 0. If the constant q/kT → ∞ the current would be very large for small values of the
voltage. The ideal diode is an approximation to the p-n diode with the voltage-current plot given by
the script below. The ideal diode is non-linear, the voltage-current plot is not a line of slope 45o . The
following is the plot for the given values of Is and the constant q/kT .

%% Pr. 2_24
v=-0.1:0.01:1;
Is=0.0001;kqT=0.026;
i=Is*(exp(v/kqT)-1);
figure(1)
plot(v,i);grid
axis([-0.1 1.2 -5 1.1*max(i)])
12
x 10

0
0 0.2 0.4 0.6 0.8 1 1.2

Figure 2.13: Problem 24: i-v response of the p-n diode.

(c) This is a half-wave rectifier used to obtain dc sources. The output is the positive part of the sinusoid
and zero whenever the sinusoid is negative.
1

0.8

0.6
|x(t)|

0.4

0.2

0 0.5 1 1.5 2 2.5 3 3.5 4


t

Figure 2.14: Problem 24: output of the half-wave rectifier.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.26

2.25 % Pr 2_25
clear all; clf
Ts=0.01; delay=1; Tend=20;
t=0:Ts:Tend;
%x=cos(2*pi*t).*(ustep(t,0)-ustep(t,-20));
%x=sin(2*pi*t).*exp(-0.1*t).*(ustep(t,0)-ustep(t,-20));
x=ramp(t,1,0)+ramp(t,-2,-2)+ramp(t,1,-8);
h=exp(-t);
y=Ts*conv(x,h);
% plots
t1=0:Ts:length(y)*Ts-Ts;
figure(1)
subplot(311)
plot(t,x); axis([0 20 -5 3]);grid;ylabel(’x(t)’);
subplot(312)
plot(t,h); axis([0 20 -0.1 1]);grid;ylabel(’h(t)’);
subplot(313)
plot(t1,y);
grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.27

x(t)
−2

−4
0 2 4 6 8 10 12 14 16 18 20

0.5

h(t)
0
0 2 4 6 8 10 12 14 16 18 20

0.2

0.1

−0.1

−0.2
0 5 10 15 20 25 30 35 40

0
x(t)

−2

−4
0 2 4 6 8 10 12 14 16 18 20

0.5
h(t)

0
0 2 4 6 8 10 12 14 16 18 20

0.6

0.4

0.2

−0.2
0 5 10 15 20 25 30 35 40

0
x(t)

−2

−4
0 2 4 6 8 10 12 14 16 18 20

0.5
h(t)

0
0 2 4 6 8 10 12 14 16 18 20

−2

−4

−6
0 5 10 15 20 25 30 35 40

Figure 2.15: Problem 25: input, impulse response and output of convolution integral.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.28

2.26 This averager is a LTI system


(a) The average signal for T = 1 and x(t) = u(t) is

 0 t<0


Z t 
 R
t
y(t) = u(τ )dτ = 0
dτ = t 0≤t<1
t−1 

 R
 t

t−1
dτ = 1 t≥1

Using the LTI of the system, the response to x1 (t) = x(t) − x(t − 1) = u(t) − u(t − 1) is then

 t 0≤t≤1
y1 (t) = y(t) − y(t − 1) = 1 − (t − 1) = 2 − t 1 ≤ t ≤ 2
0 otherwise

which is a triangular signal.


(b) The implementation of the averager can be seen as the sliding, from left to right, of a rectangular window of
width T and amplitude 1, and adding the values of the signal in that window to get the output. If we let T = T0 , the
period of the sinusoid x(t) = cos(2πt/T0 )u(t) after zero, the output of the averager is zero for t ≤ 0. There is then
a transient for 0 ≤ t ≤ T0 , and the output will be zero for t ≥ t0 , as the average of the sinusoids is zero.
(c) The following script is used to implement this convolution in (a) and (b).

%% Pr. 2_26
N=1000; Ts=1/N;
tt=0:Ts:2; x=cos(2*pi*tt);
h=[ones(1,N) zeros(1,N+1)];
y=conv(x,h)*Ts;t=0:Ts:(length(y)-1)*Ts;
figure(5)
subplot(211)
plot(tt,x);hold on;plot(tt,h,’or’); legend(’x(t)’,’h(t)’);
axis([0 2 -1.1 1.1]); grid
subplot(212)
plot(t(1:length(t)/2),y(1:length(t)/2));grid
axis([0 2 1.1*min(y) 1.1*max(y)]); ylabel(’x*h’); xlabel(’t’)

1
x(t)
0.5 h(t)

−0.5

−1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0.15
0.1
0.05
x*h

0
−0.05
−0.1
−0.15
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t

Figure 2.16: Problem 26:Sinusoid and impulse response (top), result of convolution.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.29

2.27 (a) The system with the sinc impulse response is non-causal because h(t) 6= 0 for t < 0. As such an ideal
low-pass filter cannot be used for real-time processing as it would require future inputs, not available in
real-time. This can be seen by looking at the convolution with a causal signal x(t):
Z ∞
y(t) = x(τ )h(t − τ )dτ
0
Z t Z ∞
= x(τ )h(t − τ )dτ + x(τ )h(t − τ )dτ
0 t

where the upper limit of the top integral is due to h(τ ) having an infinite support, and the lower limit
because x(t) is causal. The second bottom integral shows that the output depends on future values of the
input.
(b) For the low-pass filter to be BIBO stable the impulse response h(t) must be absolutely integrable,
i.e., Z ∞
| sin(t)/t|dt < ∞
−∞

To approximtely compute this integral we use the following script. The integral is bounded, so the filter
is BIBO stable.

%% Pr 2_27
clear all; clf
syms x t x1
x=abs(sinc(t/pi));
for k=1:30,
x1=int(x,t,0,k);
xx(k)=subs(2*x1);
end
n=1:30;
figure(1)
subplot(211)
ezplot(x,[-30,30]); axis([-30 30 -0.1 1.2]);grid
subplot(212)
stem(n,xx); axis([1 30 0 8]);grid

abs(sin(t))/abs(t)

1
0.8
0.6
0.4
0.2
0
−30 −20 −10 0 10 20 30
t

6
Integral

0
0 5 10 15 20 25 30
n

Figure 2.17: Problem 27: absolute value of sinc function and its integral values for t = n sec.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.30

2.28 %% Pr. 2_28


clear all; clf
% parts (a)--(c)
Ts=0.01;
t=0:0.01:100; N=length(t)
p=[20*ones(1,4000) -10*ones(1,2000) zeros(1,N-6000)];
P=1.1*abs(min(p))
x=(p+P).*cos(2*pi*t);
figure(6)
subplot(221)
plot(t,p); ylabel(’p(t)’)
subplot(222)
plot(t,x); ylabel(’x(t)’)
y=abs(x);
subplot(223)
plot(t,y); ylabel(’y(t)’)
h=exp(-0.8*t);
z=conv(h,y)*Ts; z=z*20/15;
subplot(224)
plot(t,z(1:length(t))-P); ylabel(’z(t)’); xlabel(’t’)
% part (d)
Ts=0.01;
t=0:0.01:100;N=length(t)
p=2*cos(0.2*pi*t);
P=abs(min(p))
x=(p+P).*cos(10*pi*t);
figure(7)
subplot(221)
plot(t,p+P); ylabel(’p(t)+P(t)’)
subplot(222)
plot(t,x); ylabel(’x(t)’)
y=abs(x);
subplot(223)
plot(t,y); ylabel(’y(t)’); xlabel(’t’)
h=exp(-0.8*t);
z=conv(h,y)*Ts;z=z-P+0.4;z=z*2/max(z);
subplot(224)
plot(t,z(1:length(t)));grid; ylabel(’z(t)’); xlabel(’t’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.31

40
20
20
10

p(t)

x(t)
0
0

−10 −20

−20 −40
0 20 40 60 80 100 0 20 40 60 80 100

30
20
20
10
10

y(t)

z(t)
0 0

−10 −10

−20 −20
0 20 40 60 80 100 0 20 40 60 80 100
t

4 4

3 2
p(t)+P(t)

x(t)
2 0

1 −2

0 −4
0 20 40 60 80 100 0 20 40 60 80 100

4 2

1
3
0
y(t)

z(t)

2
−1
1
−2

0 −3
0 20 40 60 80 100 0 20 40 60 80 100
t t

Figure 2.18: Problem 28: modulation and envelope detection for pulses and for sinusoid.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.32

2.29 %% Pr. 2_29


clear all; clf
% part (a)
Ts=0.01;
t=0:Ts:10;
omega_c=2*pi; nu=10;
m=cos(t); %% message
im=sin(t); %% integral of message
y=cos(omega_c*t +2*pi*nu*im); %% FM1 with nu=10
y1=cos(omega_c*t +2*pi*nu*im/10); %% FM2 with nu/10
figure(9)
subplot(311)
plot(t,m); ylabel(’m(t)’)
subplot(312)
plot(t,y); ylabel(’y(t)’)
subplot(313)
plot(t,y1); ylabel(’y_1(t)’)
% part(b)
N=length(t)
for k=1:N,
if m(k)>=0,
m1(k)=1; %% message
y(k)=cos(omega_c*k*Ts +2*pi*nu*k*Ts/10); %% FM
else
m1(k)=-1;
y(k)=cos(omega_c*k*Ts -2*pi*nu*k*Ts/10);

end
end
figure(10)
subplot(211)
plot(t,m1); ; ylabel(’m_1(t)’)
axis([0 10 1.1*min(m1) 1.1*max(m1)])
subplot(212)
plot(t,y); ylabel(’y(t)’)
axis([0 10 1.1*min(y) 1.1*max(y)])

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.33

1
0.5
m(t)

0
−0.5
−1
0 1 2 3 4 5 6 7 8 9 10

1
0.5
y(t)

0
−0.5
−1
0 1 2 3 4 5 6 7 8 9 10
1
0.5
y1(t)

0
−0.5
−1
0 1 2 3 4 5 6 7 8 9 10

0.5
m1(t)

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10

0.5
y(t)

−0.5

−1
0 1 2 3 4 5 6 7 8 9 10

Figure 2.19: Problem 29: message signal m(t) and FM signals for ν = 10 and 1 (top); message m1 (t) and
FM signal for ν = 1 (bottom)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 2.34

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 3

The Laplace Transform

3.1 Basic Problems


3.1 (a) Finite–support signals.
R∞
i. L[x(t)] = −∞ δ(t − 1)e−st dt = e−s , ROC the whole s-plane
ii. L[y(t)] = es − e−s = 2 sinh(s), ROC the whole s-plane
iii. We have
es − e−s sinh(s)
L[z(t)] = L[u(t + 1)] − L[u(t − 1)] = =2
s s
ROC whole s-plane, pole-zero cancellation at s = 0.
iv. Notice that because cos(2π(t ± 1)) = cos(2πt ± 2π) = cos(2πt) then
w(t) = cos(2πt)[u(t + 1) − u(t − 1)] = cos(2π(t + 1))u(t + 1) − cos(2π(t − 1))u(t − 1)
so that
es s e−s s (es − e−s )s 2s sinh(s)
W (s) = − = = 2
s2 + 4π 2 s2 + 4π 2 s2 + 4π 2 s + 4π 2
The poles p1,2 = ±j2π are cancelled by zeros z1,2 = ±j2π ( indeed, e −e−s |s=±j2π = 1−1 = 0)
s

so the ROC is the whole s-plane.


(b) Causal signals.
i. X1 (s) = L[x1 (t)] = 1/(s + 1), ROC σ > −1
ii. Notice the exponential is not delayed, so the shifting property cannot be applied. Instead,
e−(s+1)
Y1 (s) = L[y1 (t)] = L[e−1 e−(t−1) u(t − 1)] = , ROC σ > −1
s+1
iii. L[z1 (t)] = L[e−(t−1) u(t − 1)] = e−s /(s + 1), ROC σ > −1
iv. Since w1 (t) = x1 (t) − y1 (t), where x1 (t) and y1 (t) are given before then
1 − e−(s+1)
L[w1 (t)] = X1 (s) − Y1 (s) = ,
s+1
ROC whole s-plane because pole s = −1 is cancelled by zero, i.e., 1 − e−(s+1) |s=−1 = 0.

1
Chaparro — Signals and Systems using MATLAB 3.2

3.2 (a) Anti–causal signals.


i. Using the integral definition of Laplace transform:
Z 0 Z 0 Z ∞
−1 1
X(s) = et e−st dt = − e−τ esτ dτ = e(s−1)τ dτ = =
−∞ ∞ 0 s−1 1−s
by letting τ = −t. The ROC is σ < 1 to make upper limit of the integral go to zero.
ii. Let v(t) = y(−t) = e−t u(t − 1) with V (s) = e−1 e−s /(s + 1), ROC: σ > −1 then

e(s−1)
Y (s) = V (−s) = , ROC: σ < 1.
−s + 1
A direct way is
Z −1
Y (s) = et e−st dt letting t0 = −t
−∞
Z ∞
0 es−1
= e−t (1−s) dt0 = ROC 1 − σ > 0 or σ < 1
1 1−s
iii. We have
Z ∞
Z(s) = et+1 u(−(t + 1))e−st dt letting ρ = −(t + 1)
−∞
Z ∞ Z ∞
−ρ s(ρ+1) eρ(s−1) ∞ es
= e u(ρ)e dρ = es eρ(s−1) dρ = es |0 =
−∞ 0 s−1 −s + 1
ROC: σ < 1 to make the upper limit of the integral go to zero.
iv. w(t) = et u(−t) − et u(−t − 1) = x(t) − y(t),

1 e(s−1) e(s−1) − 1
W (s) = − + =
s−1 s−1 s−1
ROC: whole s-plane, since pole s = 1 is cancelled by zero at s = 1( indeed, e(s−1) − 1|s=1 =
0). Notice that due to the pole–zero cancellation the region of convergence is not the intersec-
tion of the ROCs of X(s) and Y (s)
(b) Non–causal signals.
i. X1 (s) = (es − e−s )/s = 2 sinh(s)/s, ROC whole s-plane because pole at s = 0 is cancelled
by zero at s = 0 (since sinh(0) = 0).
ii. y1 (t) = e−t u(t + 1) = e[e−(t+1) u(t + 1)] so

e(s+1)
Y1 (s) = , ROC: σ > −1.
s+1
iii. We have
es−1 − e−(s−1)
Z1 (s) = L[(e(t+1) u(t + 1))e−1 ] − L[(e(t−1) u(t − 1))e] =
s−1
2 sinh(s − 1)
= ROC: whole s-plane
s−1
because there is pole/zero cancellation at s = 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.3

3.3 (a) The signal

y(t) = sin(2πt)[u(t) − u(t − 1)] = sin(2πt)u(t) − sin(2π(t − 1))u(t − 1)

is the first period of the sinusoid. Its Laplace transform is



Y (s) = X(s)[1 − e−s ], X(s) = L[sin(2πt)u(t)] =
s2 + 4π 2
Since y(t) has finite support, Y (s) has as ROC the whole s-plane. The poles of the Laplace transform of
the sine are cancelled by the zeros. The zeros let 1 − e−s = 0 or e−s = 1 = ej2π or s1,2 = ±j2π, which
correspond to the poles of L[sin(2πt)u(t)].
(b) Let x1 (t) = cos(2πt)u(t) then

cos(2πt)[u(t) − u(t − 1)] = x1 (t) − x1 (t − 1)

and so
x(t) = [u(t) − u(t − 1)] − x1 (t) + x1 (t − 1)
with Laplace transform
 
1 1 s
X(s) = (1−e−s )−X1 (s)[1−e−s ] = [1−e−s ] − X1 (s)] , X1 (s) = L[cos(2πt)u(t)] = 2
s s s + 4π 2
Since x(t) is of finite support its ROC is the whole plane. The zeros of X(s) cancel its poles. The zeros
s1,2 = ±j2π, 0, correspond to the poles of L[cos(2πt)u(t)] and the pole s = 0. There is a cancellation
of all the poles.
(c) There are different ways to find the Laplace transform of cos2 (t)u(t):
• Expressing
cos2 (t)u(t) = 0.5 cos(t)[ejt + e−jt ]u(t)
and finding the Laplace transform of the modulated exponentials.
• Considering cos2 (t)u(t) the product of two equal signals, so that its Laplace transform is the con-
volution of the Laplace transform of cos(t)u(t) with itself.
• Finally, cos2 (t)u(t) = 0.5(1 + cos(2t))u(t) and then finding the Laplace transform of the two
components.
Option 1, gives
L[cos2 (t))u(t)] = 0.5L[cos(t)ejt u(t)] + 0.5L[cos(t)e−jt u(t)]
and Z ∞  
1 1
L[cos(t)ejt u(t)] = 0.5(ej2t + 1)e−st dt = 0.5 +
0 s − j2 s
so that  
2 1 s
L[cos (t)u(t)] = 0.5 + 2
s s +4

Option 3 gives
   
2 1 1 s
L[cos (t)u(t)] = L[1/2(1 + cos(2t))u(t)] = 0.5 + L[cos(2t)u(t)] = 0.5 +
s s s2 + 4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.4

3.4 (a) i. For α > 0,


1 1 −2s 2s
X(s) = − = 2 2
= 2 ROC: − α < σ < α
s + α −s + α α −s s − α2
where the ROC is the intersection of ROC of 1/(s + α), or σ > −α, and the ROC of 1/(−s +
α), or σ < α.
ii. As α → 0, x(t) = u(t) − u(−t), the sign signal, which has no Laplace transform because
ROC does not exist.
(b) For the sampled signal
N
X −1 N
X −1
1 − e−(s+2)N
X1 (s) = e−2n L[δ(t − n)] = e−(s+2)n =
n=0 n=0
1 − e−(s+2)

The poles of X1 (s) are values of s that make e−(s+2) = 1 = ej2πk , or sk = −2 − j2πk for k =
0, ±1, ±2 · · · . Similarly, the zeros of X1 (s) are sm = −2 − j2π(m/N ) for m = 0, ±1, ±2 · · · .
Because the poles are cancelled when m = 0, ±N, ±2N, · · · (i.e., multiples of N ), the ROC of
X1 (s) is the whole s-plane.
(c) We have

X X∞
e−ns 1
S(s) = L[u(t − n)] = =
n=0 n=0
s s(1 − e−s )

The poles are s = 0 and values of s that make 1 − e−s = 0 or sk = −j2πk for k = 0, ±1, · · · .
Thus, all the poles are on the jΩ-axis and the signal is causal, as such the ROC is σ > 0.
(d) Since sin(2πt) = sin(2πt − 2π) = sin(2π(t − 1)) we have

v(t) = [cos(2(t − 1)) + sin(2π(t − 1))]u(t − 1)

then
e−s s 2πe−s
V (s) = + 2 , ROC: σ > 0
s + 4 s + 4π 2
2

(e) The Laplace transform of y(t) is


Z ∞ Z ∞
2
Y (s) = t2 e−2t u(t)e−st dt = (t2 u(t))e−(s+2)t dt = L[t2 u(t)]s→s+2 =
−∞ −∞ (s + 2)3

with ROC σ + 2 > 0 or σ > −2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.5

3.5 (a)
Z ∞
L[x(t)e−at u(t)] = [x(t)u(t)]e−(s+a)t dt = X(s + a)
−∞

i.e., multiplying by e−at shifts the complex frequency s to s + a. This property is called frequency
shift. Thus,
s+2
Y (s) = L[(cos(t)u(t))e−2t ] = L[cos(t)u(t)]s→s+2 =
(s + 2)2 + 1

(b) The zero is s = −2 and the poles s1,2 = −2 ± j. Because the poles are in the left-hand s-
plane x1 (t) → 0 as t → ∞. Indeed, we have that X1 (s) is the Laplace transform of x1 (t) =
cos(t)e−2t u(t) which tends to zero as t → ∞.
(c) i. z(t) = −e−t u(t) + δ(t), so
−1 s
Z(s) = +1=
s+1 s+1
ii. If f (t) = e−t u(t), then z(t) = df (t)/dt so
s s
Z(s) = sL[f (t)] − f (0−) = −0= .
s+1 s+1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.6

3.6 The transform is X(s) = (1 − e−s )/s. The pole of X(s) is s = 0, while the zeros of X(s) are values of
s that make 1 − e−s = 0 or sk = j2kπ for −∞ < k < ∞ and integer. The pole is cancelled with the
k = 0 zero, so X(s) has an infinite number of zeros on the jΩ-axis.
(a) The output of the LTI system has Laplace transform

(s + j2π)(s − j2π) Y
Y (s) = X(s)H(s) = (s + j2πk)(s − j2πk)
s2 + 4π 2
k=2

Y
= (s2 + (2πk)2 )
k=2

There are no poles, but an infinite number of zeros at ±j2πk for integer k ≥ 2.
(b) This is similar to the above problem, but here

Z(s) = X(s)G(s) = 1

which gives
z(t) = δ(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.7

3.7 (a) The Laplace transform of u(−t) is −1/s, indeed


Z 0 Z ∞
−st esτ ∞ 1
L[u(−t)] = e dt = esτ dτ = | =−
−∞ 0 s τ =0 s

provided that σ < 0 so that the limit when τ = ∞ is zero. Thus


−1
L[u(−t)] = ROC : σ < 0
s
Thus x(t) = u(t) + u(−t) = 1 for all t would have as Laplace transform
1 1
X(s) = − =0
s s
and as ROC the intersection of σ > 0 and σ < 0 which is null. So we cannot find the Laplace of
x(t) = 1, −∞ < t < ∞.
(b) Let y(t) = yc (t) + yac (t) where the causal component yc (t) = y(t)u(t) = e−t u(t) and the
anticausal component yac (t) = y(t)u(−t) = et [u(t + 1) − u(t)]. The Laplace transform of yac (t)
is
Z 0 Z 1
e(s−1) − 1
Yac (s) = e−(s−1)t dt = e(s−1)τ dτ =
−1 0 s−1

with ROC the whole plane (pole at s = 1 is cancelled by zero at 1).


The Laplace transform of yc (t) is Yc (s) = 1/(s + 1), so that

1 es−1 − 1
Y (s) = Yc (s) + Yac (s) = +
s+1 s−1
ses−1 + es−1 − 2
= ROC σ > −1
s2 − 1
The poles of Y (s) are s = ±1, and a zero is s = 1. Thus the zero cancels the pole at s = 1 leaving
the pole at s = −1, and so the ROC is σ > −1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.8

3.8 (a) The signal x(t) and its first derivative are shown in Fig. (3.1). The second derivative is

x(t)
1

1 2 3 4
t

1
dx(t)
dt

1
1 3
4 t
1

d2 x(t)
dt2
(2)

(1)
1 4
t
3
( 1)

( 2)

Figure 3.1: Problem 8

d2 x(t)
= δ(t) − 2δ(t − 1) + 2δ(t − 3) − δ(t − 4)
dt2
(b) The Laplace transform of the second derivative is

s2 X(s) = 1 − 2e−s + 2e−3s − e−4s

from which we obtain


e−2s 2s s −s −2s e−2s
X(s) = [e − 2e + 2e − e ] = [2 sinh(2s) − sinh(s)]
s2 s2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.9

3.9 (a) Writing


e−2s 1 2
Y1 (s) = + +
s + 1 s + 2 (s + 2)3
2

then from the table of Laplace transforms:

y1 (t) = sin(t − 2)u(t − 2) + e−2t u(t) + t2 e−2t u(t)

(b) Expressing Y2 (s) in terms X2 (s) and I(s) (due to the initial conditions) as:

X(s) I(s)
Y2 (s) = + 2
s2 + 3s + 2 s + 3s + 2
1 −s − 1
= +
s(s2 + 3s + 2) s2 + 3s + 2

we have that I(s) = −s − 1, and (s2 + 3s + 2)Y2 (s) = X(s) would give the ordinary differential
equation
d2 y2 (t) dy2 (t)
2
+3 + 2y2 (t) = x2 (t)
dt dt
Its Laplace transform gives

(s2 + 3s + 2)Y2 (s) − sy2 (0) − dy2 (0)/dt − 3y2 (0) = X(s)

so that I(s) = sy2 (0) + (dy2 (0)/dt + 3y2 (0)) which compared with I(s) = −s − 1 gives y2 (0) =
−1 and dy2 (0)/dt = −1 − 3y2 (0) = 2.
(c) We have that
A Bs + C
Y (s) = +
s (s + 1)2 + 4
A = Y (s)s|s=0 = 1/5, then

A −s/5 − 2/5 Bs + C
Y (s) − = 2
=
s (s + 1) + 4 (s + 1)2 + 4

gives B = −1/5 and C = −2/5, so


1 1 s+1 1 2
Y (s) = − −
5s 5 (s + 1)2 + 4 10 (s + 1)2 + 4

The steady state response is yss = 1/5, while the transient is

yt (t) = [−(1/5)e−t cos(2t) − (1/10)e−t sin(2t)]u(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.10

3.10 (a) Considering zero initial conditions the Laplace transform of the ordinary differential equation is

(s2 + 3s + 2)Y (s) = X(s) ⇒


Y (s) 1
H(s) = = 2
X(s) s + 3s + 2

s2 + 3s + 2 = (s + 1)(s + 2), so the poles are at s = −1 and s = −2, both in the left-hand s-plane
so the system is BIBO stable. Equivalently, the impulse response h(t) = L−1 [H(s)] can be shown
to be absolutely integrable. Indeed,
 
1 −1
h(t) = L−1 + = [e−t − e−2t ]u(t) and
s+1 s+2
Z ∞
|h(t)|dt = −e−t + 0.5e−2t |∞
0 = 1 − 0.5 = 0.5
−∞

(b) If X(s) = 1/s then


1 I(s)
Y (s) = + 2
s(s2 + 3s + 2) s + 3s + 2
where the term I(s) corresponds to the initial conditions. If I(s) = 0 then

1 A B C
Y (s) = = + + , where A = Y (s)s|s=0 = 0.5
s(s2 + 3s + 2) s s+1 s+2

and the steady state is yss (t) = 0.5 since the other terms disappear. If the initial conditions are
not zero, the inverse Laplace transform of I(s)/((s + 1)(s + 2)) will give terms that disappear as
t → ∞ because the poles are in the left-hand s-plane. Thus the ICs do not have any effect in this
case when the system is BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.11

3.11 (a) The following term corresponds to the zero-state

(s − 1)X(s)
(s + 2)2 + 1

and the following term corresponds to zero-input


1
.
(s + 2)2 + 1

Zero-state response for x(t) = u(t)

s−1 A B + Cs
Yzs (s) = = +
s((s + 2)2 + 1) s (s + 2)2 + 1
−1/5 9/5 + s/5 −1/5 1 (s + 2) + 7
= + = +
s (s + 2)2 + 1 s 5 (s + 2)2 + 1
−1/5 1 (s + 2) 7 1
= + +
s 5 (s + 2) + 1 5 (s + 2)2 + 1
2

From the table of Laplace transforms

yzs (t) = −(1/5)u(t) + (1/5)e−2t cos(t)u(t)


+(7/5)e−2t sin(t)u(t)

(b) Zero-input response


1
Yzi (s) = ⇒ yzi (t) = e−2t sin(t)u(t)
(s + 2)2 + 1

(c) As t → ∞ y(t) → −1/5.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.12

3.12 (a) The Laplace transform of s(t) = (h ∗ x)(t) is S(s) = H(s)X(s) which gives
1
S(s) = ⇒ s(t) = e−t sin(t)u(t)
(s + 1)2 + 1

(b) By LTI

y1 (t) = s(t) − s(t − 1)


y2 (t) = ds(t)/dt − ds(t − 1)/dt
Z t
y3 (t) = s(t0 )dt0
−∞

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.13

3.13 (a) Zeros: s = ±j2, poles: s1 = 0, s2,3 = −1 ± j. The system is not BIBO because of the pole at
zero.
(b) For x(t) = cos(2t)u(t)

s2 + 4 s 1
Y (s) = =
s((s + 1)2 + 1) s2 + 4 (s + 1)2 + 1

y(t) = e−t cos(t)u(t), and limt→∞ y(t) = 0.


(c) When x(t) = sin(2t)u(t)

s2 + 4 2 2
Y (s) = =
s((s + 1)2 + 1) s2 + 4 s((s + 1)2 + 1)
1 B + C(s + 1) 1 B C(s + 1)
= + = + +
s (s + 1)2 + 1 s (s + 1)2 + 1 (s + 1)2 + 1

giving a steady state yss (t) = 1.


Although not needed to find the steady state, the values of B are obtained as follows
 
1 2 −s − 2 B + C(s + 1)
2
−1 = 2
=
s (s + 1) + 1 (s + 1) + 1 (s + 1)2 + 1

so that B = C = −1.
(d) If x(t) = u(t) then
s2 + 4
Y (s) =
s2 ((s+ 1)2 + 1)
the response is a ramp and exponentially decaying sinusoids, so the steady state will be infinity or
no steady–state response.
(e) The pole/zero cancellations in the first two cases permit us to find bounded responses for this
unstable system. However when the input is u(t) there is no pole/zero cancellation and the output
is unbounded.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.14

3.14 (a)–(c) h1 (t) is unbounded and corresponds to an unstable causal system,


h2 (t) is absolutely integrable and corresponds to a non–causal stable system,
h3 (t) is unbounded and corresponds to an unstable anti–causal system. The transfer functions are

2/3 1/3
H1 (s) = + ROC: σ > 1
s+2 s−1
2/3 1/3
H2 (s) = − ROC: − 2 < σ < 1
s + 2 −s + 1
−2/3 1/3 2/3 1/3
H3 (s) = − = − ROC: σ < −2
−s − 2 −s + 1 s + 2 −s + 1

j⌦ j⌦ j⌦

⇥ ⇥ ⇥ ⇥ ⇥ ⇥
2 1 2 1 2 1

(a) (b) (c)

Figure 3.2: Problem 14: ROCs of (a) H1 (s), (b) H2 (s), (c) H3 (s).

only the region of convergence of the second transfer function includes the jΩ-axis and so it is the one
corresponding to a stable system, the others correspond to unstable systems as determined using the
impulse response. See Fig. 3.2 for the ROCs. (d) Independent of whether the LTI is causal, non-causal
or anti-causal, the system is BIBO stable if the ROC of the corresponding transfer function contains the
jΩ−axis.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.15

3.15 (a) S(s) = H(s)X(s), so H(s) = S(s)/X(s) = sS(s)


 
0.5 1 0.5 1
H(s) = s − + =
s s+1 s+2 (s + 1)(s + 2)

(b) If u(t) → s(t) are input-output pairs, then

Input Output
δ(t) = du(t)/dt h(t) = ds(t)/dt
Rt Rt
r(t) = −∞ u(t0 )dt0 ρ(t) = −∞ s(t0 )dt0

or in the Laplace domain:

Input Output
L[u(t)] = 1/s S(s)
L[δ(t)] = sL[u(t)] = 1 H(s) = sS(s)
L[r(t)] = (1/s)L[u(t)] = 1/s2 ρ(s) = S(s)/s

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.16

3.16 (a) The transfer function is

1 e−a e−s 1 − e−(s+a)


H(s) = − = ROC: whole s plane
s+a s+a s+a
because pole/zero cancellation at s = −a.
(b) Pole s = −a; zeros are values of s such that e−(s+a) = 1 = ej2πk for k = 0, ±1, ±2, · · · , or
sk = −a − j2πk (the zero s0 = −a cancels the pole at s = −a).
(c) As a → 0
1 − e−s
H(s) =
s
(d) Pole s = −a and zeros sk = −a − j2πk; pole/zero cancellation when k = 0. As a → 0 the
remaining zeros move towards the jΩ axis.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.17

3.17 (a) H(s) = Y (s)/X(s) = 1/(s2 + 4) so that (s2 + 4)Y (s) = X(s) giving

d2 y(t)
+ 4y(t) = x(t)
dt2
(b) The Laplace transform including initial conditions is

dy(0)
s2 Y (s) − y(0)s − + 4Y (s) = X(s)
dt
(s2 + 4)Y (s) = 1 + X(s)
1 + X(s)
Y (s) = 2 = 0 ⇒ X(s) = −1
s +4
or x(t) = −δ(t)

(c) Assuming initial conditions y(0) and y 0 (0), the Laplace transform of Y (s) is

X(s) sy(0) + y 0 (0)


Y (s) = +
s2 + 4 s2 + 4
and if Y (s) = 0 then
sy(0) + y 0 (0) + 1 = 0
after replacing X(s) = 1. Thus y(0) = 0 and y 0 (0) = −1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.18

3.18 (a) Poles satisfy the identity e−s = 1 = ej2πk for k = 0, ±1, ..., so there are an infinite number of
poles, sk = −j2πk. No zeros. The system is unstable because of poles on jΩ-axis.

x(t) + y(t)

Delay
y(t − 1)

Figure 3.3: Problem 18

(b) Y (s)(1 − e−s ) = X(s) gives y(t) = y(t − 1) + x(t). A positive feedback system with a delay in
the feedback represents the system. See Fig. 3.3.
(c) The transfer function is
X∞
1
H(s) = = (e−s )n
1 − e−s n=0

with inverse

X
h(t) = δ(t − n)
n=0

which is not absolutely integrable


Z ∞ ∞ Z
X ∞ ∞
X
|h(t)|dt = δ(t − n)dt = 1→∞
−∞ n=0 −∞ n=0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.19

3.19 (a) h(t) is a triangular pulse of duration 2, then for any T



X
y(t) = [x ∗ h](t) = h(t − kT )
k=0

If T = 1, the triangular pulses superpose to give square pulses after t = 1 so



 0 t<0
y(t) = t 0≤t≤1

1 t>1

If T = 2, y(t) is a sequence of triangular pulses for t ≥ 0. See Fig. 3.4.

y(t) T =1
1 ···
t
1

y(t) T =2
1
···
t
2 4

Figure 3.4: Problem 19

(b) The transfer function is

1 2e−s 2e−s (cosh(s) − 1)


H(s) = 2
(1 − 2e−s + e−2s ) = 2 (0.5es − 1 + 0.5e−s ) =
s s s2
then for T = 2

X ∞
X ∞
X
Y (s) = L[h(t − kT )] = H(s)e−2ks = H(s) (e−2s )k
k=0 k=0 k=0
−s
2e (cosh(s) − 1) 1 2e−s (cosh(s) − 1) 1
= −2s
=
s2 1−e s2 e (e − e−s )
−s s

cosh(s) − 1
=
s2 sinh(s)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.20

3.20 (a) Letting x(t) = δ(t) so that y(t) = h(t) we get

h(t) = αδ(t − T ) + α3 δ(t − 3T )

(b) H(s) = αe−sT + α3 e−s3T


H(s) has no poles, its zeros satisfy αe−sT + α3 e−s3T = 0 or (dividing by αe−sT > 0)

1 = e−jπ α2 e−2T s = α2 e−2T (σ+j(Ω+π/(2T )) letting s = σ + jΩ


1e−j2πk = (α2 e−2T σ )e−j2T (Ω+π/(2T )) , k = 0, ±1, ±2, · · ·

so that
log α2
1 = α2 e−2T σ ⇒ σ = , real part of zeros
2T
(2k − 1)π
−j2T (Ω + π/(2T )) = −jk2π ⇒ Ω = , imaginary part of zeros
 2T

log α2 (2k − 1)π
zeros s = σ + jΩ = +j
2T 2T

System is BIBO stable since σ = log(α)/T < 0 because 0 < α < 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.21

3.21 (a) z(t) = (1 − t)[u(t) − u(t − 1)], then

dz(t)
x(t) = = −1(u(t) − u(t − 1)) + (1 − t)(δ(t) − δ(t − 1))
dt
= δ(t) − (u(t) − u(t − 1))

(b) For the above x(t)

y(t) = e−2t u(t) − 0.5(1 − e−2t )u(t) + 0.5(1 − e−2(t−1) )u(t − 1)

(c) For the second system when the input is x(t) = δ(t) the corresponding output is y(t) = e−2t u(t)
so the transfer function of the second system is

Y (s) 1
H(s) = =
X(s) s+2

giving dy(t)/dt + 2y(t) = x(t) = dz(t)/dt.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.22

3.22 (a)
1 1
X(s) =(1 − 2e−s + e−2s ) = (1 − e−s )2
s s
with the whole s-plane as ROC. Pole s = 0 is cancelled by zero s = 0. The transfer function is
Y (s) s+2 1 1
H(s) = = 2
= + ROC σ > 0
X(s (s + 1) s + 1 (s + 1)2

Using the frequency shift property, the inverse of 1/(s + 1)2 is e−t r(t), so

h(t) = e−t (1 + t)u(t)

(b) The partial fraction expansion gives


A Bs + C
X(s) = + 2
s s + 2s + 10
Since the roots of s2 + 2s + 10 = (s + 1)2 + 9 = 0 are

s1,2 = −1 ± j3

the steady state is given by the A/s term. As t → ∞, the terms corresponding to complex roots
goes to zero. We have A = 1/10 and

lim x(t) = 1/10


t→∞

(c) The poles of Z(s) are s = 0 and s = −2 ± j1. The inverse transform corresponding to the complex
roots goes to zero in the steady state. Thus

lim z(t) = sZ(s)|s=0 = 1/5


t→∞

(d) Since e−s simply shifts the inverse by one, it does not affect the steady state. Letting W1 (s) =
1/(s((s − 2)2 + 1) the complex poles s12 = 2 ± j have a positive real part so that its response will
grow as t increases and as such there will be no steady–state.
(e) The partial fraction expansion is
A B + Cs
V (s) = +
s (s + 1)2 + 1
where
A = V (s)s|s=0 = 0.5
so that the steady state is 0.5 since the other term has poles in the left-hand s-plane, s1,2 = −1 ± j1,
which would give a transient. If we subtract 0.5/s from V (s) we obtain the Laplace transform of
the transient, thus
0.5 0.5s 0.5s + 0.5 0.5
V (s) − =− =− +
s (s + 1)2 + 1 (s + 1)2 + 1 (s + 1)2 + 1
which gives the transient

vt (t) = −0.5e−t cos(t)u(t) + 0.5e−t sin(t)u(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.23

3.23 (a) Using the Laplace transform


1
H(s) =
s+2
1 − e−3s
X(s) =
s
1 − e−3s
Y (s) = H(s)X(s) =
s(s + 2)
Letting
1 0.5 0.5
F (s) = = − ⇒ f (t) = 0.5(1 − e−2t )u(t)
s(s + 2) s s+2
then
y(t) = f (t) − f (t − 3) = 0.5(1 − e−2t )u(t) − 0.5(1 − e−2(t−3) )u(t − 3)
Graphically, we plot h(τ ) and x(t − τ ) as functions of τ and shift x(t − τ ) from the left to the right and
integrate the overlapping areas to get

 0 t<0



 R
t −2τ
y(t) = 0
e dτ = 0.5(1 − e−2t ) 0≤t<3




 Rt
t−3
e−2τ dτ = 0.5(e−2(t−3) − e−2t ) t ≥ 3

which can be written as

y(t) = 0.5(1 − e−2t )[u(t) − u(t − 3)] + 0.5[e−2(t−3) − e−2t ]u(t − 3)


= 0.5(1 − e−2t )u(t) − 0.5(1 − e−2(t−3) )u(t − 3)

coinciding with the result obtained using the Laplace transform.


(b) Using Laplace transform
1 − e−s
H1 (s) = X1 (s) = H(s)
s
1 − 2e−s + e−2s
Y1 (s) =
s2
so that
y1 (t) = r(t) − 2r(t − 1) + r(t − 2)
a triangular pulse.
Graphically, letting x1 (τ ) and h1 (t − τ ) (moving from left to right) be functions of τ , and integrating
their overlap gives

 0 t<0





 Rt

 0 dτ = t 0≤t<1
y1 (t) =

 R1

 dτ = 1 − t + 1 = 2 − t 1 ≤ t < 2

 t−1



0 t≥2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.24

coinciding with the result using the Laplace transform. The signal y1 (t) is smoother than x1 (t) since it
is the output of an averager filter.
(c) Using the Laplace transform, letting h(t) = hi (t), i = 1, 2, 3

1 − e−s
H(s) =
s
(1 − e−s )3 1 − 3e−s + 3e−2s − e−3s
(H(s))3 = =
s3 s3
The support of the output will be 3M .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.25

3.24 (a) Using the Laplace transform, we have


s+1
H(s) =
(s + 1)2 + 1
Y (s) 4
X(s) = =
H(s) s(s + 1)

The partial fraction expansion of X(s) is


4 −4
X(s) = +
s s+1
which gives
x(t) = 4u(t) − 4e−t u(t)
(b) Using the Laplace transform

(1 − e−s )2
Y1 (s) =
s2
1 − e−s
X1 (s) =
s
Y1 (s) s(1 − e−s )2 1 − e−s
H1 (s) = = 2 −s
=
X1 (s) s (1 − e ) s

so that h1 (t) = u(t) − u(t − 1).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.26

3.25 (a) The Laplace transform of the output for input x(t) is

X(s) B C
Y (s) = H1 (s)X(s) = = ··· + +
(s + 1)(s − 2) s+1 s−2

where the dots correspond to the partial fraction expansion of the poles of X(s), and we assume that
there is no pole/zero cancellation. Then

lim y(t) → ∞
t→∞

because the system is unstable due to the s = 2 pole in the right-hand s-plane, as it would have an inverse
Ce2t u(t) which grows as time increases.
(b) In this case, the Laplace transform of the output for any bounded input x(t) is

X(s) B C
Y (s) = H2 (s)X(s) = = ··· + +
(s + 1)(s + 2) s+1 s+2

then assuming no pole/zero cancellation

lim y(t) → 0
t→∞

because the system is stable (poles in the left s-plane), and all the poles of Y (s) are in the left-hand
s-plane. All terms have as inverse a signal that decays as t increases.
Since the input is bounded, the output should also be bounded for the system to be BIBO stable, but we
only know that the steady state goes to zero. So the fact that y(t) tends to zero simply tells that there is
the possibility that the system is not unstable, unfortunately it does not imply the system is stable. The
condition for stability is that the impulse response of the system be absolutely integrable or that the poles
of the transfer function be in the left-hand s-plane, which in this case are, so the system is BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.27

3.26 (a) The impulse response of the system is of the form


h(t) = Ae−t cos(2t + θ)u(t)
Given that the poles of H(s) are s1,2 = −1 ± j2, the impulse response will go to zero as t → ∞.
Since | cos(2t + θ)| ≤ 1 we have
|h(t)| ≤ |A|e−t u(t)
then Z ∞ Z ∞
|h(t)|dt ≤ |A| e−t dt = |A|
−∞ 0
The value A is found to be
1 1
A = H(s)(s + 1 − j2)|s=−1+j2 = = = 0.25e−jπ/2
−1 + j2 + 1 + j2 j4
so the integral is bounded by 0.25 < ∞, so the system is stable.
(b) For input x(t) = u(t) we have
1 A
Y (s) = 2
= + ···
s((s + 1) + 4) s
where · · · are the terms corresponding to the poles due to the system which are in the left-hand s-plane
and so their inverse will go to zero. Computing
1
A = Y (s)s|s=0 =
5
the steady state response is yss (t) = 0.2.
(c) If x(t) = tu(t), then X(s) = 1/s2 , and
1
Y (s) =
s2 ((s + 1)2 + 4)
the steady state is only due to the double pole s = 0, since the others would have a zero steady state (they
are in the left hand s-plane). The partial fraction expansion is
a b c + (s + 1)d
Y (s) = 2
+ +
s s (s + 1)2 + 4
we need only to find the values of a and b to find the steady state, the other term will give zero in the
steady state. But if a 6= 0, the steady state response is of the form
yss (t) = [at + b]u(t) → ∞
To find the value of a multiply both sides by s2 to get
(c + (s + 1)d)s2
Y (s)s2 = a + bs +
(s + 1)2 + 4
and letting s = 0 we have
1
a = Y (s)s2 |s=0 =
5
and thus the steady state response is infinite. The double pole at the origin causes an infinite steady state,
when the pole at the origin is simple the steady state is finite as in part (c).
(d) The input x(t) = tu(t) is not bounded since there is no finite value M such that |x(t)| < M < ∞,
since the signal continuously grows. Since the input is not bounded the system will not be able to generate
a bounded output even if the system is stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.28

3.27 (a) Use σ = t − τ as a new variable in the integral to get

Z 0 Z T
1 1
y(t) = − x(t − σ)dσ = x(t − σ)dσ
T T T 0

so that the impulse response of the analog averager is

1
h(t) = [u(t) − u(t − T )]
T

a causal pulse of magnitude 1/T from 0 to T .


(b) If the input is

x(t) = u(t) − u(t − 2)

and the impulse response is h(t) = u(t) − u(t − 1). Taking x(τ ) as the fixed part of the integrand and
h(t − τ ) as the shifting part (as functions of τ ) graphically the convolution integral gives

y(t) = r(t) − r(t − 1) − r(t − 2) + r(t − 3)

This can be seen by considering that for negative values of t the averager gives zero; when t ≥ 0 and
t − 1 < 0, or 0 ≤ t < 1, the averager gives t ; when t − 1 ≥ 0 and t < 2, or 1 ≤ t < 2, gives a constant
value of 1 ; when t ≥ 2 and t − 1 < 2, or 2 ≤ t < 3, the averager gives 3 − t, and finally when t > 3 the
averager’s output is zero.
(c) Using Laplace we have

1
H(s) = (1 − e−s )
s

1
X(s) = (1 − e−2s )
s

so that

1
Y (s) = X(s)H(s) = [1 − e−s − e−2s + e−3s ]
s2

and so

y(t) = r(t) − r(t − 1) − r(t − 2) + r(t − 3)

coinciding with the graphical result.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.29

h(t − τ ) 1 x(τ )

t−1 t 2 τ

y(t)

t
1 2 3

Figure 3.5: Problem 27: Graphical convolution integral

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.30

3.28 (a) The poles of H(s) are at s = 0 and s = −1 ± j1, and the zeros are at s = ±j2. This system is not
BIBO stable because of the pole at the origin, the impulse response will not be absolutely integrable.
(b) If x(t) = 2 cos(2t)u(t) then
s
X(s) = 2 2
s +4
and thus
2
Y (s) =
(s + 1)2 + 1
i.e., the pole at s = 0 and the zeros are cancelled by the transform of the cosine. The remaining poles are
in the left-hand s-plane and so the steady state is zero.
This is a very special case because of the cancellation of the pole at s = 0 and the numerator due to
the used input. The system is not stable, and the frequency response does not exist for all frequencies.
Indeed it is infinite whenever the input frequency is 0.
(c) The input cannot be a sine of the same frequency because its Laplace transform does not cancel the
pole at zero and so the steady state is not zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.31

3.29 (a) Negative feedback

Y (s)
G(s) =
C(s)
Y (s) = H(s)(C(s) − Y (s))
H(s)
G(s) =
1 + H(s)

(b) Positive feedback

Y (s)
G1 (s) =
C(s)
Y (s) = H(s)(C(s) + Y (s))
H(s)
G1 (s) =
1 − H(s)

(c) Negative feedback gives


1/(s + 1) 1
G(s) = =
1 + 1/(s + 1) s+2
while positive feedback gives
1/(s + 1) 1
G1 (s) = =
1 − 1/(s + 1) s
The Laplace transform of the output when C(s) = 1/s is for negative feedback
1 0.5 0.5
Y (s) = G(s)C(s) = = −
s(s + 2) s s+2

so that y(t) = 0.5u(t) − 0.5e−2t u(t).


For the positive feedback
1
Y (s) = G1 (s)C(s) =
s2
so that y(t) = r(t) which will go to ∞ as t → ∞.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.32

3.30 (a) The transfer function of the overall system is

H(s) 2
G(s) = =
1 + KH(s) s + 2K − 1

for the pole to be in the left-hand s-plane we need 2K − 1 > 0 or K > 0.5, for instance K = 1
which gives a pole at s = −1 so that the impulse response of the feedback system is g(t) =
2e−t u(t) which is absolutely integrable.
(b) We have
i. The transfer function of an all-pass filter is of the form
Y s − σk Y (s − σm + jΩm )(s − σm − jΩm )
Hap (s) = K
s + σk m (s + σm + jΩm )(s + σm − jΩm )
k

for σk , σm > 0.

ii. The all-pass is


s−1
Hap (s) = K
s+1
iii. To cancel the pole at s = 1, so that the gain of the all-pass be unity the gain at s = 0 should be
unity, i.e.,
Hap (0) = K(−1) = 1
so that K = −1 and the filter becomes
1−s
Hap (s) =
s+1
giving a serial connection with a transfer function

s+1 −(s − 1) −1
G(s) = H(s)Hap (s) = =
(s − 1)(s2 + 2s + 1) s + 1 (s + 1)2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.33

3.2 Problem using MATLAB

3.31 (a) By long division we have that

11s2 + 20s + 9
Y (s) = −4 + s +
s3 + 4s2 + 5s + 2

The inverse of the first two terms are −4δ(t) and dδ(t)/dt. The third term is proper rational and its
partial fraction expansion can be found.
(b) Z(s) is not proper rational so we need to divide to get

3s + 5 2 1
Z(s) = 1 − =1− −
(s + 1)(s + 2) s+1 s+2

so that

z(t) = δ(t) − 2e−t u(t) − e−2t u(t)

Applying the initial–value result we get

z(0) = lim sX(s) → ∞


s→∞

given the presence of δ(t) which is not defined at t = 0.


(c)
A B C
X(s) = + +
s s+1 s+2

where A = −2, B = 7 and C = −5 so that

x(t) = −2u(t) + 7e−t u(t) − 5e−2t u(t)

% Pr. 3_31
clear all; clf
syms s t w
disp(’>>>>> Inverse Laplace <<<<<’)
x=ilaplace((3*s-4)/(sˆ3+3*sˆ2+2*s))
figure(1)
ezplot(x,[0,10])
axis([0 10 -2.5 .5])
grid

>>>>> Inverse Laplace <<<<<


x = -5*exp(-2*t)+7*exp(-t)-2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.34

−5 exp(−2 t)+7 exp(−t)−2


0.5

−0.5

−1

−1.5

−2

−2.5
0 1 2 3 4 5 6 7 8 9 10
t

Figure 3.6: Prob. 31

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.35

3.32 (a) Although the denominator can be obtained by multiplying by hand the three different polynomials, the
function conv can be used to obtain the coefficients of the product of the three polynomials. The steady–
state is obtained by looking at the residue corresponding to the poles s = 0, in this case 1/50 = 0.02

% Pr. 3_32 (a)


clear all; clf
den=conv([1 0],[1 1]); den=conv(den,[1 10 50])
syms s t w
disp(’>>>>> Inverse Laplace <<<<<’)
x=ilaplace((sˆ2+2*s+1)/(den(1)*sˆ4+den(2)*sˆ3+den(3)*sˆ2+den(4)*s+den(5)))
figure(1)
ezplot(x,[0,5])
axis([0 5 0 .1]); grid

>>>>> Inverse Laplace <<<<<


x = -1/50*exp(-5*t)*cos(5*t)+9/50*exp(-5*t)*sin(5*t)+1/50

−1/50 exp(−5 t) cos(5 t)+...+1/50


0.08

0.07

0.06

0.05

0.04

0.03

0.02

0.01

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t

Figure 3.7: Problem 3.32(a)

(b) Separating the given expression into two,

1 se−s
X(s) = −
s(s + 2) s(s + 2)
0.5 0.5 e−s
= − −
s s+2 s+2
giving
x(t) = 0.5u(t) − 0.5e−2t u(t) − e−2(t−1) u(t − 1)
Using the MATLAB script we compute the inverse.

% Pr. 3_32 (b)


clear all; clf
syms s t w
x=ilaplace((1-s*exp(-s))/(sˆ2+2*s))
figure(2)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.36

ezplot(x,[0,5])
axis([0 5 -0.6 0.6])
grid

x = exp(-t)*sinh(t)-heaviside(t-1)*exp(-2*t+2)

Notice that the expression in the solution obtained from ilaplace

et − e−t
e−t sinh(t)u(t) = e−t u(t) = 0.5u(t) − 0.5e−2t u(t)
2
is identical to the first inverse given above.
exp(−t) sinh(t)−heaviside(t−1) exp(−2 t+2)

0.5

0.4

0.3

0.2

0.1

−0.1

−0.2

−0.3

−0.4

−0.5

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5


t

Figure 3.8: Prob. 3.32(b)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.37

3.33 (a) According to the location of the poles 1 and 2, the negative real part −3 indicates a decay and the
imaginary part indicates the frequency π/2 so that within a constant A in the magnitude and a constant
θ in the phase
x1 (t) = Ae−3t cos((π/2)t + θ)u(t)
The pole at the origin gives
x2 (t) = Bu(t)
so that the signal is the sum x(t) = x1 (t) + x2 (t)
(b) The following script gives the inverse x(t) and its plot.

% Pr. 3_33
num=[ 0 0 0 1];
den=poly([-3+j*pi/2 -3-j*pi/2 0 ])
syms s t w
figure(1)
subplot(121)
[r,p]=pfeLaplace(num,den)
disp(’>>>>> Inverse Laplace <<<<<’)
x=ilaplace(1/(den(1)*sˆ3+den(2)*sˆ2+den(3)*s))
subplot(122)
ezplot(x,[0,5])
axis([0 5 -0.01 .1])
grid

p = -3.0000 + 1.5708i
-3.0000 - 1.5708i
0
r = -0.0436 + 0.0833i
-0.0436 - 0.0833i
0.0872

x(t)
2.5 0.1

0.08
1.5

1
0.06
0.5

0
jΩ

0.04
−0.5

−1
0.02
−1.5

−2
0

−2.5
−3 −2 −1 0 1 2 3 0 1 2 3 4 5
σ t

Figure 3.9: Problem 33

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.38

3.34 (a) If the initial conditions are zero the system is LTI. The Laplace transform of the differential equations
is then
Y (s)[s2 + 0.5s + 0.15] = X(s)
and so
X(s)
Y (s) =
s2 + 0.5s + 0.15
(b) If the initial conditions are dy(0)/dt = 1 and y(0) = 1 the Laplace transform of the differential
equation is
[Y (s)s2 − s − 1] + 0.5[sY (s) − 1] + 0.15Y (s) = X(s)
which gives
X(s) s + 1.5
Y (s) = +
s2 + 0.5s + 0.15 s2 + 0.5s + 0.15
which can be written, with the appropriate definitions, as Y (s) = X(s)/A(s) + I(s)/A(s), so that when
we double the input the Laplace transform of the corresponding output is

2X(s) I(s)
+ 6= 2Y (s)
A(s) A(s)

thus the system is not LTI.


(c) If x(t) = u(t) then the Laplace transform of the output (including the initial conditions is) after
replacing X(s) = 1/s:
s2 + 1.5s + 1
Y (s) = 3
s + 0.5s2 + 0.15s
when we double the input the Laplace transform of the output (again including the initial conditions) is

s2 + 1.5s + 2
Y1 (s) = .
s3 + 0.5s2 + 0.15s
The following script is used to obtain the two responses. The second one is not the double of the first, so
the system is not LTI — due to the initial conditions not being zero.

%% Pr. 3_34
clear all; clf
% response to u(t)
den=[1 0.5 0.15 0];
num=[0 1 1.5 1];
syms s t y y1
[p,r]=pfeLaplace(num,den)
disp(’>>>>> Inverse Laplace <<<<<’)
y=ilaplace((num(2)*sˆ2+num(3)*s+num(4))/(den(1)*sˆ3 +den(2)*sˆ2+den(3)*s))
% response to 2u(t)
num=[0 1 1.5 2];
pfeLaplace(num,den)
disp(’>>>>> Inverse Laplace <<<<<’)
y1=ilaplace((num(2)*sˆ2+num(3)*s+num(4))/(den(1)*sˆ3 +den(2)*sˆ2+den(3)*s))
figure(1)
subplot(311)
ezplot(y,[0,40])
axis([0 40 -0.01 11]);grid;title(’Response to u(t)’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.39

subplot(312)
ezplot(y1,[0,40])
axis([0 40 -0.01 15]);grid;title(’Response to 2 u(t)’)
subplot(313)
ezplot(y1-2*y,[0,40]);grid;title(’Difference of two responses’)
axis([0 40 -10 10])

Response to u(t)
10

0
0 5 10 15 20 25 30 35 40
t
Response to 2 u(t)
15

10

0
0 5 10 15 20 25 30 35 40
t
Difference of two responses
10

−10
0 5 10 15 20 25 30 35 40
t

Figure 3.10: Problem 34: Responses y(t) and y1 (t) corresponding to inputs u(t) and 2u(t), the difference
y1 (t) − 2y(t) 6= 0 indicates the system is not linear.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.40

3.35 Let A(s) = s2 + 2s + 3 and I(s) = s + 1 then we can write

X(s) I(s)
Y (s) = +
A(s) A(s)
(a) Ignoring the term due to initial conditions (i.e., consider initial conditions equal to zero) we have

Y (s)A(s) = s2 Y (s) + 2sY (s) + 3Y (s) = X(s)

so that using sN as an indicator of taking the N th derivative of the function in the time domain we have
that the inverse of the above equation is the differential equation

d2 y(t) dy(t)
2
+2 + 3y(t) = x(t)
dt dt
(Notice that this can only be done by assuming the IC are zero, otherwise we do not have a clear expres-
sion relating the input and the output variables.)
(b) If we compute the Laplace transform of the differential equation found above and assume the initial
conditions are not zero we get

[s2 Y (s) − sy(0) − y 0 (0)] + 2[sY (s) − y(0)] + 3Y (s) = X(s)

which can be written


X(s) sy(0) + y 0 (0) + 2y(0)
Y (s) = +
s2 + 2s + 3 s2 + 2s + 3
which when compared with the equation given at the beginning

I(s) = s + 1 = sy(0) + [y 0 (0) + 2y(0)]

so that y(0) = 1 and y 0 (0) = 1 − 2y(0) = −1.


(c) Letting the initial conditions be zero, the inverse Laplace transform of
X(s)
Y (s) =
s2 + 2s + 3
with X(s) = 1 gives the impulse response

Y (s) 1 1 √
H(s) = = ⇒ h(t) = √ e−t sin( 2t)u(t)
X(s) (s + 1)2 + 2 2
The poles, computed by the following script, are in the open left-hand s-plane so the system is BIBO
stable.

%% Pr. 3_35
num=[0 0 1];
den=[1 2 3];
syms s t h
figure(1)
subplot(121)
[r,p]=pfeLaplace(num,den)
disp(’>>>>> Inverse Laplace <<<<<’)
h=ilaplace(num(3)/(den(1)*sˆ2+den(2)*s+den(3)))

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.41

subplot(122)
ezplot(h,[0,8])
axis([0 8 -0.2 0.4])
grid

>>>>> Poles <<<<<


p = -1.0000 + 1.4142i
-1.0000 - 1.4142i

r = 0 - 0.3536i
0 + 0.3536i

(21/2 sin(21/2 t))/(2 exp(t))


0.4

0.3
1.5

1
0.2
0.5

0 0.1
jΩ

−0.5
0
−1

−1.5
−0.1

−2

−0.2
−2 −1 0 1 2 3 0 2 4 6 8
σ t

Figure 3.11: Prob. 35

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.42

3.36 (a) For zero-state, x(t) = u(t), consider the first term letting X(s) = 1/s:

1 A a + b(s + 1)
Yzs (s) = = +
s(s + 1)2 s (s + 1)2

the value of A is found as


1
A= |s=0 = 1
(s + 1)2
subtracting 1/s from Yzs (s) we get

−(s + 2) a + b(s + 1)
=
(s + 1)2 (s + 1)2

so that b = −1 and a = −1, and


1 −1 − (s + 1) 1 1 1
Y (s) = + = − −
s (s + 1)2 s (s + 1)2 s+1

The zero-state response is thus


yzs (t) = [1 − te−t − e−t ]u(t)
Using the initial value property we get yzs (0) = lims→∞ 1/(s + 1)2 = 0.
(b) For the zero-input response, we consider the second term

(s + 1) 1
Yzi (s) = =
(s + 1)2 s+1

so that
yzi (t) = e−t u(t)
(c) The complete response is then

y(t) = yzi (t) + yzs (t) = [1 − te−t ]u(t)

(d) The steady state is due to the pole at s = 0 and so yss (t) = u(t) and the transient is then yt (t) =
−te−t u(t). Also you can see that the zero–input response goes to zero in the steady state, i.e., the effect
of the initial conditions disappears as t goes to infinity. Moreover the zero-state response only provides
a steady-state response for the pole at the origin of the s-plane.
(e) The following script is used to compute the different responses

%% Pr. 3_36
syms s t yzs yzi
% zero-state response
num=[0 0 0 1];
den=[1 2 1 0];
figure(1)
subplot(121)
[r,p]=pfeLaplace(num,den);
disp(’>>>>> Inverse Laplace <<<<<’)
yzs=ilaplace(num(4)/(den(1)*sˆ3+den(2)*sˆ2+den(3)*s))
subplot(122)
ezplot(yzs,[0,10])
axis([0 10 -0.1 1.2]); grid;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.43

%zero-input response
num=[0 0 1 1];
figure(2)
subplot(121)
[r,p]=pfeLaplace(num,den);
disp(’>>>>> Inverse Laplace <<<<<’)
yzi=ilaplace((num(3)*s+num(4))/(den(1)*sˆ2+den(2)*s+den(3)))
subplot(122)
ezplot(yzi,[0,10])
axis([0 10 -0.1 1.2]); grid;
% complete response
y=yzs+yzi;
figure(3)
ezplot(y,[0,10])
axis([0 10 -0.1 1.2])
grid;
% transient response
yt=y-1;
figure(4)
ezplot(yt,[0,10])
axis([0 10 -0.5 .2]); grid;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.44

1+(−t−1) exp(−t) exp(−t)


1 1

0.8 0.8
1 1
0.6 0.6

0.4 0.8 0.4 0.8

0.2 0.2
0.6 0.6
0 0
jΩ

jΩ
−0.2 0.4 −0.2 0.4

−0.4 −0.4

0.2 0.2
−0.6 −0.6

−0.8 −0.8
0 0

−1 −1
−2 −1 0 1 2 3 0 2 4 6 8 10 −2 −1 0 1 2 3 0 2 4 6 8 10
σ t σ t

1+(−t−1) exp(−t)+exp(−t) (−t−1) exp(−t)+exp(−t)

1 0.1

0
0.8

−0.1
0.6

−0.2
0.4

−0.3
0.2

−0.4
0

−0.5
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
t t

Figure 3.12: Problem 36: Clockwise from top-left: zero-state response, zero-input response, transient re-
sponse and complete response.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.45

3.37 (a) The transfer function is


1 1
H(s) = =
s2 + 5s + 6 (s + 2)(s + 3)
so that
1 A B C
Y (s) = = + +
s(s + 2)(s + 3) s s+2 s+3
where
1
A = Y (s)s|s=0 =
6
1
B = Y (s)(s + 2)|s=−2 = −
2
1
C = Y (s)(s + 3)|s=−3 =
3
so that the total response is
 
1 1 1
y(t) = − e−2t + e−3t u(t)
6 2 3
which starts at y(0) = 0 and in steady state it is 1/6, and in between it increases smoothly from 0 to 1/6.
(b) The transfer function is
1 1
H(s) = 2 =
s + 2s + 6 (s + 1)2 + 5
so that
1 A a + (s + 1)b
Y (s) = = +
s((s + 1)2 + 5) s (s + 1)2 + 5
The value of A = 1/6 and
1 −s − 2 a + (s + 1)b
Y (s) − = =
6s 6((s + 1)2 + 5) (s + 1)2 + 5
so that b = −1/6 and a = −1/6 to give

1/6 1 5 1 s+1
Y (s) = − √ × − ×
s 6 5 (s + 1)2 + 5 6 (s + 1)2 + 5

√ √
 
1 5 −t
y(t) = 1− e sin( 5t) − e−t cos( 5t) u(t)
6 5
At t = 0 this signal is zero, and in the steady state it is 1/6, in between the signal oscillates.

%% Pr. 3_37
clear all; clf
num=[0 0 0 1]; den=[1 5 6 0];
% den=[1 2 6 0]; % part (b)
syms s t y
figure(1); subplot(121)
[r,p]=pfeLaplace(num,den);
disp(’>>>>> Inverse Laplace <<<<<’)
y=ilaplace(num(4)/(den(1)*sˆ3+den(2)*sˆ2+den(3)*s))
subplot(122)
ezplot(y,[0,8]); axis([0 8 0 .25]; grid

The results for part (a) are:

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.46

>>>>> Residues <<<<<


r = 0.3333
-0.5000
0.1667
>>>>> Zeros <<<<<
z = Empty matrix: 0-by-1
>>>>> Poles <<<<<
p = 0
-3.0000
-2.0000
>>>>> Inverse Laplace <<<<<
y = 1/6+1/3*exp(-3*t)-1/2*exp(-2*t)

while the results for part (b) are:

>>>>> Residues <<<<<


r =
-0.0833 + 0.0373i
-0.0833 - 0.0373i
0.1667
>>>>> Zeros <<<<<
z = Empty matrix: 0-by-1
>>>>> Poles <<<<<
p = 0
-1.0000 + 2.2361i
-1.0000 - 2.2361i
>>>>> Inverse Laplace <<<<<
y = -1/6*exp(-t)*cos(5ˆ(1/2)*t)-1/30*5ˆ(1/2)*exp(-t)*sin(5ˆ(1/2)*t)+1/6

(c) Both responses start at 0 and go to the same steady-state value of 1/6, but the first one does it smoothly
(due to the negative real poles) while the second oscillates (due to the complex conjugate poles).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.47

1/6+1/3 exp(−3 t)−1/2 exp(−2 t) −1/6 exp(−t) cos(51/2 t)−...+1/6


1 0.25 0.25
3
0.8

0.6 0.2 2 0.2

0.4
1
0.2 0.15 0.15

0 0
jΩ

jΩ

−0.2 0.1 0.1


−1
−0.4

−0.6 0.05 −2 0.05

−0.8
−3
−1 0 0
−2 −1 0 1 2 3 0 2 4 6 8 −1 0 1 2 3 0 2 4 6 8
σ t σ t

Figure 3.13: Problem 37: Response for b1 = 5 and b0 = 6 giving double real pole (left), and response for
b1 = 2 and b0 = 6 giving complex conjugate poles.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.48

3.38 (a) The input/output equation for the analog averager is


Z t
1
y(t) = x(τ )dτ
T t−T

and its derivative is


dy(t) 1
= [x(t) − x(t − T )]
dt T
Likewise if we integrate this from −∞ to t it gives
Z t Z t 
1
y(t) = x(τ )dτ − x(τ − T )dτ
T −∞ −∞

and changing the variable in the second integral to σ = τ − T we get


"Z Z t−T #
t
1
y(t) = x(τ )dτ − x(σ)dσ
T −∞ −∞
Z
1 t
= x(τ )dτ
T t−T

the equation for the analog averager.


(b) Graphically the convolution gives zero for t < 0; for values of 0 ≤ t < T the output is a transient;
and for t > T it is a periodic signal. If we choose T = 2, the period of the sinusoid, (or multiples of
2) the periodic output signal becomes zero—the averager computes the area under the input of a period,
which is zero. It can also be shown analytically, for T = 2
Z
1 t
y(t) = cos(πτ )dτ
2 t−2
1 sin(πτ ) t
= |t−2
2 π
1
= [sin(πt) − sin(π(t − 2))] = 0 t≥2

(c) The impulse response of the averager is h(t) = 0.5[u(t) − u(t − 2)] for the value T = 2 found above.
If the input is cos(πt)u(t), then

1 X(s) X(s) −2s


Y (s) = H(s)X(s) = [1 − e−2s ]X(s) = − e
2s 2s 2s

Replacing X(s) = s/(s2 + π 2 ) above we have

1 − e−2s
Y (s) = 0.5 = Y1 (s) − Y1 (s)e−2s
s2 + π 2

where Y1 (s) = 0.5/(s2 + π 2 ) so that

0.5
y(t) = (sin(πt)u(t) − sin(π(t − 2)u(t − 2))
π

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.49

%% Prob 3_38
clear all; clf
T=2;
num=[0 0 1/T]
den=[1 0 piˆ2]
syms s t y
figure(1)
subplot(221)
[r,p]=pfeLaplace(num,den);
disp(’>>>>> Inverse Laplace <<<<<’)
y1=ilaplace(0.5/(sˆ2+piˆ2))
subplot(222)
ezplot(y1,[0,8])
axis([0 8 -0.2 0.2]); title(’y_1(t)’)
grid
y=y1-y1*heaviside(t-2)
subplot(223)
ezplot(y,[0,8])
axis([0 8 -0.2 0.2]); title(’y(t)’)
grid

y1(t)
4 0.2

2 0.1

0 0
jΩ

−2 −0.1

−4 −0.2
−1 0 1 2 3 0 2 4 6 8
σ t
y(t)
0.2

0.1

−0.1

−0.2
0 2 4 6 8
t

Figure 3.14: Prob. 38 Poles/zeros of Y1 (s) (top–left) , y1 (t) and y(t) (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.50

3.39 (a) If X(s) = 1/s then


X(s)(s + 1)
Y1 (s) =
s2 + 2s + 4
so that the differential equation connecting the input x(t) and the output y1 (t) is

d2 y1 (t) dy1 (t) dx(t)


+2 + 4y1 (t) = x(t) +
dt2 dt dt
Similarly,
X(s)s
Y2 (s) =
s2 + 4s + 4
so that the differential equation connecting the input x(t) and the output y2 (t) is

d2 y2 (t) dy2 (t) dx(t)


2
+4 + 4y2 (t) =
dt dt dt
Finally,
X(s)(s − 1)
Y3 (s) =
s(s2 + 2s + 10)
so that the differential equation connecting the input x(t) and the output y3 (t) is

d3 y3 (t) d2 y3 (t) dy3 (t) dx(t)


3
+ 2 2
+ 10 = −x(t) +
dt dt dt dt

(b) For Y1 (s) its poles are s = 0 and s = −1 ± j 3 and a zero at s = −1, its general solution is of the
form √
y1 (t) = [A + Be−t cos( 3t + θ)]u(t)
For Y2 (s) its poles are s = −2 (double) and no zero, its general solution is of the form

y2 (t) = [Be−2t + Cte−2t ]u(t)

For Y3 (s) its poles are s = 0 (double) and s = −1 ± j3 and a zero at s = 1, its general solution is of the
form
y3 (t) = [A + Bt + Ce−t cos(3t + θ)]u(t)
The values of the coefficients of the partial fraction expansion (also called residues), the inverse and the
plot of the response is computed using MATLAB.

%% Prob 3_39
num=[0 0 1 1]; % numerator of Y1
% num=[0 0 1]; % numerator of Y2
% num=[0 0 0 1 -1]; % numerator of Y3
den=[1 2 4 0]; % denominator of Y1
% den=[1 4 4]; % denominator of Y2
% den=[1 2 10 0 0]; % denominator of Y3
syms s t y
figure(1)
subplot(121)
[r,p]=pfeLaplace(num,den)
disp(’>>>>> Inverse Laplace <<<<<’)
y1=ilaplace((num(3)*s+num(4))/(den(1)*sˆ3+den(2)*sˆ2+den(3)*s));y=y1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.51

% y2=ilaplace(num(3)/(den(1)*sˆ2+den(2)*s+den(3)));y=y2
% y3=ilaplace((num(4)*s+num(5))/(den(1)*sˆ4+den(2)*sˆ3+den(3)*sˆ2));y=y3
subplot(122)
ezplot(y,[0,10])
axis([0 10 -1 1])
grid

For the three cases we have the residuals (r) the corresponding poles (p) and the complete responses.

%% case 1
r = -0.1250 - 0.2165i
-0.1250 + 0.2165i
0.2500
p = -1.0000 + 1.7321i
-1.0000 - 1.7321i
0
y1 = 1/4-1/4*exp(-t)*cos(3ˆ(1/2)*t)+1/4*3ˆ(1/2)*exp(-t)*sin(3ˆ(1/2)*t)
%% case 2
r = 0
1
p = -2
-2
y2 = t*exp(-2*t)
%% case 3
r = -0.0600 + 0.0033i
-0.0600 - 0.0033i
0.1200
-0.1000
p= -1.0000 + 3.0000i
-1.0000 - 3.0000i
0
0
y3= 3/25-3/25*exp(-t)*cos(3*t)-1/150*exp(-t)*sin(3*t)-1/10*t

1/4−...+1/4 31/2 exp(−t) sin(31/2 t) t exp(−2 t) 3/25−3/25 exp(−t) cos(3 t)−...−1/10 t


0.5 1 0.2 4
2.5
0.45 0.8 0.18 0
2 3
0.16 −0.1
0.4 0.6
1.5
2
0.14 −0.2
1 0.35 0.4

0.12 1 −0.3
0.5 0.3 0.2
−0.4
0.1
0 0.25 0 0
jΩ

jΩ

jΩ

−0.5
0.08
−0.5 0.2 −0.2
−1 −0.6
−1 0.06
0.15 −0.4
−0.7
0.04 −2
−1.5
0.1 −0.6 −0.8
−2 0.02
−3
0.05 −0.8 −0.9
−2.5 0
0 −1 −4 −1
−2 −1 0 1 2 3 0 2 4 6 8 10 −3 −2 −1 0 1 2 3 0 2 4 6 8 10 −1 0 1 2 3 0 2 4 6 8 10
σ t σ t σ t

Figure 3.15: Problem 39: Poles/zeros and response for cases (1) (left) to (3) (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.52

3.40 The pulse is given by

x(t) = u(t + 0.5) − u(t − 0.5)

with Laplace transform

1 0.5s
X(s) = (e − e−0.5s )
s

(a) Then if y2 (t) = (x ∗ x)(t) its Laplace transform is

1 s
Y2 (s) = (e − 2 + e−s )
s2

which gives

y(t) = r(t + 1) − 2r(t) + r(t − 1)

a triangular signal.
(b) The Laplace transform of y3 (t) is

1 1.5s
Y3 (s) = L[(y2 ∗ x)(t)] = [e − 3e0.5s + 3e−0.5s − e−1.5s ]
s3

t3
If we call ψ(t) = L−1 (1/s3 ) = 6 u(t) we have that

y3 (t) = ψ(t + 1.5) − 3ψ(t + 0.5) + 3ψ(t − 0.5) − ψ(t − 1.5)

%% Pr. 3_40
syms s t x y
y1=heaviside(t+0.5)-heaviside(t-0.5);
y2=(t+1)*heaviside(t+1)-2*t*heaviside(t)+(t-1)*heaviside(t-1);
y3=(0.5*(t+1.5)ˆ2)*heaviside(t+1.5)-3*(t+0.5)ˆ2/2*heaviside(t+0.5)+3*(t-0.5)ˆ2/2*heav
y3=y3-(0.5*(t-1.5)ˆ2)*heaviside(t-1.5)
figure(1)
subplot(311)
ezplot(y1,[-2,2])
axis([-2 2 -0.1 1]);grid
subplot(312)
ezplot(y2,[-2,2])
axis([-2 2 -0.1 1]);grid
subplot(313)
ezplot(y3,[-2,2])
axis([-2 2 -0.1 1]); grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.53

heaviside(t+1/2)−heaviside(t−1/2)
1

0.5

0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t
(t+1) heaviside(t+1)−...+(t−1) heaviside(t−1)
1

0.5

0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t
1/2 (t+3/2)2 heaviside(t+3/2)−...−1/2 (t−3/2)2 heaviside(t−3/2)
1

0.5

0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t

Figure 3.16: Prob. 40

(c) y3 (t) is the smoothest, and its support is also the largest.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.54

3.41 (a) The two expressions for y1 (t) are equivalent. Indeed, since

sin(2π(t − 0.5)) = sin(2πt − π) = − sin(2πt)

then

y1 (t) = sin(2πt)u(t) + sin(2π(t − 0.5))u(t − 0.5)


= sin(2πt)u(t) − sin(2πt)u(t − 0.5)
= sin(2πt)[u(t) − u(t − 0.5)]

Graphically, the following MATLAB script also shows the two expressions for x1 (t) are identical.

%% Prob 3_41
figure(1)
syms t
x1=sin(2*pi*t)*heaviside(t)+sin(2*pi*(t-0.5))*heaviside(t-0.5);
x2=sin(2*pi*t)*(heaviside(t)-heaviside(t-0.5));
subplot(211)
ezplot(x1,[0 4]); axis([0 4 -1.1 1.1])
subplot(212)
ezplot(x2,[0 4]); axis([0 4 -1.1 1.1])

sin(2 π t) heaviside(t)+sin(2 π (t−1/2)) heaviside(t−1/2)


1

0.5

−0.5

−1
0 0.5 1 1.5 2 2.5 3 3.5 4
t
sin(2 π t) (heaviside(t)−heaviside(t−1/2))
1

0.5

−0.5

−1
0 0.5 1 1.5 2 2.5 3 3.5 4
t

Figure 3.17: Problem 41: Plots for equivalent expressions for x1 (t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.55

The Laplace transform of y1 (t) is then, using the first expression,



Y1 (s) = L[sin(2πt)u(t) + sin(2π(t − 0.5))u(t − 0.5)] = [1 + e−0.5s ]
s2 + 4π 2
(c) The half-rectified signal y(t) can be written

X
y(t) = y1 (t − k)
k=0

Since the Laplace transform of y1 (t − τ ) is Y1 (s)e−τ s then

Y1 (s)
Y (s) = Y1 (s)[1 + e−s + e−2s + · · · ] =
1 − e−s
2π(1 + e−0.5s )
=
(s2 + 4π 2 )(1 − e−s )

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.56

3.42 (a)(b) The following script shows how to do polynomial multiplication using conv function.
The multiplication of the polynomials

P (s) = s2 + s + 1 and Q(s) = 2s3 + 3s2 + s + 1

gives
Z(s) = P (s)Q(s) = 2s5 + 5s4 + 6s3 + 5s2 + 2s + 1
The script shows how to obtain this result in the Poly Multiplication part of the script.
In the Application part of the script we show how to find the numerator N1 (s) and the denominator
D1 (s) of Y (s) by multiplying X(s) and H(s) to give

X(s)N (s) (s + 2)
Y (s) = = 2
D(s) s (s + 1)((s + 4)2 + 9)

so that the poles of Y (s) are s = 0 (double), and s = −4 ± j3, and no zeros. The double pole gives a
ramp and the other poles a modulated sinusoid by a decaying exponential.

% Pr. 3_42
% Poly multiplication
% coefficients of higher to lower orders of s
P=[1 1 1];Q=[2 3 1 1];
Z=conv(P,Q);
% Application
d1=[1 1]; d2=[1 8 25]; D=conv(d1,d2);
d3=[1 0 0]; den=conv(D,d3)
N=length(den)
num=[ zeros(1,N-2) 1 2]
syms s t y
figure(1)
subplot(121)
[r,p]=pfeLaplace(num,den);
disp(’>>>>> Inverse Laplace <<<<<’)
y=ilaplace((num(N-1)*s+num(N))/(den(1)*sˆ5+den(2)*sˆ4+den(3)*sˆ3+den(4)*sˆ2+den(5)*s+d
subplot(122)
ezplot(y,[0,50])
axis([0 50 -0.1 1.5]); grid

den = 1 9 33 25 0 0
num = 0 0 0 0 1 2
>>>>> Zeros <<<<<
z = -2
>>>>> Poles <<<<<
p = -4.0000 + 3.0000i
-4.0000 - 3.0000i
-1.0000
0
0
>>>>> Residues <<<<<
r = 0.0050 - 0.0026i
0.0050 + 0.0026i
0.0556

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.57

-0.0656
0.0800
>>>>> Inverse Laplace <<<<<
y = -41/625+1/18*exp(-t)+2/25*t+113/11250*exp(-4*t)*cos(3*t)
+59/11250*exp(-4*t)*sin(3*t)

−41/625+...+59/11250 exp(−4 t) sin(3 t)


4 4.5

3 4

3.5
2

3
1
2.5
0
jΩ

−1
1.5

−2 1

−3 0.5

0
−4
−4 −2 0 2 0 10 20 30 40 50
σ t

Figure 3.18: Prob. 42: Poles/zeros of Y (s) and y(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.58

3.43 (a) The Laplace transform of the error e(t) is given by

E(s) = X(s) − V (s) = X(s) − H(s)Y (s) = X(s) − H(s)G(s)E(s)

or
X(s)
E(s) =
1 + H(s)G(s)
(b) Replacing X(s) = 1/s, H(s) = 1 and G(s) = 1/(s(s + 1)(s + 2)) = 1/D(s) we get

X(s) 1
E1 (s) = =
1 + H(s)G(s) s(1 + 1/D(s))
D(s) (s + 1)(s + 2)
= =
s(D(s) + 1) s(s + 1)(s + 2) + 1

the final value result indicates that

lim e1 (t) = lim sE1 (s) = 0


t→∞ s→0

or e1ss = 0.
(c) If x(t) = r(t), then the Laplace transform of the error is

X(s) 1
E2 (s) = = 2
1 + H(s)G(s) s (1 + 1/D(s))

and in this case the final value theorem give

lim e2 (t) = lim sE2 (s)


t→∞ s→0
1
= lim =2
s→0 s(1 + 1/D(s))

%% Pr. 3_43
syms e1 e2 t
figure(1)
[r1,p1]=pfeLaplace([0 1 3 2],[1 3 2 1])
e1=r1(1)*exp(p1(1)*t)+r1(2)*exp(p1(2)*t)+r1(3)*exp(p1(3)*t)
figure(2)
[r2,p2]=pfeLaplace([0 1 3 2],[1 3 2 1 0] )
e2=r2(1)*exp(p2(1)*t)+r2(2)*exp(p2(2)*t)+r2(3)*exp(p2(3)*t)+r2(4)*exp(p2(4)*t)
figure(3)
subplot(211)
ezplot(e1,[0,10])
axis([0 10 -1 2]); grid;title(’error for u(t)’)
subplot(212)
ezplot(e2,[0,10])
axis([0 10 0 5]); grid;title(’error for r(t)’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.59

error for u(t)


2
1.5 1.5
1.5

1
1 1
0.5

0
0.5 0.5 −0.5

−1
0 1 2 3 4 5 6 7 8 9 10
0 0 t
jΩ

jΩ

error for r(t)


5

−0.5 −0.5 4

−1 −1 2

1
−1.5 −1.5
0
−3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3 0 1 2 3 4 5 6 7 8 9 10
σ σ t

Figure 3.19: Prob. 43: Poles/zeros of E1 (s) and E2 (s) and corresponding errors e1 (t), e2 (t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 3.60

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 4

Frequency Analysis: the Fourier Series

4.1 Basic Problems


4.1 (a) If x(t) = ejπt/4 is the non-linear system input, the output is

y(t) = x2 (t) = ejπt/2

which cannot be written as a constant (function of the input frequency π/4 only) times x(t). Thus,
the eigenfunction property does not hold for this non-linear system.

(b) For x(t) = ejπt/4 the input to the time-varying system, the output is

y(t) = ejπt/4 [u(t) − u(t − 1)] 6= constant in π/4 × x(t)

so the eigenfunction property does not hold for this time-varying system.

1
Chaparro — Signals and Systems using MATLAB 4.2

4.2 (a) Replacing x(τ ) = ejΩ0 τ in the integral for the averager we get
Z t
1 1 ejΩ0 t − ejΩ0 (t−T )
ejΩ0 τ dτ =
T t−T T jΩ0
 −jΩ0 T

jΩ0 t 1 − e
= e
jΩ0 T

where according to the eigenfunction property H(jΩ0 ), the frequency response of the system for Ω0 , is
the term in the square brackets.
(b) By a change of variable, σ = t − τ , the equation for the averager is
Z T
1
y(t) = x(t − σ)dσ
T 0

which is a convolution integral with impulse response h(t) = (1/T )[u(t) − u(t − T )]. The transfer
function of the system is H(s) = (1/sT )[1 − e−sT ] and if we let s = jΩ0 we get the above response.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.3

4.3 (a) i. The sinusoidal components of x1 (t) have periods T1 = 1 and T2 = 1/3, with ratio T1 /T2 = 3
so that x1 (t) is periodic of fundamental period T1 = 3T2 = 1.
The periods of the sinusoidal components of x2 (t) are T1 = 1 and T2 = 2π/6, their ratio is
T1 /T2 = 3/π, not a rational number so x2 (t) is not periodic.
ii. Trigonometric Fourier series of x1 (t), with fundamental period T0 = 1 and fundamental fre-
quency Ω0 = 2π, is
x1 (t) = 1 + cos(Ω0 t) − cos(3Ω0 t)
iii. For x2 (t), since Ω2 = 6 cannot be expressed as an integer multiple of Ω1 = 2π or vice versa,
there is no Fourier series for x2 (t).
(b) i. For the signal to be periodic of period T0 we must have

sin(2(t + T0 ) + π)
x(t + T0 ) = = x(t)
sin(t + T0 )

this is possible if T0 = 2π
ii. It can be shown that x(t) = −2 cos(t), indeed sin(2t + π) = − sin(2t) and

− sin(2t) = −2 cos(t) sin(t)

so
x(t) = −2 cos(t) = −ejt − e−jt
thus X1 = X−1 = −1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.4

4.4 (a) x(t) is a train of pulses with T0 = 2π and Ω0 = 1. The Fourier series coefficients are

X0 = 0 by symmetry in a period
Z 0 Z π  Z π
1 1
Xk = (−1)e−jkt dt + (1)e−jkt dt = (e−jkt − ejkt )dt
2π −π 0 2π 0
 
1 −(e−jπk + ejπk − 2) 1 − cos(πk)
= =
2π jk jπk

since cos(πk) = (−1)k we get that



0 k even
Xk =
−2j/(πk) k odd

(b) Laplace transform of a period

1 2e−πs
X1 (s) = (1 − 2e−πs + e−2πs ) = (cosh(πs) − 1)
s s
so that the Fourier series coefficients are
1 (−1)k+1 (cos(πk) − 1)
Xk = X1 (s)|s=jk = j
2π πk
or

0 k even
Xk =
−2j/(πk) k odd

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.5

4.5 (i) Fundamental frequency Ω0 = 5 so

x1 (t) = (0.5ejπ/4 )ej5t + (0.5e−jπ/4 )e−j5t



and X1 = X−1 = 0.5ejπ/4 .
(ii) We have
 2
1 jt
x2 (t) = (e − e−jt ) = 0.5 − 0.25ej2t − 0.25e−j2t
2j

and so X0 = 0.5, X1 = X−1 = −0.25 and Ω0 = 2 is the fundamental frequency.
(iii) Fundamental frequency of x3 (t) is Ω0 = 1 (ratio of fundamental periods of sinusoidal components
T1 /T2 = (2π/3)/(2π/5) = 5/3 and Ω0 = 2π/3T1 = 1).

x3 (t) = 0.5ej3Ω0 t + 0.5e−j3Ω0 t + 0.5ej5Ω0 t + 0.5e−j5Ω0 t

so that X3 = X−3 = 0.5 and X5 = X−5 = 0.5.


See Fig. 4.1 for magnitude and phase line spectra.
x1(t)
0.8

0.4 0.6
|Xk|

∠Xk

0.4
0.2
0.2

0 0
0 2 4 6 0 2 4 6
x2(t)
0.6 3

0.4 2
|Xk|

∠Xk

0.2 1

0 0
0 2 4 6 8 10 0 2 4 6 8 10

x3(t)
0.6 3

0.4 2
|Xk|

∠Xk

0.2 1

0 0
0 1 2 3 4 5 0 1 2 3 4 5
kΩ0 kΩ0

Figure 4.1: Problem 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.6

4.6 (a) A period is x1 (t) = t[u(t) − u(t − 1)], its fundamental frequency Ω0 = 2π, and its fundamental
period T0 = 1. See Fig. 4.2.

(b) Fourier series coefficients using the integral definition:


Z 1
1 e−j2πkt
Xk = te−j2πkt dt = (−j2πkt − 1)|1t=0
T0 0 (−j2πk)2
j2πk + 1 1 j
= − 2 2 = k 6= 0
4π 2 k 2 4π k 2πk

If k = 0, the dc value X0 is
Z 1
1 t2 1
X0 = tdt = | = 0.5
T0 0 2 t=0

(c) Since x1 (t) = tu(t) − tu(t − 1) with Laplace transform

1
X1 (s) = − L[tu(t − 1)] where
s2
e−s e−s
L[tu(t − 1)] = L[(t − 1)u(t − 1) + u(t − 1)] = +
s2 s

The FS coefficients are

1 1 − e−s e−s
Xk = L[x1 (t)]|s=j2πk = 2
− |s=j2πk
T0 s s
1 − e−j2πk e−j2πk 1
= 2
− =j k= 6 0
(j2πk) j2πk 2πk

By inspection, the mean is X0 = 0.5 (it cannot be calculated using the Laplace transform method).
Notice that the zero-mean signal is odd so the Xk are purely imaginary.

(d) The derivative of x(t) is (see bottom plot in Fig. 4.2):


X
dx(t)
y(t) = =1− δ(t − k)
dt
k=−∞

A period of it is given by y1 (t) = u(t + 0.5) − u(t − 0.5) − δ(t) and by the Laplace transform we
have the Fourier series coefficients of y(t) of fundamental period T0 = 1 are
 
e0.5s − e−0.5s sin(kπ)
Yk = − 1 |s=j2πk = − 1 = −1 and so
s kπ
−1 j
using the derivative property Xk = = k 6= 0
j2πk 2πk

which coincide with the ones obtained before. The X0 cannot be calculated from above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.7

x(t)
1
··· ···
t
−1 0 1 2
dx(t)
dt
1
···
−1 0 1 2
t
(−1) (−1) (−1) (−1)

Figure 4.2: Problem 6

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.8

4.7 (a) i. T0 = 2 since Ω0 = π.


ii. dc value X0 = 3/4
iii. x(t) is even, since the Xk are real.
iv. For the third harmonic
3 6
2
(ej3πt + e−j3πt ) = cos(3πt)
4 + 9π 4 + 9π 2
then A = 6/(4 + 9π 2 ).
(b) Since x(1) = 1 then letting t = 1 we have

X 1
π=4 sin(2k − 1)
2k − 1
k=1

It is also possible to find a similar expression for other values of t which are not in the discontinu-
ities.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.9

4.8 (a) If T1 = T2 = T0 (Ω0 = 2π/T0 ) then the sum


X X
z(t) = x(t) + y(t) = Xk ejkΩ0 t + Yk ejkΩ0 t
k k
X
= [Xk + Yk ]ejkΩ0 t
k

or Zk = Xk + Yk .
(b) The ratio
T1
=2
T2
indicates that the period of w(t) is T1 = 2T2 so that the fundamental frequencies are related as

Ω2 = 2π/T2 = 2π/(T1 /2) = 2Ω1

so that the sum



X X
w(t) = x(t) + y(t) = Xk ejkΩ1 t + Yk ej2kΩ1 t
k=−∞ k
X∞ ∞
X
= Xk ejkΩ1 t + Y`/2 ej`Ω1 t
k=−∞ `=−∞, even

so that 
Xk k odd
Wk =
Xk + Yk/2 k even

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.10

4.9 (a) If the periodic signal X


x(t) = Xk ejΩ0 kt
k

then X
y(t) = 2x(t) − 3 = (2X0 − 3) + 2Xk ejΩ0 kt
k6=0

is also periodic of period T0 with Fourier coefficients



2X0 − 3 k=0
Yk =
2Xk k 6= 0

The signal

z(t) = x(t − 2) + x(t)


X X
= Xk ejΩ0 k(t−2) + Xk ejΩ0 kt
k k
X
−2jΩ0 k
= [Xk (1 + e )]ejΩ0 kt
k

is periodic of period T0 and with Fourier series coefficients Zk = Xk (1 + e−2jΩ0 k ).


The signal X X
w(t) = x(2t) = Xk ejΩ0 k2t = Xm/2 ejΩ0 mt
k m even

is periodic of period T0 /2, with Fourier series coefficients



Xk/2 k even
Wk =
0 otherwise

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.11

4.10 (a) The sinusoidal components have periods T1 = 1 and T2 = 1/2 so that T2 /T1 = 1/2. x(t) is
periodic of fundamental period T1 = 2T2 = 1 and Ω0 = 2π.
(b) Expressing

x(t) = 0.5 + 2(ejΩ0 t + e−jΩ0 t ) − 4(ej2Ω0 t + e−j2Ω0 t )


∗ ∗
we get X0 = 0.5, X1 = X−1 = 2 and X2 = X−2 = −4 (See Fig. 4.3). Plotting |Xk |2 indicates
the power at each of the harmonics and it can be seen that the highest power is at 2Ω0 = 4π rad/sec.

|Xk |
4

0.5

k
−2 −1 0 1 2
∠Xk

−2 −1 0
k
1 2

−π

Figure 4.3: Problem 10

(c) Comparing

y(t) = 2 − 2 sin(2πt) = 2 + 2 cos(2πt + π/2)

with the output obtained from applying the eigenfunction property of LTI:

y(t) = 0.5|H(j0)| + 4|H(j2π)| cos(2πt + ∠H(j2π))


−8|H(j4π)| cos(4πt + ∠H(j4π))

gives H(j0) = 4, H(j2π) = 0.5ejπ/2 and H(j4π) = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.12

4.11 (a) See Fig. 4.4. Fourier series coefficients (Ω0 = π)

x(t)
1
··· ···
2 4 6
t
cos(2)

Figure 4.4: Problem 11

Z 2  2
1 1 jt 1 ejt(1−kπ) e−jt(1+kπ)
Xk = (e + e−jt )e−jkπt dt = +
2 0 2 4 j(1 − kπ) −j(1 + kπ) 0
 j2 −j2

1 e −1 e −1
= −
4 j(1 − kπ) j(1 + kπ)
1  j2 
= 2 2
j(e − e−j2 ) + jπk(ej2 + e−j2 ) − j(1 + kπ) + j(1 − kπ)
4(k π − 1)
jkπ(1 − cos(2)) + sin(2)
=
2(1 − k 2 π 2 )

(b) X1 (s) = L[cos(t)(u(t) − u(t − 2))] = L[cos(t)u(t) − cos(t)u(t − 2)]

Z ∞ Z ∞
L[cos(t)u(t − 2)] = cos(t)e−st dt = cos(ρ + 2)e−s(ρ+2) dρ
2 0
Z ∞ Z ∞ 
= e−2s cos(2) cos(ρ)e−sρ dρ − sin(2) sin(ρ)e−sρ dρ
0 0
−2s
= e [cos(2)L[cos(t)u(t)] − sin(2)L[sin(t)u(t)]]
 
−2s cos(2)s sin(2)
= e − 2
s2 + 1 s +1
We then have
 
s e−2s (cos(2)s − sin(2))
Xk = 0.5 2 −
s +1 s2 + 1 s=jkπ
jkπ(1 − cos(2)) + sin(2)
=
2(1 − k 2 π 2 )
which coincides with the expression obtained using the integral.
(c) Setting k = 0 in the above expression, we find the mean is X0 = sin(2)/2. Since the signal
x(t) − X0 is neither even nor odd the Fourier coefficients Xk should be complex, as they are.
(d) Letting

cos(t) = A cos(t − 2) + B sin(t − 2)


p
= A2 + B 2 cos(t − 2 − tan−1 (B/A))

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.13

which gives
p
A2 + B 2 = 1
tan−1 (B/A) = −2

which are satisfied by A = cos(2) and B = − sin(2), indeed A2 +B 2 = (cos(2))2 +(sin(2))2 = 1


and tan−1 (B/A) = tan−1 [− tan(2)] = −2. So that the Laplace transform

L[cos(t)u(t − 2)] = L[(A cos(t − 2) + B sin(t − 2))u(t − 2)]


= AL[cos(t − 2)u(t − 2)] + BL[sin(t − 2)u(t − 2)]
e−2s (cos(2)s − sin(2))
=
s2 + 1
which coincides with the result using the Laplace transform obtained before.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.14

4.12 (a) The steady state is

y(t) = 4|H(j2π)| cos(2πt + ∠H(j2π)) + 8|H(j3π)| cos(3πt − π/2 + ∠H(j3π))

so H(j2π) = 0.5ejπ = −0.5, H(j3π) = 0. Nothing else can be learned about the filter from the
input/output.
(b)

X 2
yss (t) = |H(j3k/2)| cos(3kt/2 + ∠H(j3k/2))
k2
k=1
= 2|H(j3/2)| cos(3t/2 + ∠H(j3/2))
= 2 cos(3t/2 − π/2)

since for frequencies bigger than 2 the magnitude response is zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.15

4.13 (a) g1 (t) = dx1 (t)/dt = −0.5[u(t) − u(t − 1)] + 0.5δ(t − 1) so that
X X X
g(t) = (−0.5[u(t − k) − u(t − k − 1)]) + 0.5δ(t − k − 1) = −0.5 + 0.5δ(t − k − 1)
k k k

periodic of fundamental periodT0 = 1.


(b) Fourier series of g(t) and x(t)

X
dx(t)
g(t) = = Xk jkΩ0 ejkΩ0 t
dt
k=−∞,6=0
Gk = jkΩ0 Xk (derivative property) Ω0 = 2π
1 − e−s
= G1 (s)|s=jk2π = −0.5 + 0.5e−s |s=jk2π = 0.5 (definition)
s
0.5
Xk = k 6= 0
jk2π

The dc term cannot be obtained from g(t), it is calculated by


Z 1
X0 = (−0.5t)dt = −0.25
0

(c) Fourier series of



X
y(t) = 0.5 + x(t) = 0.25 + Xk ej2πkt
k=−∞,6=0

the only difference is the dc value.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.16

4.14 (a)

x(t) = (jejπt/4 − je−jπt/4 ) + 2(ej5πt/4 + e−j5πt/4 )


= −2 sin(πt/4) + 4 cos(5πt/4) = 2 cos(πt/4 + π/2) + 4 cos(5πt/4)
y(t) = 2|H(jπ/4)| cos(πt/4 + π/2 + ∠H(jπ/4)) + 4|H(j5π/4)| cos(5πt/4 + ∠H(j5π/4))
= 4 cos(5πt/4 − 5π/4) = 4 cos(5π(t − 1)/4)

(b) i. The filter is band-pass:

|H(jΩ)|
1


−4.5π −1.5π 1.5π 4.5π
∠H(jΩ)
π/2

−π/2

Figure 4.5: Problem 14(b)

ii. According to the frequency response of the band-pass filter y(t) can have a second, third and
fourth harmonics, but since the magnitude of the second and fourth Fourier coefficients are
X2 = X4 = 0, the output has only the third harmonic giving

y(t) = 2|H(j3π)| cos(3πt + ∠H(j3π))


= 2 cos(3πt − π/2).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.17

4.15 (a) x(t) = | cos(πt)| is periodic of period T0 = 1 (Ω0 = 2π). The dc of x(t) is
Z 0.5
2 sin(π/2) 2
X0 = cos(πt)dt = =
−0.5 π π

If the low-pass filter has frequency response



A −Ωc ≤ Ω ≤ Ωc , Ωc < 2π
H(jΩ) =
0 otherwise

then
2H(j0)
Y0 = =1
π
for H(j0) = A = π/2.
(b) If x(t) is half-wave rectified signal, then T0 = 2 (Ω0 = π) and
Z 0.5
1 1
X0 = cos(πt)dt =
2 −0.5 π

so that Y0 = 1/2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.18

4.16 (a) The fundamental frequency is Ω0 = π (T0 = 2), so only the Fourier coefficients corresponding
to k = 0 and k = ±1, i.e., frequencies Ω = 0, ±Ω0 , are needed as the filter deletes any other
frequency component.

es − 2 + e−s
x1 (t) = r(t + 1) − 2r(t) + r(t − 1) → X1 (s) =
  s2
1 −1 1 − cos(πk)
Xk = (2 cos(πk) − 2) = k 6= 0
2 k2 π2 k2 π2
2
X0 = 0.5 (by observation), X1 = X−1 = 2
π

(b) Yes, y(t) is periodic of period 2π and dc value 2X0 = 1.


(c) The steady state output is

y(t) = H(j0)X0 + H(jπ)X1 ejπt + H(−jπ)X−1 e−jπt


 
8 ej(πt−π/2) + e−j(πt−π/2)
= 2 × 0.5 + 2
π 2
8
1 + 2 cos(πt −π/2)
= |{z}
π
|{z} | {z }
A C
B

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.19

4.17 (a) The signal in [0, 1] is


x1 (t) = u(t) − r(t) + r(t − 1)
so that (T0 = 1, Ω0 = 2π)
   
1 1 1 e−s/2 s/2
Xk = − 2 (1 − e−s ) = − (e − e −s/2
)
s s s=j2πk s s2 s=j2πk
−j e−jπ −j
= + 2 2 2j sin(πk) = k 6= 0
2πk 4π k 2πk
and by inspection X0 = 0.5. Thus the Fourier series for x(t) is

X −j jk2πt
x(t) = 0.5 + e
2πk
k=−∞,6=0

(b) The derivative of x(t) (from the figure) is



X
dx(t)
g(t) = = −1 + δ(t − k)
dt
k=−∞

with a period between −0.5 and 0.5 of

g1 (t) = −u(t + 0.5) + u(t − 0.5) + δ(t)

and same fundamental frequency Ω0 as x(t) thus


 
−1 s/2 j
Gk = (e − e−s/2 ) + 1 = 2j sin(πk) + 1 = 0 + 1 = 1
s s=j2πk 2πk

so that

X
g(t) = ejk2πt
k=−∞

equal to the derivative of the Fourier series of x(t). Using the derivative Fourier series property

1 −j
Gk = jΩ0 kXk ⇒ Xk = =
j2πk 2πk

Using these and X0 = 0.5 we can then get the Fourier series for x(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.20

4.18 (a) According to the eigenfunction property of LTI the steady state response corresponding to the given
x(t) = 1 + cos(t + π/4) = cos(0t) + cos(t + π/4) is

yss (t) = |H(j0)| cos(0t + ∠H(j0)) + |H(j)| cos(t + π/4 + ∠H(j))

Since
1 j0
H(j0) = H(s) |s=j0 = e
2
1+j 4 − 2j
H(j) = H(s) |s=j = = = 0.447∠−26.6o
1 + 3j 10

yss (t) = 0.5 + 0.447 cos(t + 18.4o )

(b) i. The input x(t) = 4u(t) = 4 cos(0t)u(t) in the steady state is 4 cos(0t), i.e., a cosine of
frequency zero, so that its response is

yss (t) = 4|H(j0)| cos(0t + ∠H(j0)) = 4 × 0.5 = 2

ii. If x(t) = 4u(t), then in the Laplace transform

4 A
Y (s) = = + ···
s((s + 1.5)2 2
+ (2 − 1.5 )) s

where the · · · stands for terms that have poles in the left-hand s-plane that correspond to the
transient so
yss (t) = A = Y (s)s |s=0 = 2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.21

4.19 (a) The derivative of a period of x(t) in −0.5 ≤ t ≤ 0.5 gives a period

dx1 (t)
y1 (t) = = 2δ(t + 0.25) − 2δ(t − 0.25) − 0.5 ≤ t ≤ 0.5
dt
of the periodic signal y(t). The Laplace transform of y1 (t) is Y1 (s) = 2e0.25s − 2e−0.25s so that the
Fourier series of y(t) of period T0 = 1, and Ω0 = 2π (just like x(t)) is
1
Yk = Y1 (s)|s=j2πk = 4j sin(πk/2)
T0
giving a Fourier series expansion
X
y(t) = 4j sin(πk/2)ej2kπt
k

(b) A period of x(t) is


x1 (t) = 2u(t + 0.25) − 2u(t − 0.25)
2 0.25s
X1 (s) = (e − e−0.25s )
s

1 sin(πk/2)
Xk = X1 (s) |s=j2kπ = 2
T0 πk
so that X
x(t) = Xk ej2πkt
k

The Fourier series


dx(t) X X
y(t) = = j2πkXk ej2πkt = Yk ej2πkt
dt
k k

where
sin(πk/2)
Yk = j2πkXk = 4jkπ = 4j sin(πk/2)
πk
which coincides with the result in part (a).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.22

4.20 (a) The pulse p(t) has an average of zero, so its integral is zero in each period, for kT0 ≤ t ≤ (k + 1)T0 ,
k an integer, and T0 = 1. If s1 (t) is the integral of p1 (t) for 0 ≤ t ≤ 1 we have that
Z t Z t Z t
s1 (t) = p1 (τ )dτ = [x1 (τ ) − 1]dτ = x1 (τ )dτ − t 0≤t≤1
0 0 0

Notice that x1 (t) = 2 for 0 ≤ t ≤ 0.25 and for 0.75 ≤ t ≤ 1, and zero for 0.25 ≤ t ≤ 0.75, so for the
given times,
Z 0
s(0) = 2dτ − 0 = 0
0
Z 0.25
s(0.25) = 2dτ − 0.25 = 0.25
0
Z 0.25
s(0.5) = 2dτ − 0.5 = 0
0
Z 0.25
s(0.75) = 2dτ − 0.75 = −0.25
0
Z 0.25 Z 1 
s(1) = 2dτ + 2dτ − 1 = 0
0 0.75

Letting the period of p(t) between 0 and 1 be

p1 (t) = x1 (t) − [u(t) − u(t − 1)] = [2u(t) − 2u(t − 0.25) + 2u(t − 0.75) − 2u(t − 1)] − [u(t) − u(t − 1)]
= u(t) − 2u(t − 0.25) + 2u(t − 0.75) − u(t − 1)

its integral gives the period

s1 (t) = 0.25r(t) − 0.5r(t − 0.25) + 0.5r(t − 0.75) − 0.25r(t − 1)

of s(t), 0 ≤ t ≤ 1, which can be used to verify the above results.


(b) The pulse p(t) has a period between 0 and 1 equal to

p1 (t) = u(t) − 2u(t − 0.25) + 2u(t − 0.75) − u(t − 1)

so that the Fourier series coefficients of p(t) are given by (T0 = 1, Ω0 = 2π)

1 −0.5s 0.5s
Pk = e (e − 2e0.25s + 2e−0.25s − e−0.5s )|s=j2πk
T0 s
1 −jπk
= e 2(sin(πk) − 2 sin(πk/2))
πk
4
= (−1)(k+1) sin(πk/2)
πk
where we have replaced sin(πk) = 0. The value of Pk = 0 when k is even since sin(πk/2) = 0 for k
even, and for odd k since sin(πk/2) = (−1)(k+1) then Pk = 4/(πk). Since the average of p(t) is zero,
we have that
X 4
p(t) = ej2πkt

k, odd

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.23

Since
0.25 −0.5s 0.5s 0.25
S(s) = 2
e (e − 2e0.25s + 2e−0.25s − e−0.5s ) = P (s)
s s
then (T1 = 0.5 and Ω1 = 4π):
1 0.25
Sk = S(s)|s=jΩ1 k = 2 P (s)|s=j4πk
T1 s

(c)(d) The integral over a period [−T0 /2, T0 /2] = [−0.5, 0.5] is
Z 0.5 X Z 0.5
4
p(τ )dτ = ej2πkτ dτ
−0.5 kπ −0.5
k, odd
X 4 ej2πkτ
= |0.5
kπ j2πk −0.5
k, odd
X 4 sin(πk)
= =0
kπ πk
k, odd

since sin(πk) = 0 for k odd. Since p(t) has zero mean, the integral over a period is zero, coinciding with
the above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.24

4.21 (a) The derivative of the period between 0 and 2 of the triangular signal x(t) is
dx1 (t)
y1 (t) = = u(t) − 2u(t − 1) + u(t − 2)
dt
and the signal X
y(t) = y1 (t − 2k)
k
is a train of square pulses of period T0 = 2 and average zero. The signal z(t) = y(t) + 1 is also periodic
of the same period as y(t) but average 1. The Fourier series coefficients of y(t) are
1 −s s 1 −jπk
Yk = e (e − 2 + e−s )|s=jπk = e (cos(πk) − 1)
2s jπk
1   2
= (−1)2k − (−1)k = k=6 0, odd
jπk jπk
and zero for k even. The Fourier coefficients of z(t) are 1 as d.c. value and Zk = Yk for k odd and zero
for k even and 6= 0.
(b) The Fourier series of y(t) is

X 2 jπkt
y(t) = e
jπk
k=−∞, odd
X sin(πkt)
= 4
πk
k>0, odd

and that of the signal z(t) is


X sin(πkt)
z(t) = 1 + 4
πk
k>0, odd
The signal y(t) is an odd function of t and as such it can be represented by sines, and this is why it has
purely imaginary coefficients for its exponential Fourier series. The signal z(t) is neither even nor odd
and as such it is made up of an even component, the constant 1, and an odd component, y(t).
(c) If we reverse the process in (a) by integrating y1 (t) we get x1 (t) = r(t) − 2r(t − 1) + r(t − 2) which
would give us the periodic signal x(t) by shifting and adding. The Fourier series coefficients of x(t) are
Yk 2
Xk = = k 6= 0, odd, and X0 = 0.5
jπk −(πk)2
and zero for k even. Notice that the integral of y(t) would be zero for each period and would give the
x1 (t) shifted in time in each period.
(d) The signal x(t) is even and as such it can be represented by a cosine Fourier series so the coefficients
are real. We have that

X −2 jπkt
x(t) = 0.5 + e
(πk)2
k=−∞, k6=0, odd

X 4 cos(πkt − π)
= 0.5 +
(πk)2
k=1, odd

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.25

4.22 (a) The product


X X
z(t) = x(t)y(t) = Xk ejkΩ0 t Ym ejmΩ0 t
k m
XX XX
j(k+m)Ω0 t
= Xk Ym e = Xk Yn−k ejnΩ0 t
k m k n
" #
X X X
= Xk Yn−k ejnΩ0 t = Zn ejnΩ0 t
n k n

where we let n = k + m and X


Zn = Xk Yn−k
k

i.e., the convolution sum of the Fourier coefficients Xk and Yk . Notice that the Fourier series of z(t) has
the same fundamental frequency as x(t) and y(t), Ω0 , so z(t) is periodic of period T0 .
(b) If Ω1 = 2Ω0 then we have that the product
X X
z(t) = x(t)y(t) = Xk ejkΩ0 t Ym ejm2Ω0 t
k m
XX XX
j(k+2m)Ω0 t
= Xk Ym e = Xk Y(n−k)/2 ejnΩ0 t
k m k n
" #
X X X
= Xk Y(n−k)/2 ejnΩ0 t = Zn ejnΩ0 t
n k n

where we let n = k + 2m. The coefficients


X
Zn = Xk Y(n−k)/2
k

where Y(n−k)/2 is only defined for (n−k)/2 an integer, whenever it is not an integer we let the coefficient
be zero.
Again in this case the Fourier series of z(t) has the same fundamental frequency, Ω0 , as x(t) and y(t),
so z(t) is periodic of period T0 . Indeed, the periods are T0 and T1 = 2π/Ω1 = 2π/2Ω0 = T0 /2, and
their ratio T1 /T0 = 0.5 so that T0 = 2T1 is the period of z(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.26

4.23 (a) The periodic signal x(t), of period T0 = 0.5 (Ω0 = 4π), can be written
1
x(t) = sin2 (2πt) =
[1 − cos(4πt)]
2
1 1 j4πt 1 −j4πt
= − e − e
2 4 4
so X0 = 1/2, X1 = X−1 = −1/4.
(b) A period of y(t) is

y1 (t) = sin(2πt)u(t) + sin(2π(t − 0.5))u(t − 0.5)

having a Laplace transform



Y1 (s) = e−0.25s [e0.25s + e−0.25s ]
s2 + 4π 2
so that the Fourier series coefficients of y(t) are given by (T1 = 0.5, Ω1 = 4π)
1 4π
Yk = Y1 (s)|s=jΩ1 k = e−jπk 2 cos(πk)
T1 4π (1 − 4k 2 )
2

2
=
π(1 − 4k 2 )

The dc value is Y0 = 2/π.


(c) The signals x(t) and y(t) are not equal. For instance when t = 1/8 we have

y(1/8) = | sin(π/4)| = 0.707

while
x(1/8) = (sin(π/4))2 = 0.5
(d) Passing the signals x(t) through an ideal low-pass filter with magnitude 2 and cut-off frequency
0 < Ωx < 4π we obtain in steady state as output a dc signal z(t) = 1. On the other hand, passing y(t)
through an ideal low-pass filter of magnitude π/2 and cut-off frequency 0 < Ωy < 4π gives as output,
in steady state, a dc signal w(t) = 1. Although either x(t) or y(t) can be used to obtain the desired
signal, x(t) has the advantage that the required filter has as magnitude an integer value of 2, instead of
an irrational value of π/2 and if the filter being used is not an ideal filter, there is more flexibility in
obtaining the filter to get a dc value from x(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.27

4.2 Problems using MATLAB


4.24 (a) The Fourier coefficients {Xk } are
Z T0 Z 1
1 j
Xk = x(t)e−jkΩ0 t dt = te−j2πkt dt =
T0 0 0 2πk
where we used T0 = 1, Ω0 = 2π, and the integral
Z
eax
xeax dx = 2 (ax − 1)
a
Indeed, Z 1
e−j2πkt j
te−j2πkt dt = (−j2πkt − 1)|1t=0 =
0 (−j2πk)2 2πk
The average is calculated separately as
Z 1
X0 = tdt = 0.5.
0

(b) The Laplace transform of the period x1 (t) is

1 − e−s e−s e−0.5s  0.5s −0.5s


 e−s
X1 (s) = − = e − e −
s2 s s2 s
The Fourier coefficients are obtained according to (Ω0 = 2π/T0 = 2π)

1 e−jπk 1 j
Xk = X1 (s)|s=j2kπ = 2 2
sin(πk) − =0+ k 6= 0
T0 2jπ k j2πk 2πk
The average is 0.5 by observation. Since x(t) − 0.5 is odd, it can be represented by sines.
(c) The following script is used to find the magnitude spectrum and to obtain an approximate x̂(t). The
approximate signal is given by
40
X X sin(2πkt) 40
j j2πkt
x̂(t) = 0.5 + e = 0.5 −
2πk πk
k=−40,k6=0 k=1

% Pr. 4_24
clear all; clf
% magnitude line spectrum
X1(1)=0.5;
for k=1:40,
X1(k+1)=1/(2*pi*k);
end
kk=-40:40;
X=[fliplr(X1) X1(2:41)];
figure(1)
stem(kk,X); grid
xlabel(’k’);ylabel(’|X_k|’)
% approximate signal
t=0:0.001:10;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.28

x=0.5*ones(1,length(t));
for k=1:40,
x=x-1/(pi*k)*sin(2*pi*k*t);
end
figure(2)
plot(t,x);grid;axis equal
xlabel(’t (sec)’); ylabel(’\hat{x}(t)’)

0.5

1.5

0.4
1

\hat{x}(t)
|Xk|

0.3 0.5

0.2 0

−0.5
0.1 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t (sec)

0
−40 −30 −20 −10 0 10 20 30 40
k

Figure 4.6: Problem 24: Magnitude line spectrum of Xk and approximate x̂(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.29

4.25 (a) The period x1 (t) = r(t) − r(t − 1) − u(t − 1), and T0 = 2 so that Ω0 = π. The Fourier coefficients
are
   
1 1 − e−s e−s 1 − e−s (1 + s)
Xk = − =
2 s2 s s=jπk 2s2 s=jπk
  
1 1   j/(2πk) k 6= 0, even
= (−1)k (1 + jπk) − 1 =
2 π2 k2 −(2 + jπk)/(2π 2 k 2 ) k odd

The average value which cannot be obtained from above is


Z
1 1
X0 = tdt = 0.25
2 0

(b) The Fourier series of y(t) is


X
y(t) = x(−t) = X−k ejkΩ0 t
k

so that

 −j/(2πk) k 6= 0, even
Yk = X−k = 0.25 k=0

−(2 − jπk)/(2π 2 k 2 ) k odd

(c) Adding the above signals z(t) = x(t) + y(t) we get triangular pulses. The Fourier coefficients of
z(t) are

 0 k 6= 0, even
Zk = Xk + Yk = 0.5 k=0

−2/(π 2 k 2 ) k odd

Notice that the Fourier coefficients of x(t) and y(t) which are neither even nor odd are complex, while
the Fourier coefficients of z(t) are real given that it is an even signal.
A period of z(t) is
z1 (t) = r(t) − 2r(t − 1) + r(t − 2)
and T0 = 2, Ω0 = π. The Fourier coefficients of z(t) are

1 (−1)k 0 k 6= 0, even
Zk = Z1 (s)|s=jπk = 2 2 (1 − cos(πk)) =
2 π k −2/(π 2 k 2 ) k odd

and by inspection Z0 = 0.5. which coincide with the ones obtained before. The following script gives
an approximation of z(t) using 41 harmonics, and shown in Fig. 4.7.

% Pr. 4_25
clear all; clf
% magnitude line spectra
X1(1)=0.25;
for k=1:2:40,
X1(k+1)=abs(-(2+j*pi*k)/(2*piˆ2*kˆ2));
end
for k=2:2:40,

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.30

X1(k+1)=abs(1/(2*pi*k));
end
kk=-40:40;
X=[fliplr(X1) X1(2:41)];
figure(1)
subplot(311)
stem(kk,X); grid;axis([-40 40 0 1]);ylabel(’|X_k|’)

Y1(1)=0.25;
for k=1:2:40,
Y1(k+1)=abs((2+j*pi*k)/(2*piˆ2*kˆ2));
end
for k=2:2:40,
Y1(k+1)=abs(-1/(2*pi*k));
end
Y=[fliplr(Y1) Y1(2:41)];
subplot(312)
stem(kk,Y); grid; axis([-40 40 0 1]);ylabel(’|Y_k|’)

Z=[fliplr(Y1+X1) Y1(2:41)+X1(2:41)];
subplot(313)
stem(kk,Z); grid; axis([-40 40 0 1])
xlabel(’k’);ylabel(’|Z_k|’)

% approximate of z(t)
t=0:0.001:10;
z=0.5*ones(1,length(t));
for k=1:2:10,
z=z-4*cos(k*pi*t)/(pi*k)ˆ2;
end
figure(2)
plot(t,z);grid
xlabel(’t (sec)’); ylabel(’z_1(t)’)

0.4 0.9
|Xk|

0.2
0.8
0
−40 −30 −20 −10 0 10 20 30 40 0.7

0.6
0.6
0.4
z1(t)
|Yk|

0.5
0.2
0.4
0
−40 −30 −20 −10 0 10 20 30 40
0.3
0.6
0.2
0.4
|Zk|

0.2 0.1

0 0
−40 −30 −20 −10 0 10 20 30 40 0 1 2 3 4 5 6 7 8 9 10
k t (sec)

Figure 4.7: Problem 25: Line spectra for x(t), y(t) ans z(t), (right) approximate ẑ(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.31

4.26 (a) x(t) is a train of rectangular pulses.The Laplace transform of the period x1 (t) is

1 e−s/2 (es/2 − e−s/2 )


X1 (s) = (1 − e−s ) =
s s
and T0 = 2, so Ω0 = π. The Fourier series coefficients are then

1 sin(πk/2) −jkπ/2
Xk = X1 (s) |s=jπk = e X0 = 0.5
2 πk/2

(b) The following script is used to find and plot the magnitude line spectrum of x(t), and to approximate
the signal with 40 harmonics.

% Pr. 4_26
clear all; clf
% magnitude line spectra
X(1)=0.5;
for k=1:40,
X(k+1)=abs(0.5*sin(pi*k/2)/(pi*k/2));
end
kk=-40:40;
X=[fliplr(X) X(2:41)];
figure(1)
stem(kk,X); grid;axis([-40 40 0 0.6]);ylabel(’|X_k|’)
% approximate of z(t)
t=0:0.001:10;
x=0.5*ones(1,length(t));
for k=1:40,
x=x+(sin(pi*k/2)/(pi*k/2))*cos(pi*k*t-k*pi/2);
end
figure(2)
plot(t,x);grid
xlabel(’t (sec)’); ylabel(’x_a(t)’)

1.2

1
0.5

0.8
0.4

0.6
xa(t)
|Xk|

0.3

0.4

0.2
0.2

0.1
0

0 −0.2
−40 −30 −20 −10 0 10 20 30 40 0 1 2 3 4 5 6 7 8 9 10
t (sec)

Figure 4.8: Problem 26: Magnitude line spectrum and approximate of train of pulses.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.32

4.27 (a) The difference between calculating the Fourier coefficients of the full-wave and of the half-wave
rectified signal is the period Ti , i = 0, 1, as the period signal is the same, i.e.,

x1 (t) = sin(πt)u(t) + sin(π(t − 1))u(t − 1),

with Laplace transform

π −s πe−0.5s 0.5s
X1 (s) = (1 + e ) = (e + e−0.5s )
s2 + π 2 s2 + π 2

Full-wave In this case T0 = 1, Ω0 = 2π and

2πe−jπk 2
Xk = X1 (s) |s=j2πk = 2 2 2
cos(πk) =
−4π k + π (1 − 4k 2 )π

since e−jπk = cos(πk) = (−1)k .


Half-wave In this case T0 = 2, Ω0 = π and

1 πe−jπk/2
Xk = X1 (s) |s=jπk = cos(πk/2)
2 −π 2 k 2 + π 2
1
= e−jπk/2 cos(πk/2)
(1 − k 2 )π
2 1
The d.c. values are X0 = π for the full-wave, and X0 = π for the half-wave signal.
(b) When plotting the magnitude line spectra and obtaining an approximation with MATLAB X1 for the
half-wave signal is not well defined (0/0) and L’Hôpital’s rule need to be applied. Instead we can use
its even-odd decomposition so that if xh (t) is the half-wave signal and xf (t) is the full-wave signal we
have that

xh (t) = 0.5[xf (t) + sin(πt)]


X∞
1 ejπt e−jπt
= ejπ(2k) + −
(1 − (2k)2 )π 4j 4j
k=−∞

X 1 ejπt e−jπt
= 2
ejπ` + −
(1 − ` )π 4j 4j
`=−∞, even

so that the Fourier coefficients for the half-wave signals are



 1/(π(1 − k 2 )) k even
Xk = 1/(4j) k=1

0 otherwise

The following script plots the magnitude line spectrum and computes an approximate of the half-wave
signal.

% Pr. 4_27
clear all; clf
% magnitude line spectra
X(1)=2/pi;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.33

for k=1:40,
X(k+1)=abs(2/(pi*(1-4*kˆ2)));
end
kk=-40:40;
X=[fliplr(X) X(2:41)];
figure(1)
stem(kk,X); grid;axis([-40 40 0 0.8]);ylabel(’|X_k|’)
% approximate of z(t)
t=0:0.001:10;
x=(1/pi)*ones(1,length(t))+0.5*sin(pi*t);
for k=1:40,
x=x+2/(pi*(1-4*kˆ2))*cos(2*pi*k*t);
end
figure(2)
plot(t,x);grid;axis([0 10 -0.1 1.1])
xlabel(’t (sec)’); ylabel(’x_a(t)’)

0.8

1
0.7

0.6 0.8

0.5
0.6
xa(t)
|Xk|

0.4

0.4
0.3

0.2 0.2

0.1
0

0
−40 −30 −20 −10 0 10 20 30 40 0 1 2 3 4 5 6 7 8 9 10
t (sec)

Figure 4.9: Problem 27: Magnitude line spectrum of half-wave rectified signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.34

4.28 The signal x(t) with a period x1 (t) = u(t) − u(t − 1), period T0 = 2 ( Ω0 = π), has

1 e−s/2 s/2
X1 (s) = (1 − e−s ) = (e − e−s/2 )
s s
so that its Fourier coefficients are
1 1
Xk = X1 (s)|s=jπk = sin(πk/2)e−jπk/2
T0 πk
1 sin(πk/2) −jπk/2
= e
2 πk/2

On the other hand, y(t) with a period y1 (t) = r(t) − 2r(t − 1) + r(t − 2), T0 = 2 ( Ω0 = π), we have
that
1 1
Y1 (s) = 2 [1 − 2e−s + e−2s ] = 2 [es − 2 + e−s ]e−s
s s
and the Fourier coefficients are given by
−1 −jπk
Yk = e (cos(πk) − 1)
π2 k2
 2
1 sin2 (πk/2) k 1 sin(πk/2)
= (−1) = (−1)k
2 π 2 k 2 /4 2 πk/2

using 1 − cos(πk) = 2 sin2 (πk/2).

We can then see that 2


1 sin(πk/2)
|Yk | = = 2|Xk |2
2 πk/2
Notice that the above does not allow the computation of the dc values as we have in each case a 0/0
situation, but it can be easily seen that
1
X0 = = Y0
2
To verify that y(t) is smoother than x(t) we compute the first few values of the line spectrum of x(t) and
y(t)
k |Xk | |Yk | |Xk |2 |Yk |2
0 0.5 0.5 0.25 0.25
1 1/π 2/π 2 1/π 2 4/π 4
2 0 0 0 0
3 1/3π 2/9π 2 1/9π 2 4/(81π 4 )
As can be seen, the line spectrum of y(t) goes faster to zero than that of x(t) which means that y(t) is
smoother than x(t) (see Fig. 4.10), i..e., y(t) has smaller higher frequency components than x(t).

% Pr. 4_28
clear all; clf
% magnitude line spectra
X(1)=0.5;Y(1)=X(1);
for k=1:40,
X(k+1)=abs(0.5 *sin(pi*k/2)/(pi*k*0.5));
Y(k+1)=abs(0.5*(sin(pi*k/2)/(pi*k*0.5))ˆ2);

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.35

end
X(1:5)
Y(1:5)
kk=-40:40;
X=[fliplr(X) X(2:41)];
Y=[fliplr(Y) Y(2:41)];
figure(1)
subplot(211)
stem(kk,X); grid;axis([-40 40 0 0.6]);ylabel(’|X_k|’)
subplot(212)
stem(kk,Y); grid;axis([-40 40 0 0.6]);ylabel(’|Y_k|’)

0.5

0.4
|Xk|

0.3

0.2

0.1

0
−40 −30 −20 −10 0 10 20 30 40

0.5

0.4
|Yk|

0.3

0.2

0.1

0
−40 −30 −20 −10 0 10 20 30 40

Figure 4.10: Problem 28: Magnitude line spectra of x(t) and y(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.36

4.29 The periods of the two signals are:

x1 (t) = u(t) − u(t − 1) 0 ≤ t ≤ T0 = 2


y1 (t) = x1 (2t) = u(2t) − u(2t − 1) = u(t) − u(t − 0.5) 0 ≤ t ≤ T1 = 1

the Fourier series coefficients of these signals are


1 −s/2 s/2 sin(πk/2) −jπk/2
Xk = e (e − e−s/2 ) |s=jπk = e
2s πk
1 sin(πk/2) −jπk/2
Yk = e−s/4 (es/4 − e−s/4 ) |s=j2πk = e
s πk
We see that the coefficients for the two signals are identical, but the fundamental frequency for x(t) is
Ω0 = 2π/T0 = π while the one for y(t) is Ω1 = 2π/T1 = 2π = 2Ω0 so that the line spectrum of x(t) is
compressed when compared to that of y(t). Thus compression in a period y(t) = x(2t) corresponds to
expansion in the frequency domain. Thus, x(t) is smoother than y(t) as this displays higher frequencies.

% Pr. 4_29
clear all; clf
% magnitude line spectra
X(1)=0.5;Y(1)=X(1);
for k=1:40,
X(k+1)=abs(0.5 *sin(pi*k/2)/(pi*k*0.5));
end
Y=X;
kk=-40:40;
X=[fliplr(X) X(2:41)];
Y=[fliplr(Y) Y(2:41)];
figure(1)
subplot(211)
stem(pi*kk,X); grid;axis([-40*pi 40*pi 0 0.6]);ylabel(’|X_k|’)
subplot(212)
stem(2*pi*kk,Y); grid;axis([-40*2*pi 40*2*pi 0 0.6]);ylabel(’|Y_k|’)

0.5

0.4
|Xk|

0.3

0.2

0.1

0
−100 −50 0 50 100

0.5

0.4
|Yk|

0.3

0.2

0.1

0
−250 −200 −150 −100 −50 0 50 100 150 200 250

Figure 4.11: Problem 29: The line spectrum of Yk is an expansion of that of Xk (notice the frequencies for
each).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.37

4.30 (a) The period x1 (t) can be expressed as

x1 (t − 0.5) = sin(πt)u(t) + sin(π(t − 1))u(t − 1)

which has a Laplace transform


π  0.5s 
X1 (s) = e + e−0.5s
s2 +π 2

so that the Fourier coefficients are


2 2(−1)k
Xk = 2
cos(πk) =
π(1 − 4k ) (1 − 4k 2 )π

The dc value is X0 = 2/π.


(b) Writing the full-wave rectified signal as

X
x(t) = X0 + Xk ej2πkt
k=−∞,k6=0

the output of the filter is according to the eigenfunction property



X
y(t) = X0 H(j0) + Xk H(j2πk)ej2πkt
k=−∞,k6=0

If y(t) = X(0) = 2/π then H(j0) = 1 and H(j2πk) = 0 for k 6= 0.


(c) The following script is used to plot the magnitude spectrum of x(t)

% Pr. 4_30
clear all; clf
% magnitude line spectra
X(1)=2/pi;
for k=1:40,
X(k+1)=abs(2/(pi*(1-4*kˆ2)));
end
kk=-40:40;
X=[fliplr(X) X(2:41)];
figure(1)
stem(pi*kk,X); grid;axis([-40*pi 40*pi 0 0.7]);ylabel(’|X_k|’)

0.6

0.5

0.4
|Xk|

0.3

0.2

0.1

0
−100 −50 0 50 100

Figure 4.12: Problem 30: Magnitude line spectrum for x(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.38

4.31 According to Parseval’s power result we have that


Z T0 /2 ∞
X
1
|x(t)|2 dt = |Xk |2
T0 −T0 /2 k=−∞

or that the power of the signal in the time domain is matched by the sum of the square of the Fourier
series coefficients.
The power in time is
Z 1 Z 1 Z 1
1 22 2 t3 1 1
t dt = t dt = t2 dt = | =
T0 −1 T0 0 0 3 0 3
The power in the frequency is the sum of
4
|Xk |2 = , −∞ < k < ∞, k 6= 0, odd
(πk)4

and the dc term (0.5)2 or


X 4
(0.5)2 + 2
(πk)4
k>0, odd
Using MATLAB we can find the top value of k that will make this sum equal to 0.9/3 = 0.3 or 90%
of the total power. The script below shows that the dc and 5 harmonics are enough to get the desired
approximation.

% Pr. 4_31
clear all
sum=0.25;k=1;
while sum<(1/3)*.9995,
N=k;
sum=sum+8/(pi*k)ˆ4;
k=k+2;
end
disp(’number of terms’)
N
disp(’power with that many terms’)
sum
% approximate of z(t)
t=0:0.001:100;
x=0.5;
for k=1:2:N
x=x+4*cos(pi*k*t-pi)/(pi *k)ˆ2;
end
figure(1)
plot(t,x);grid;axis([0 10 -0.1 1.1])
xlabel(’t (sec)’); ylabel(’x_a(t)’)

number of terms
N = 5

power with that many terms


sum = 0.3332

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.39

0.8

0.6

xa(t)
0.4

0.2

0 1 2 3 4 5 6 7 8 9 10
t (sec)

Figure 4.13: Problem 31: Approximation of the triangular signal with N = 5.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.40

4.32 (a) The fundamental period of the sinusoid is T = 1/880 so that T0 = 5T = 5/880 sec., T1 = T0 /4 and
T2 = 3T0 /4. The Fourier series coefficients of ω(t) are
1 1
Wk = W1 (s)|s=jkΩ0 = 2 (1 − e−sT0 /4 − e−s3T0 /4 + e−sT0 )|s=jkΩ0
T0 s
e−sT0 /2 sT0 /2
= (e − esT0 /4 − e−sT0 /4 + e−sT0 /2 )|s=jkΩ0
s2
2e−jkπ 2π
= (cos(πk) − cos(πk/2)) Ω0 = = 352π rad/sec
−Ω20 k 2 T0

(b) The signal s(t) = w(t) cos(2πfA t) shifts the harmonics of w(t) to a central frequency 2πfA .
The number of harmonic frequencies is increased by windowing the sinusoid or sum of sinusoids.

%Problem 4_32
clear all; clc
% parameters
Fs = 880; %frequency
T = 1/Fs; %sample period
T0 = 5*T; T1 = T0/4; T2 = T0*3/4;
% a)----------------------------------------------------------
% define one period of w signal -> w1
Ts=1/17600; % overall sample period
t=0:Ts:T0-Ts; Nn=length(t);
x1=[t(1:ceil(Nn/4)) t(ceil(Nn/4)+1)*ones(1,ceil(Nn/4))]; x2=fliplr(x1);
w1=[x1 x2];
N=length(w1); %number of samples in w1
% plot line spectrum
figure(1)
FSeries(w1,Ts,T0,N);
% harmonics H to approximate w1?
w0=2*pi/T0;
DC=0.001065; H=3;
for k=1:H,
a(k)=2*(cos(k*w0*T0/4)-cos(k*w0*T0/2))/T0/kˆ2/w0ˆ2;
end
a=[DC 2*a];
figure(2)
for N1=2:H+1,
x=a(1)*ones(1,length(t));
for k=2:N1,
x=x+a(k)*cos((k-1)*w0.*(t+T0/2));
end
plot(t,x);
axis([0 max(t) 1.1*min(x) 1.1*max(x)]);
hold on;
plot(t,w1,’r’)
ylabel(’Amplitude’);xlabel(’t (sec)’);
legend(’aprox w1(t)’,’w1(t)’);grid;
hold off
pause(0.1);
clear x;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.41

end
clear H a x1
% b)----------------------------------------------------------
s = cos(2*pi*Fs*t).*w1; %modulated signal s
figure(3);
FSeries(s,Ts,T0,N); % line spectrum of s
% how many harmonics H are necessary to approximate s?
w0=2*pi/T0;
DC=0.001065;H=3;
for k=1:H,
a(k)=2*(cos(k*w0*T0/4)-cos(k*w0*T0/2))/T0/kˆ2/w0ˆ2;
end
a=[DC 2*a];
figure(4)
for N1=2:H+1,
x=a(1)*ones(1,length(t));
for k=2:N1,
x=x+a(k)*cos((k-1)*w0.*(t+T0/2));
x1=x.*cos(5*w0.*t);
end
plot(t,x1);
axis([0 max(t) 1.1*min(s) 1.1*max(s)]);
hold on;
plot(t,s,’r’)
ylabel(’Amplitude’); xlabel(’t (sec)’);
legend(’aprox s(t)’,’s(t)’); grid;
hold off
pause(0.1);
clear x;
end
% c)----------------------------------------------------------
p = cos(2*pi*Fs*t); %signal p
figure(5);
FSeries(p,Ts,T0,N); %line spectrum of p
%sound(p); pause(1); sound(w0*s);pause(2);
% d)----------------------------------------------------------
p = sin(2*pi*440*t)+sin(2*pi*550*t)+sin(2*pi*660*t); %signal p
s = p.*w1; %modulated signal s
figure(6);
FSeries(s,Ts,T0,N); %line spectrum of s
% sound(100*p); pause(1); sound(100*w0*s);

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.42

−3 −4 −3
x 10 Periodic signal x 10 x 10 Periodic signal

2.5 aprox w1(t) 2


w1(t)
2 14 1
1.5
x(t)

x(t)
0
1 12
−1
0.5 −2
0 10
Amplitude

0 0.005 0.01 0.015 0.02 0 0.005 0.01 0.015 0.02


t (sec) t (sec)
−3
x 10 Magnitude Line Spectrum
−3
x 10 Phase Line Spectrum 8 −4
x 10 Magnitude Line Spectrum
−4
x 10 Phase Line Spectrum
1 5
1 5
0.5 6
0.8 4
<Xk|

<Xk|
|Xk|

|Xk|
0.6 0 3 0
4
0.4 2
−0.5
0.2 1
2
0 −1 0 −5
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 1 2 3 4 5 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
w (rad/sec) 4 w (rad/sec) 4 t (sec) −3 w (rad/sec) 4 w (rad/sec) 4
x 10 x 10 x 10 x 10 x 10

Figure 4.14: Problem 32. Right to left: window and line spectra, approximation of window, windowed
sinusoid and its line spectra.

−3 −3
x 10 Periodic signal x 10 Periodic signal
2
1.5
aprox s(t) 2
s(t) 1
0
1
x(t)

x(t)

0
−2

−1 −4
0.5

−2
Amplitude

0 0.005 0.01 0.015 0.02 0 0.005 0.01 0.015 0.02


0 t (sec) t (sec)
−16 −4 −3
Magnitude Line Spectrum x 10 Phase Line Spectrum x 10 Magnitude Line Spectrum x 10 Phase Line Spectrum
1.5
0.5 5 5
−0.5 1
0.4 4
0.5
0.3 3
<Xk|

<Xk|
|Xk|

|Xk|

0 0
−1
0.2 2 −0.5

0.1 1 −1
−1.5 −5
0 0 −1.5
0 1 2 3 4 5 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
t (sec) −3 w (rad/sec) 4 w (rad/sec) 4 w (rad/sec) 4 w (rad/sec) 4
x 10 x 10 x 10 x 10 x 10

Figure 4.15: Problem 32: from right to left: approximation of windowed signal, line spectra of sinusoid,
windowed sum of sinusoids and line spectra.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.43

4.33 (a) The signal x(t) is zero-mean. The Fourier series coefficients are obtained from (Ω0 = 2π/T0 = 2π)
2 0.25s sin(πk/2)
X1 (s) = (e − e−0.25s )|s=j2kπ =
s πk/2
so that

X sin(πk/2) j2kπt
x(t) = e
πk/2
k=−∞,6=0
X∞
sin(πk/2)
= 2 cos(2πkt)
πk/2
k=1

Since x(0) = 1, letting t = 0 in both sides and then multiplying by π we get that

X sin(πk/2)
π=4
k
k=1

If we let
N
X sin(πk/2)
πN = 4 = 0.95π
k
k=1
we use MATLAB to find the value of N .

% Problem 4_33
clear all; clc
N=100; x = 0; %DC value
for k=1:N
x = x + 4*sin(k*pi/2)/k;
xx(k) =x;
end
format long
display(’Error of approximation for’)
N
e = pi-x
ppi=pi*ones(1,length(xx)); n=1:N;
figure(1)
subplot(211); plot(n,xx); title(’Approximation of PI’); axis([1 N 0 4.5])
hold on; plot(n,ppi,’r’); grid; hold off; legend(’approximate’, ’pi’)
subplot(212); plot(n,xx-pi); title(’Error of approximation’); grid
% N for 95 percent of pi
sum = 0; %initial approximation
for i = 1:N,
sum = sum + 4*cos(i*pi/2-pi/2)/i;
if (sum >=(0.95*pi))&&(sum<=pi) break;
end
end
display([num2str(i) ’ coeficients needed of Fourier series for 95% approx. of PI ’])

Error of approximation for


N = 100
e = 0.019998000998784
15 coeficients needed of Fourier series for 95\% approx. of PI

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.44

Approximation of PI

2 approximate
pi
1

0
10 20 30 40 50 60 70 80 90 100
n
Error of approximation
1

0.5

−0.5
0 10 20 30 40 50 60 70 80 90 100
n

Figure 4.16: Problem 33: Approximation of π by series, error of approximation

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.45

4.34 (a) Assuming x(t) and x̂(t) being real and even, so that X̂k are real we have
Z Z
ε = (x(t) − x̂(t))2 dt = x2 (t) − 2x(t)x̂(t) + x̂2 (t)dt
T0 T0
Z Z X Z XX
= x2 (t)dt − 2 x(t) X̂k φk (t)dt + X̂k X̂`∗ φk (t)φ∗` (t)
T0 T0 k T0 k `
Z XZ XX Z
= 2
x (t)dt − 2 x(t)X̂k φk (t)dt + X̂k X̂` φk (t)φ∗` (t)
T0 k T0 k ` T0

To minimize the error we set its derivative w.r.t. X̂n to zero, i.e.,
Z Z
dε 1
= −2 x(t)φn (t)dt + 2T0 X̂n = 0 so that X̂n = x(t)φn (t)dt
dX̂n T0 T0 T0

% Problem 4_34
clear all; clc
% c)d)--------------------------------------------------------
% Fourier Series of a train of pulses of period T0=1 and dc value 1
w0 = 2*pi; T0 = 1; DC=1; N=100;
for k=1:N,
a(k)=sin(k*pi/2)/(k*pi/2);
end
a=[DC 2*a];

Ts = 0.001; %sample period


t=0:Ts:1-Ts; L=length(t); %number of samples

x1=[ones(1,L/4) zeros(1,L/2) ones(1,L/4)]; %train signal


x1=2*DC*x1; %DC gain adaptation
for N1=2:N+1,
x=a(1)*ones(1,length(t));
for k=2:N1,
x=x+a(k)*cos(2*pi*(k-1).*t);
end
%plot figures
figure(1)
plot(t,x); axis([0 max(t) 1.1*min(x) 1.1*max(x)]); hold on
plot(t,x1,’r’); ylabel(’x(t), x_a(t)’); xlabel(’t (sec)’); hold off

figure(3)
plot(t,x); axis([0.175 0.275 1.75 2.25]); hold on
plot(t,x1,’r’); title(’Gibbs Phenomenon’);
ylabel(’x(t), x_a(t)’); xlabel(’t (sec)’);
pause(0.05)

%compute error
e=(x1-x).ˆ2;
error(N1-1)=0;
for k = 1:length(e)
error(N1-1) = error(N1-1) + e(k);
end

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.46

clear x
end

figure(2)
axis([1 N 0 1.1*max(error)]); hold on
plot(error,’linewidth’,2);
title(’e = int((x-x1)ˆ2)’); ylabel(’Amplitude of error’); xlabel(’t (samples)’)
hold off
e = int((x−x1)2)

200

180
2

160

1.5 140

Amplitude of error
120
x(t), xa(t)

100
1

80

60
0.5

40

20
0

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10 20 30 40 50 60 70 80 90 100
t (sec) t (samples)

Gibbs Phenomenon
2.25

2.2

2.15

2.1

2.05
x(t), xa(t)

1.95

1.9

1.85

1.8

1.75
0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27
t (sec)

Figure 4.17: Problem 34: Gibb’s phenomenon: (top–left) square pulse and approximate, (bottom) detail of
approximation around the discontinuity; (top-right) approximation error.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.47

4.35 (a) Letting the positive pulses be represented by 1 and the negative ones by −1 the following sequences
represent each of the Walsh functions (the number in parenthesis at the beginning indicates the order of
the function or the number of zero crossings
 
(0) 1 1 1 1 1 1 1 1
 (1) 1 1 1 1 −1 −1 −1 −1 
 
 (2) 1 1 −1 −1 −1 −1 1 1 
 
 (3) 1 1 −1 −1 1 1 −1 −1 
 
 (4) 1 −1 −1 1 1 −1 −1 1 
(5) 1 −1 1 −1 1 −1 1 −1

(b) As indicated the sequences corresponding to the functions φ0 (t), φ1 (t), φ3 (t) and φ5 (t) are symmet-
ric, while the others can be obtained by circular shifts. If we shift circularly φ1 (t) by 2 we get φ2 (t) and
circularly shifting φ3 (t) by 1 we obtain φ4 (t). In MATLAB these shifts are obtained using wshift.
(c) Writing the approximation of x(t), computed at nTs = n/8,
7
X
x(nTs ) = ak φk (nTs ), n = 0, 1, · · · , 7
k=0

in a matrix form
x = ΦT a
where x is a column vector with entries the values {x(nTs )}, the column vector a consists of the co-
efficients of the approximation, and Φ is the matrix generated by the sequences corresponding to the
Walsh functions. Using the orthonormality of the Walsh functions pre-multiplying by Φ we get the
approximation coefficients
Φx = ΦΦT a = Ia
where I is the unit matrix. So we have
a = Φx
After finding the coefficient vector we use the equation above to obtain the approximation x̂(t).

% Pr 4_35
%% walsh functions
N=8; M=N-2;
W=ones(1,N);
xx=ones(1,N/2); yy=-xx;
x=[xx yy];
W=[W;x]
zz=wshift(’1d’,x,2)
W=[W;zz];
x=[0]
for n=2,
xx=ones(1,N/(2ˆn));yy=-xx;
for i=1:2ˆ(n-1),
x=[x xx yy]
end
M=length(x);x=x(2:M);
W=[W;x]
zz=wshift(’1d’,x,1)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.48

W=[W;zz]
end
xx=ones(1,1);yy=-xx;
x=[xx yy]
for i=1:3,
x=[x xx yy]
end
W=[W; x]
t=0:(0.5/8):0.5-0.5/8;
x1=t;
a=W*x1’
y=a’*W/8

figure(1)
W1=[W ones(6,1)];
n=0:8
subplot(611)
stairs(n,W1(1,:)); axis([0 8 -1.5 1.5])
title(’Walsh functions (0--6)’)
subplot(612)
stairs(n,W1(2,:)); axis([0 8 -1.5 1.5])
subplot(613)
stairs(n,W1(3,:)); axis([0 8 -1.5 1.5])
subplot(614)
stairs(n,W1(4,:)); axis([0 8 -1.5 1.5])
subplot(615)
stairs(n,W1(5,:)); axis([0 8 -1.5 1.5])
subplot(616)
stairs(n,W1(6,:)); axis([0 8 -1.5 1.5])

figure(2)
plot(x1)
hold on
stairs(y,’r’); legend(’x1(t)’,’y(t’)
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.49

Walsh functions (0−−6)


1
0
−1
0 1 2 3 4 5 6 7 8

1
0
−1
0 1 2 3 4 5 6 7 8

1
0
−1
0 1 2 3 4 5 6 7 8

1
0
−1
0 1 2 3 4 5 6 7 8

1
0
−1
0 1 2 3 4 5 6 7 8

1
0
−1
0 1 2 3 4 5 6 7 8

0.45
x1(t)
0.4 y(t

0.35

0.3

0.25

0.2

0.15

0.1

0.05

0
1 2 3 4 5 6 7 8
t

Figure 4.18: Problem 35: Walsh functions (top), approximation of step signal using Walsh functions.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 4.50

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 5

Frequency Analysis: the Fourier


Transform

5.1 Basic Problems


5.1 (a) The Laplace transforms are
1
x1 (t) = e−2t u(t) ⇔ X1 (s) = σ > −2
s+2
1
x2 (t) = r(t) ⇔ X2 (s) = σ>0
s2
1
x3 (t) = te−2t u(t) ⇔ X3 (s) = σ > −2
(s + 2)2

(b) The Laplace transforms of x1 (t) and of x3 (t) have regions of convergence containing the jΩ-axis,
and so we can find their Fourier transforms from their Laplace transforms by letting s = jΩ
(c) The Fourier transforms of x1 (t) and x3 (t) are
1
X1 (Ω) =
2 + jΩ
1
X3 (Ω) =
(2 + jΩ)2

1
Chaparro — Signals and Systems using MATLAB 5.2

5.2 (a) In this case we are using the duality of the Fourier transforms so that the Fourier transform of the sinc
is a pulse of magnitude A and cut-off frequency Ω0 which we will need to determine.
The inverse Fourier transform is
Z ∞
1
x(t) = A[u(Ω + Ω0 ) − u(Ω − Ω0 )]ejΩt dΩ
2π −∞
Z Ω0
A
= ejΩt dΩ
2π −Ω0
A
= sin Ω0 t
πt
so that A = π and Ω0 = 1, i.e.,

sin(t)
⇔ π[u(Ω + 1) − u(Ω − 1)]
t
(b) The Fourier transform of x1 (t) = u(t + 0.5) − u(t − 0.5) is
 
1 0.5s −0.5s sin(0.5Ω)
X1 (Ω) = [e −e ] =
s s=jΩ 0.5Ω

Using the duality property we have:

sin(Ω/2)
x1 (t) = u(t + 0.5) − u(t − 0.5) ⇔ X1 (Ω) =
Ω/2
sin(t/2)
X1 (t) = ⇔ 2π[u(Ω + 0.5) − u(Ω − 0.5)]
t/2

using the fact that x1 (t) is even. Then using the scaling property

sin(t) 2π
X1 (2t) = ⇔ [u((Ω/2) + 0.5) − u((Ω/2) − 0.5)]
t 2
⇔ π[u(Ω + 1) − u(Ω − 1)]

so x(t) = X1 (2t) = sin(t)/t is the inverse Fourier transform of X(Ω) = π[u(Ω + 1) − u(Ω − 1)]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.3

5.3 (a) The signal x(t) is even while y(t) is odd.


(b) The Fourier transform of x(t) is
Z ∞
X(Ω) = e−|t| e−jΩt dt
−∞
Z ∞ Z ∞
= e−|t| cos(Ωt)dt − j e−|t| sin(Ωt)dt
−∞ −∞
Z ∞
−|t|
= 2 e cos(Ωt)dt
0

this is because the imaginary part is the integral of an odd function which is zero. Since cos(.) is an even
function
X(−Ω) = X(Ω)

The Fourier transform X(Ω) is


Z ∞
ejΩt + e−jΩt
X(Ω) = 2 e−t dt
0 2
Z ∞ Z ∞
= e−(1−jΩ)t dt + e−(1+jΩ)t dt
0 0
1 1 2
= + =
1 − jΩ 1 + jΩ 1 + Ω2

which is real-valued.
(c) For y(t), odd function, its Fourier transform is
Z ∞
Y (Ω) = y(t)e−jΩt dt
−∞
Z ∞
= −j y(t) sin(Ωt)dt
−∞

because y(t) cos(Ωt) is an odd function and its integral is zero. The Y (Ω) is odd since
Z ∞
Y (−Ω) = −j y(t) sin(−Ωt)dt
−∞
= −Y (Ω)

since the sine is odd.


(d) Let’s use the Laplace transform to find the Fourier transform of y(t):

1 1
Y (s) = −
s + 1 −s + 1
with a region of convergence −1 < σ < 1, which contains the jΩ-axis. So

1 1 −2jΩ
Y (Ω) = Y (s) |s=jΩ = − =
jΩ + 1 −jΩ + 1 1 + Ω2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.4

which as expected is purely imaginary.


Check: Let z(t) = x(t) + y(t) = 2e−t u(t) which has a Fourier transform

2 2(1 − jΩ)
Z(Ω) = = = X(Ω) + Y (Ω)
1 + jΩ 1 + Ω2

(f) If a signal is represented as x(t) = xe (t) + xo (t) then

X(Ω) = Xe (Ω) + Xo (Ω)

where the first is a cosine transform and the second a sine transform.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.5

5.4 (a) The Fourier pair is


Z ∞ Z ∞
1
x(t) = X(Ω)ejΩt dΩ ⇔ X(Ω) = x(t)e−jΩt dt
2π −∞ −∞

For Ω = 0 the Fourier transform gives


Z ∞
x(t)dt = X(0) = 2
−∞

(b) From the inverse Fourier transform


Z ∞ Z ∞
1 2 2
x(0) = X(Ω)dΩ = dΩ
2π −∞ 2π 0 1 + Ω2
2 2
= tan−1 (Ω)|∞
0 = (π/2) = 1
π π

(c) Ω = s/j
2 −2 1 1
X(s) = = = + then
1 + (s/j)2 (s − 1)(s + 1) 1−s s+1
x(t) = et u(−t) + e−t u(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.6

5.5 (a) x1 (t) = −x(t + 1) + x(t − 1), time–shift property

X1 (Ω) = X(Ω)(−ejΩ + e−jΩ ) = −2jX(Ω) sin(Ω)

(b) x2 (t) = 2 sin(t)/t by duality

X2 (Ω) = 2π[u(−Ω + 1) − u(−Ω − 1)] = 2π[u(Ω + 1) − u(Ω − 1)]

by symmetry of x(t).
(c) Compression

x3 (t) = 2x(2t) = 2[u(2t + 1) − u(2t − 1)] = 2[u(t + 0.5) − u(t − 0.5)]

X(Ω/2)
X3 (Ω) = 2 = X(Ω/2)
2
(d) Modulation: x4 (t) = cos(0.5πt)x(t) so

X4 (Ω) = 0.5[X(Ω + 0.5π) + X(Ω − 0.5π)]

(e) x5 (t) = X(t) so that by duality

X5 (Ω) = 2πx(−Ω) = 2π[u(−Ω + 1) − u(−Ω − 1)] = 2πx(Ω)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.7

5.6 (a) x(t) = cos(t)[u(t) − u(t − 1)] = cos(t)p(t), so

X(Ω) = 0.5[P (Ω + 1) + P (Ω − 1)]

where

e−s/2 (es/2 − e−s/2 ) sin(Ω/2)


P (Ω) = |s=jΩ = 2e−jΩ/2
s Ω

(b) y(t) = x(2t) = cos(2t)p(2t) = cos(2t)[u(t) − u(t − 0.5)], so

Y (Ω) = 0.5[P1 (Ω + 2) + P1 (Ω − 2)]

where
sin(Ω/4)
P1 (Ω) = F[u(t) − u(t − 0.5)] = 2e−jΩ/4

z(t) = x(t/2) = cos(t/2)p(t/2) = cos(t/2)[u(t) − u(t − 2)] = cos(t/2)p2 (t) so

Z(Ω) = 0.5[P2 (Ω + 0.5) + P2 (Ω − 0.5)]

sin(Ω)
P2 (Ω) = F[u(t) − u(t − 2)] = 2e−jΩ

Using

P1 (Ω) = 0.5P (Ω/2)


P2 (Ω) = 2P (2Ω)

we have

X(Ω) = 0.5[P (Ω + 1) + P (Ω − 1)]


Y (Ω) = 0.5[0.5P ((Ω/2) + 1) + 0.5P ((Ω/2) − 1)] = 0.5X(Ω/2)
Z(Ω) = 0.5[2P (2Ω + 1) + 2P (2Ω − 1)] = 2X(2Ω)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.8

5.7 F[δ(t − τ )] = L[δ(t − τ )]s=jΩ = e−jΩτ so

(a) By linearity and time–shift

F[δ(t − 1) + δ(t + 1)] = 2 cos(Ω)

(b) By duality

0.5[δ(t − τ ) + δ(t + τ )] ↔ cos(Ωτ )


cos(Ω0 t) ↔ π[δ(Ω + Ω0 ) + δ(Ω − Ω0 )]

by letting τ = Ω0 in the second equation.


(c) Considering
F[δ(t − 1) − δ(t + 1)] = 2j sin(Ω),

by duality

−0.5j[δ(t − τ ) + δ(t + τ )] ↔ sin(Ωτ )


sin(Ω0 t) ↔ − jπ[δ(Ω + Ω0 ) + δ(Ω + Ω0 )]

by letting τ = Ω0 in the second equation.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.9

5.8 (a)(b) We have

x(t) = r(t) − 2r(t − 1) + r(t − 2)


dx(t)
= u(t) − 2u(t − 1) + u(t − 2)
dt
d2 x(t)
= δ(t) − 2δ(t − 1) + δ(t − 2) = y(t)
dt2
and from the last equation and the derivative property

(jΩ)2 X(Ω) = 1 − 2e−jΩ + e−j2Ω

so that
2e−jΩ [1 − cos(Ω)]
X(Ω) =
Ω2
 2
sin(Ω/2)
= e−jΩ
Ω/2

(c) The Laplace transform

1 e−s
X(s) = 2
(1 − 2e−s + e−2s ) = 2 (es − 2 + e−s )
s s
with region of convergence the whole s-plane. So

X(Ω) = X(s) |s=jΩ

which coincides with the above result.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.10

5.9 (a)

X
X(Ω) = F[1] + F[0.5k cos(kΩ0 t)] modulation property
k=1

X 1
= 2πδ(Ω) + (2π 0.5k ) [δ(Ω + kΩ0 ) + δ(Ω − kΩ0 )]
2
k=1
X∞
= 2πδ(Ω) + 0.5k π [δ(Ω + kΩ0 ) + δ(Ω − kΩ0 )]
k=1

(b)

F[e−a|t| ] = F[e−at u(t)] + F[eat u(−t)]


1 1 2a
= + = 2
jΩ + a a − jΩ a + Ω2
using duality
2a
e−a|t| ↔
a2 + Ω2
2a
↔ 2πe−a|Ω|
a2 + t2
so
π −a|Ω|
X1 (Ω) = e .
a

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.11

5.10 (a) i. Fourier transform of


0.5 0.5 −jΩ
F[x(t)] = − = 2
jΩ + a a − jΩ a + Ω2
If we let a = 0 then
1
Y (Ω) =
jΩ
ii. Fourier transform of unit step signal
1
F[u(t)] = F[0.5] + Y (Ω) = 2π × 0.5δ(Ω) + Y (Ω) = πδ(Ω) +
jΩ

(b) A = Au(t) + Au(−t) (assume u(0) = 0.5)

L[Au(t)] = A/s ROC: σ > 0


L[Au(= t)] = −A/s ROC: σ < 0

The region of convergence 0 < σ < 0 is empty so the Laplace transform does not exist and the
Fourier transform cannot be obtained this way.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.12

5.11 (a) y(t) = m(t) cos(10t) has a spectrum

Y (Ω) = 0.5[M (Ω + 10) + M (Ω − 10)]

where when m(t) = cos(t) then

M (Ω) = π[δ(Ω − 1) + δ(Ω + 1)]

and when m(t) = r(t) − 2r(t − 1) + r(t − 2)

e−jΩ jΩ −jΩ 2e−jΩ


M (Ω) = (e − 2 + e ) = (1 − cos(Ω))
(jΩ)2 Ω2

(b) Using Parseval’s power relation: if x(t) = sin(0.5t)/(πt) then X(Ω) = u(Ω + 0.5) − u(Ω − 0.5)
so in the frequency
Z ∞ Z 0.5
1 1 1
Px = |X(Ω)|2 dΩ = dΩ =
2π −∞ 2π −0.5 2π

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.13

5.12 (a) A period of z(t) is z1 (t) = d2 x1 (t)/dt2 = δ(t) − 2δ(t − 1) + δ(t − 2), with period T0 = 2
(Ω0 = π), its Fourier series coefficients are
1 1
Zk = Z1 (s)|s=jπk = 2e−s (cosh(s) − 1)|s=jπk
2 2 (
k+1 k 2 k odd
= (−1) (1 − (−1) ) =
0 k even

then

X ∞
X
z(t) = 2ejkπt = 2ej(2m+1)πt
k=−∞,odd m=−∞

by letting k = 2m + 1. By the derivative property


Zk −2
Xk = 2
= 2 2 , k odd
(jkΩ0 ) k Ω0

and

X ∞
X
2(−1)k jkπt 2(−1)2m+1 j(2m+1)πt
x(t) = e = e
k 2 Ω20 m=−∞
(2m + 1)2 Ω20
k=−∞,odd

(b) The average X0 = 0.5, and x(t) − 0.5 is even so Xk , k 6= 0 are real and
z(t) is even and zero mean, so Zk are real and Z0 = 0
(c) The Fourier transform is
∞ ∞
2π X X Z1 (Ω0 )
Z(Ω) = Z1 (Ω) δ(Ω − kΩ0 ) = 2π δ(Ω − kΩ0 )
T0 T0
k=−∞ k=−∞

X
= 2πZk δ(Ω − kΩ0 )
k=−∞

and the inverse


X X
z(t) = F −1 [2πZk δ(Ω − kΩ0 )] = Zk ejkΩ0
k k

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.14

5.13 (a) y(t) = d(s(t))/dt = 2δ(t), and so

Y (Ω) 2
S(Ω) = =
jΩ jΩ

(b) The phase of S(Ω) is −π/2 for Ω > 0, zero at Ω = 0 and by odd symmetry π/2 for Ω < 0. The
magnitude is |S(Ω)| = 2/|Ω|. See Fig. 5.1.

s(t)

1
t

−1

|S(Ω)|


∠S(Ω)

π/2

−π/2

Figure 5.1: Problem 13

(c) s(t) = 2[u(t) − 0.5] gives


 
2 2
S(Ω) = + 2πδ(Ω) − 2πδ(Ω) =
jΩ jΩ

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.15

5.14 (a) Let X(Ω) = A[u(Ω + Ω0 ) − u(Ω − Ω0 )] its inverse Fourier transform is
Z Ω0
1 A sin(Ω0 t)
x(t) = AejΩt dΩ =
2π −Ω0 πt

so A = 1, Ω0 = 0.5 and X(Ω) = u(Ω + 0.5) − u(Ω − 0.5).


(b) Y (Ω) = H(Ω)X(Ω) = X(Ω) so that y(t) = (x ∗ x)(t) = x(t), or convolution of a sinc function
with itself is a sinc.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.16

5.15 (a) i. Modulation property

X(Ω) = P (Ω) + 0.5P (Ω − π) + 0.5P (Ω + π)


2 sin(Ω)
P (Ω) =

ii. We have

g(t) = x(t − 1) = p(t − 1) + p(t − 1) cos(π(t − 1)) = p(t − 1) − p(t − 1) cos(πt)

where

p(t − 1) cos(πt) = cos(πt)u(t) − cos(πt)u(t − 2)


= cos(πt)u(t) − cos(π(t − 2))u(t − 2)

so that p(t − 1) cos(πt) is a sum of causal sinusoids, thus


s
G(s) = e−s P (s) − (1 − e−2s )
s2 + π 2
and since G(s) = X(s)e−s then
s
X(s) = P (s) − (es − e−s )
s2 + π 2
2Ω sin(Ω)
X(Ω) = P (Ω) + 2
π − Ω2
We get the same expression for X(Ω) by using the modulation property:

sin(Ω − π) sin(Ω + π)
0.5P (Ω − π) + 0.5P (Ω + π) = +
Ω−π Ω+π
− sin(Ω) − sin(Ω) 2Ω sin(Ω)
= + = 2 .
Ω−π Ω+π π − Ω2

(b) i. The condition is that the jΩ-axis be included in the region of convergence of the Laplace
transform. That is the case when the signal has finite time support, like in here.
ii. z(t) = cos(t)q(t) where q(t) = u(t) − u(t − π/2) so that

Z(Ω) = 0.5[Q(Ω + 1) + Q(Ω − 1)]

where
2e−jπΩ/4 sin(πΩ/4)
Q(Ω) =

which when replaced above does not give the expression given in the problem.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.17

5.16 (a) The raised cosine is an even smooth signal with a value of 2 at the origin.
(b) The FT of the pulse p(t) = u(t + 1) − u(t − 1) is
1 s
P (Ω) = [e − e−s ] |s=jΩ
s
sin(Ω)
= 2

(c) The FT of
x(t) = (1 + cos(2πt))p(t) = p(t) + p(t) cos(2πt)

is
1
X(Ω) = P (Ω) + [P (Ω − 2π) + P (Ω + 2π)]
2

1.5
x(t)

0.5

0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t

Figure 5.2: Problem 16: Raised cosine x(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.18

5.17 (a) Impulse response


Z 2 Z 2 Z 0
1 j∠H(jΩ) jΩt 1 j(Ωt−π/2) 1
h(t) = 1e e dΩ = e dΩ + ej(Ωt+π/2) dΩ
2π −2 2π 0 2π −2
−j j2t j 1 − cos(2t)
= (e − 1) − (e−j2t − 1) =
2πjt 2πjt πt

(b) The frequency components of x(t) with harmonic frequencies bigger than 2 are filtered out so

yss (t) = 2|H(j1.5)| cos(1.5t + ∠H(j1.5)) = 2 cos(1.5t − π/2) = 2 sin(1.5t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.19

5.18 (a) Plot of X(Ω) as function of Ω:

X(Ω)


−π π

Figure 5.3: Problem 18

(b)
Z π Z π
1 |Ω| 2 Ω 1
x(0) = dΩ = dΩ =
2π −π π 2π 0 π 2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.20

5.19 (a) Poles are roots of D(s) = s2 + 2s + 2 = (s + 1)2 + 1 = 0 or

s1,2 = −1 ± j1

the zero is s = 0. It is a band-pass filter with center frequency around 1. Its magnitude response is
using vectors from the zero and the poles to the point in the jΩ–axis where are finding the frequency
response:
Ω |H(jΩ)|
0 0 (zero at zero)
√ √
1 5(1)/[(1)( 4 + 1)] = 1
∞ 0 (vectors of two poles and zero have infinite lengths)

(b) Impulse response


√ √
5(s + 1) 5
H(s) = −
(s + 1)2 + 1 (s + 1)2 + 1
√ −t √ √
h(t) = 5e (cos(t) − sin(t)) u(t) = 5e−t 2 cos(t + π/4)u(t)
√ −t
= 10e cos(t + π/4)u(t)

(c) The steady state response corresponding to x(t) = B + cos(Ωt) is

y(t) = B|H(j0)| + |H(jΩ0 )| cos(Ω0 + ∠H(jΩ0 ))


= |H(jΩ0 )| cos(Ω0 + ∠H(jΩ0 ))

for Ω0 to be determined by looking at frequencies for which



5Ω0
|H(jΩ0 )| = p =1 or
(2 − Ω20 )2 + 4Ω20
5Ω20 = 4 − 4Ω20 + Ω40 + 4Ω20 ⇒ Ω40 − 5Ω20 + 4 = (Ω20 − 4)((Ω20 − 1) = 0

giving values of
Ω0 = ±2, ± 1

so we have that when Ω = 1 or 2 the dc bias is filtered out and the cosine has a magnitude of 1.
The corresponding phases are using the pole and zero vectors

Ω0 = 1 ⇒ ∠H(jΩ0 ) = π/2 − 0 − tan−1 (2)


Ω0 = 2 ⇒ ∠H(jΩ0 ) = π/2 − tan−1 (1) − tan−1 (3)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.21

5.20 (a) Filter corresponding to H1 (jΩ) calculates the derivative of the input, while the filter with frequency
response H2 (jΩ) delays the input by one unit of time.
(b) X(Ω) = 0.5[P (Ω + π/2) + P (Ω − π/2)] then

Y (Ω) = X(Ω)H1 (jΩ)H2 (jΩ) = jΩX(Ω)e−jΩ

Call y1 (t) the output of the differentiator and y(t) the output of the delay

dx(t) d cos(πt/2) dp(t)


y1 (t) = = p(t) + cos(πt/2)
dt dt dt
π
= − sin(πt/2)p(t) + cos(−π/2)δ(t + 1) − cos(π/2)δ(t − 1)
2
π
= − sin(πt/2)p(t)
2
then
π π
y(t) = y1 (t − 1) = − sin(π(t − 1)/2)p(t − 1) = cos(πt/2)[u(t) − u(t − 2)]
2 2

(c) Since filters are LTI if we reverse the delay and the differentiator we get the same result as before.
Indeed, call z1 (t) the output of the delay and z(t) the output of the differentiator

z1 (t) = x(t − 1) = p(t − 1) cos(π(t − 1)/2)


[u(t) − u(t − 2)] sin(πt/2)
=
dz1 (t) π
z(t) = = [δ(t) − δ(t − 2)] sin(πt/2) + [u(t) − u(t − 2)] cos(πt/2)
dt 2
π
= 0 + cos(πt/2)[u(t) − u(t − 2)].
2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.22

5.21 (a) We have

x(t) = j(ejπt/4 − e−jπt/4 ) + 2(ej5πt/4 + e−j5πt/4 )


= −2 sin(πt/4) + 4 cos(5πt/4)

The steady state response of the output is

y(t) = 4|H(j5π/4)| cos(5πt/4 + ∠H(j5π/4)


= 4 cos(5πt/4 − 5π/4)

because the frequency component at π/4 is filtered out.


(b) The Fourier transforms are

X(Ω) = 2π [X1 δ(Ω − π/4) + X−1 δ(Ω + π/4) + X5 δ(Ω − 5π/4) + X−5 δ(Ω + 5π/4)]
= 2π [jδ(Ω − π/4) − jδ(Ω + π/4) + 2δ(Ω − 5π/4) + 2δ(Ω + 5π/4)]
Y (Ω) = 4πe−j5π/4 δ(Ω − 5π/4) + 4πej5π/4 δ(Ω + 5π/4)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.23

5.22 (a) According to the eigenvalue property for x(t) = ejΩt , −∞ < Ω < ∞, the output in the steady-state
would be y(t) = ejΩt H(jΩ) so that the differential equation gives

jΩejΩt H(jΩ) = −ejΩt H(jΩ) + ejΩt


1
giving H(jΩ) =
1 + jΩ
1
|H(jΩ)| = √ , ∠H(jΩ) = − tan−1 (Ω)
1 + Ω2

|Y (Ω)|
1

0.707


−1 1

Figure 5.4: Problem 22

(b) The magnitude response indicates the filter is a low-pass filter, in particular

Ω |H(jΩ)| ∠H(jΩ)
0 1 0
1 √1 −π/4
2
∞ 0 −π/2

(c) The Fourier transform of x(t) is X(Ω) = u(Ω + 1) − u(Ω − 1) so that the Fourier transform of the
output is
Y (Ω) = X(Ω)H(jΩ)

with magnitude response as in Fig. 5.4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.24

5.23 (a) The signals

x1 (t) = x(t + 1) − x(t − 1) → X1 (Ω) = X(Ω)(ejΩ − e−jΩ )


x2 (t) = x(t + 1) + x(t) + x(t − 1) → X2 (Ω) = X(Ω)(1 + e−jΩ + ejΩ )

(b) X3 (Ω) = 0.5X(Ω − π) + 0.5X(Ω + π)


(c) Since Z 1
Y (Ω) = X(Ω)e−jΩ → Y (0) = X(0) = x(t)dt = 1.
−1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.25

5.24 (a) The FT of x(t) is


X(Ω) = e−jΩ + ejΩ = 2 cos(Ω)

(b) The derivative of X(Ω) is


dX(Ω)
Y (Ω) = = −2 sin(Ω)
dΩ
and according to the FT definition
Z ∞
dX(Ω) de−jΩt
Y (Ω) = = x(t) dt
dΩ −∞ dΩ
Z∞
= x(t)(−jt)e−jΩt dt
−∞

so that
y(t) = x(t)(−jt) = −jtδ(t − 1) − jtδ(t + 1) = −jδ(t − 1) + jδ(t + 1)

which gives

Y (Ω) = −je−jΩ + jejΩ = e−j(Ω+π/2) + ej(Ω+π/2) = 2 cos(Ω + π/2) = −2 sin(Ω)

verifying that multiplication by −jt in the time domain corresponds to computing the derivative in the
Ω-domain.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.26

5.25 (a) (b) The Fourier series coefficients of δTs (t) are
1 1
∆k = L[δ(t)]|s=jkΩs =
Ts Ts
so that

X 1 jkΩs t 2π
δTs (t) = e Ωs =
Ts Ts
k=−∞

The FT of δTs (t) is then


1 X
∆(Ω) = F[δTs (t)] = F[1ejkΩs t ]
Ts
k
2π X
= δ(Ω − kΩs )
Ts
k

(c) Both δTs (t) and ∆Ts (Ω) are periodic, the first of period Ts and the second of period 2π/Ts .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.27

5.26 (a) The FT of the equation characterizing the averager is

jΩY (Ω) = 0.5[X(Ω) − X(Ω)e−j2Ω ]

so that
sin(Ω)e−jΩ
Y (Ω) = X(Ω)

where the FT of x(t) is

e−jΩ sin2 (Ω/2) −jΩ


X(Ω) = [2(cos(Ω) − 1)] = −4 e
jΩ jΩ

(b) Calling Z(Ω) = X(Ω)/(jΩ) we have that y(t) = 0.5z(t) − 0.5z(t − 2) and
 2
X(Ω) sin(Ω/2)
Z(Ω) = = e−jΩ
jΩ Ω/2

so that z(t) is the integral of x(t) = u(t) − 2u(t − 1) + u(t − 2), or z(t) = r(t) − 2r(t − 1) + r(t − 2),
replacing it in the above expression for y(t) we get

y(t) = 0.5r(t) − r(t − 1) + 0.5r(t − 2) − 0.5r(t − 2) + r(t − 3) − 0.5r(t − 4)


= 0.5r(t) − r(t − 1) + r(t − 3) − 0.5r(t − 4)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.28

5.27 (a) The Fourier series coefficients of the half-wave rectified signal are
1
Xk = X1 (s)|s=jπk
2
where
π(1 + e−s )
X1 (s) = L[sin(πt)u(t) + sin(π(t − 1))u(t − 1)] =
s2 + π 2
giving
cos(πk/2)e−jπk/2
Xk =
π(1 − k 2 )
so that the magnitude of the first three coefficients are
1
X0 =
π
cos(πk/2) −(π/2) sin(πk/2) 1
|X1 | = |k=1 = |k=1 =
π(1 − k 2 ) −2kπ 4
1
|X2 | =

where to find |X1 | we need to apply the L’Hoppital’s rule because when replacing k = 1 we have a 0/0
situation.
(b) The low-pass filter would have a magnitude of π and cut-off frequency

0 < Ωc < π

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.29

5.28 (a) The spectrum of x(t) is

X(Ω) = 4π[δ(Ω − 1000) + δ(Ω + 1000)]

the spectrum of y(t) is


Y (Ω) = 0.5[X(Ω − 10000) + X(Ω + 10000)]

This corresponds to the FT of the transmitted signal y(t). If the magnitude of the bandpass filter H(jΩ)
is 10, its center frequency is 10000 and a bandwith slightly larger than 2000, its output is 10y(t), the
received signals.
(b) By multiplying 10y(t) by cos(10000t) the spectrum of the output of the demodulator z(t) is

Z(Ω) = 5[Y (Ω − 10000) + Y (Ω + 10000)]


= 2.5[X(Ω − 20000) + X(Ω)] + 2.5[X(Ω) + X(Ω + 20000)]
= 5X(Ω) + 2.5[X(Ω − 20000) + X(Ω + 20000)]

which has a lowpass component 5X(Ω). Passing z(t) through a low-pass filter G(Ω) of magnitude
1/5 and cutoff frequency any value slightly bigger than 1000 its output is X(Ω) which is the Fourier
transform of the message x(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.30

5.2 Problems using MATLAB

5.29 (a) The Fourier series average is


Z T0 /2 Z 0.5
1 1 1
X0 = x(t)dt = dt =
T0 −T0 /2 T0 −0.5 T0

for any value of T0 . So for


1
T0 = 2 X01 =
2
1
T0 = 4 X02 =
4
1
T0 = 8 X03 =
8
1
T0 = 16 X04 =
16
so X0i decreases as T0 increases.
(b) The period
x1 (t) = u(t + 0.5) − u(t − 0.5)

with Laplace transform


1 0.5s
X1 (s) = [e − e−0.5s ]
s
is the same for all values of T0 . The Fourier coefficients
1 1 sin(πk/T0 )
Xk = X1 (s) s=j2πk/T0 =
T0 T0 kπ/T0

1 sin(kπ/2)
T0 = 2 Xk1 =
2 kπ/2
1 sin(kπ/4)
T0 = 4 Xk1 =
4 kπ/4
1 sin(kπ/8)
T0 = 8 Xk1 =
8 kπ/8
1 sin(kπ/16)
T0 = 16 Xk1 =
16 kπ/16

harmonics are getting smaller and the line spectrum denser (Ω0 = 2π/T0 decreases as T0 increases).
(c) If T0 → ∞ the spectrum will disappear but it becomes very dense. We need to multiply Xk by T0 to
avoid the decreasing of the spectrum.
(d) The following script simulates the conversion of the Fourier series into the Fourier transform.

% Pr. 5_29
clear all;clf
Ts=0.001;t=-0.5:Ts:0.5;Nx=length(t);

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.31

figure(1)
for i=1:4,
T0=2ˆi;
x=[ones(1,Nx) zeros(1,(T0-1)*Nx) ones(1,Nx) zeros(1,(T0-1)*Nx) ones(1,Nx)];
NN=length(x);
tt=[-NN/2:(NN-1)/2]*Ts;
Omega=0:pi/T0:20;
N=length(Omega);
X1=sin(Omega)./Omega;
X1(1)=1;X2=fliplr(X1);
X=[X2 X1];
O=[-fliplr(Omega) Omega];

subplot(211)
plot(tt,x)
axis([min(tt) max(tt) 0 1.2])
grid;xlabel(’t (sec)’);ylabel(’x(t)’)
subplot(212)
stem(O,X)
axis([min(O) max(O) -0.5 1.2]);grid;xlabel(’\Omega_0’);ylabel(’X_{k T_0}’)
hold on
pause(1)
end
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.32

0.8

x(t)
0.6

0.4

0.2

0
−15 −10 −5 0 5 10 15
t (sec)

0.5
0
Xk T

−0.5
−15 −10 −5 0 5 10 15
Ω0

Figure 5.5: Problem 29: Pulses and normalized line spectrum approximating Fourier transform of single
pulse at origin.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.33

5.30 (a)(b) x1 (t) is an even square pulse with Laplace transform


1 s/2
X1 (s) = [e − e−s/2 ]
s
with region of convergence the whole s-plane (the pole is cancelled by a zero at zero) so that the Fourier
transform of x1 (t) is
sin(Ω/2)
X1 (Ω) = X1 (s)|s=jΩ = .
Ω/2

The signal x2 (t) can be written

x2 (t) = sin(2πt)[u(t) − u(t − 0.5)] = sin(2πt)u(t) + sin(2π(t − 0.5))u(t − 0.5)

so that its Laplace transform is

2π −s/2 2πe−s/4 [es/4 + e−s/4 ]


X2 (s) = [1 + e ] =
s2 + 4π 2 s2 + 4π 2
The poles of X2 (s) are s1,2 = ±j2π and the zeros are the values of s that make e−s/2 = −1 = ejπ
which are infinite sk = ±j2πk, so that the poles are cancelled by zeros at the same frequency. The
region of convergence is thus the whole s-plane. Therefore the Fourier transform is

4πe−jΩ/4 cos(Ω/4)
X2 (Ω) = X2 (s) |s=jΩ =
4π 2 − Ω2

The signal x3 (t) has a Laplace transform


1 s
X3 (s) = [e − 2 + e−s ]
s2
with a region of convergence the whole s-plane. Again the pole at zero, s = 0, is cancelled by a zero
also at zero ( the zeros are values of s such that es − 2 + e−s = es (1 − e−s )2 = 0 or sk = ±j2πk. So

2(1 − cos(Ω))
X3 (Ω) =
Ω2
% Pr. 5_30
clear all;clf
%% Numerical computation
Ts=0.0001;
t1=0:Ts:1+Ts;N=length(t1);
x=[sin(2*pi*t1) zeros(1,N)];
N1=length(x);
t=0:N1-1;t=t*Ts;
[Xm,Xa,W]=AFourierT(x,Ts);
figure(1)
subplot(211)
plot(t,x)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.34

axis([0 max(t) -1.5 1.5])


xlabel(’t’)
ylabel(’x(t)’)
grid
M=length(W)/2;M1=M
subplot(212)
plot(W(M1-20:M1+20),Xm(M1-20:M1+20))
axis([W(M1-20) W(M1+20) 0 1.2])
grid
xlabel(’\Omega (rad/sec)’)
ylabel(’|X(\Omega)|’)

% symbolic computations
syms t w x
x1=heaviside(t+0.5)-heaviside(t-0.5);
X1=int(x1*exp(-j*w*t), t,-0.5,0.5)
figure(2)
subplot(211)
ezplot(x1,[-1,2]);grid;axis([-1 2 -2 2])
subplot(212)
ezplot(abs(X1),[-30,30]);grid;axis([-30 30 -0.25 1.25])

x2=sin(2*pi*t)*(heaviside(t)-heaviside(t-1))
X2=int(x2*exp(-j*w*t), t,0,0.5)
figure(3)
subplot(211)
ezplot(x2,[-1,2]);grid;axis([-1 2 -2 2])
subplot(212)
ezplot(abs(X2),[-30,30]);grid;axis([-30 30 -0.25 1.25])

x3=t*(heaviside(t)-heaviside(t-1))+(2-t)*(heaviside(t-1)-heaviside(t-2))
X3=int(x3*exp(-j*w*t), t,-Inf,Inf)
figure(4)
subplot(211)
ezplot(x3,[-1,3]);grid;axis([-1 3 -2 2])
subplot(212)
ezplot(sqrt(X3*conj(X3)),[-30,30]);grid;axis([-30 30 -0.25 1.25])

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.35

heaviside(t+1/2)−heaviside(t−1/2) t (heaviside(t)−heaviside(t−1))+(2−t) (heaviside(t−1)−heaviside(t−2))


2 1.5 2

1
1 1
0.5

x(t)
0 0 0

−0.5
−1 −1
−1

−2 −1.5 −2
−1 −0.5 0 0.5 1 1.5 2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 −1 −0.5 0 0.5 1 1.5 2 2.5 3
t t t
2 abs(1/w sin(1/2 w)) 4 (1/w2 sin(1/2 w)2 exp(−i w) conj(1/w2 sin(1/2 w)2 exp(−i w)))1/2

1 1 1

0.8

|X(Ω)|
0.5 0.6 0.5

0.4

0 0.2 0

0
−30 −20 −10 0 10 20 30 −60 −40 −20 0 20 40 −30 −20 −10 0 10 20 30
w Ω (rad/sec) w

Figure 5.6: Problem 30: left to right — signals xi (t), i = 1, 2, 3 and their corresponding magnitude spectra
|Xi (Ω)|, i = 1, 2, 3.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.36

5.31 (a) This is a decaying exponential for both negative and positive times.
(b) The signal is absolutely integrable,

Z ∞ Z ∞
e−2t ∞
|x(t)|dt = 2 2e−2t dt = 4 | =2
−∞ 0 −2 t=0

(c) Using the integral definition of the Fourier transform

Z 0 Z ∞
X(Ω) = 2 e2t e−jΩt dt + 2 e−2t e−jΩt dt
−∞ 0
2et(2−jΩ) 0 2e−t(2+jΩ) ∞
= |−∞ − |
2 − jΩ 2 + jΩ 0
2 2
= +
2 − jΩ 2 + jΩ
8
=
4 + Ω2

(d) The Laplace transform of X(s) is

2 2 8
X(s) = + =
−s + 2 s + 2 4 − s2

with ROC: −2 ≤ σ ≤ 2, which includes the jΩ-axis. so that

8
X(Ω) = X(s)|s=jΩ =
4 + Ω2

%% Pr. 5_31
syms t w x
x=2*exp(-2*abs(t)); X=fourier(x)
figure(1)
subplot(211)
ezplot(x,[-2,2]); grid; axis([-2 2 0 2.2])
subplot(212)
ezplot(abs(X),[-30,30]);grid;axis([-20 20 0 2.2]);
xlabel(’\Omega (rad/sec)’); ylabel(’|X(\Omega)|’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.37
2/exp(2 abs(t))
2

1.5

0.5

0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
t
8/abs(w2 + 4)
2

1.5

|X(Ω)|
1

0.5

0
−20 −15 −10 −5 0 5 10 15 20
Ω (rad/sec)

Figure 5.7: Problem 31

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.38

5.32 For the signal

1
x(t) = [u(t) − u(t − T0 )]
T0

we have:
(a) For T0 = 1

e−s/2 s/2
X(s) = [e − e−s/2 ]
s
sin(Ω/2) −jΩ/2
X(Ω) = e
Ω/2

The magnitude is zero at Ω = 2πk.


For T0 = 10

e−5s 5s
X(s) = [e − e−5s ]
10s
sin(5Ω) −j5Ω
X(Ω) = e
5Ω

the magnitude is zero for Ω = kπ/5, so that when we expand the signal in the time domain, the corre-
sponding Fourier transform is contracted.
(b) As the time support increases/decreases the frequency support decreases/increases.

%% Pr. 5_32
syms x t
figure(1)
for k=0:2,
T0=10ˆk;
x=(1/T0)*(heaviside(t)-heaviside(t-T0));
X=fourier(x)
ezplot(abs(X),[-12,12]);grid;axis([-12 12 -0.25 1.25])
hold on
pause(1)
end
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.39
1/100 abs((−1+exp(−100 i w))/w)
1.2

0.8

0.6

0.4

0.2

−0.2
−10 −5 0 5 10
w

Figure 5.8: Problem 32

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.40

5.33 For the signals

x(t) = u(t + 0.5) − u(t − 0.5)


y(t) = x(t) + x(t) cos(πt) = x(t)[1 + cos(πt)]

by looking at these signals it is hard to determine which is smoother. We need to look at their spectra.
(b) The Fourier transform of x(t) is given by

sin(Ω/2)
X(Ω) =
Ω/2

(c) The Fourier transform of y(t) is, using the modulation property,

Y (Ω) = X(Ω) + 0.5X(Ω − π) + 0.5X(Ω + π)

It would seem that the shifting of the spectrum X(Ω) would generate higher frequencies for y(t), but
that might not be so. Using MATLAB to compute the spectra of these two signals would help us decide
if we are right or not.
(d) To decide which one is smoother by means of their spectra we make both unit energy. Signal y(t)
shows less energy in the higher frequencies than x(t) so y(t) is smoother.

% Pr. 5_33
clear all;clf
Ts=0.001;
t=-0.5:Ts:0.5;t1=-1:Ts:-0.5;t2=0.5:Ts:1;N1=length(t1);N2=length(t2);N=length(t);
x=[zeros(1,N1) ones(1,N) zeros(1,N2)]; tt=[t1 t t2];
y=x.*(1+cos(pi*tt)); I=sum(y.ˆ2)/N; y=y/sqrt(I);
I2=sum(y.ˆ2)/N; % checking both are unit energy
I1=sum(x.ˆ2)/N;
[Xm,Xa,W]=AFourierT(x,Ts);
[Ym,Ya,W]=AFourierT(y,Ts);

figure(1)
subplot(221)
plot(tt,x); axis([-1 1 0 1.5]);grid;title(’x(t)’)
subplot(223)
plot(tt,y); axis([-1 1 0 1.5]);grid;title(’y(t)’)
subplot(222)
plot(W,20*log10(Xm)); axis([-200 200 -80 0]); grid; title(’magnitude spectrum of X(\Omega)’)
subplot(224)
plot(W,20*log10(Ym)); axis([-200 200 -80 0]); grid; title(’magnitude spectrum of Y(\Omega)’)

% symbolic computation

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.41

syms x t y w
x=heaviside(t+0.5)-heaviside(t-0.5);
Ex=int(xˆ2,t,-0.5, 0.5)
x=x/sqrt(Ex);
y=x*(1+cos(pi*t));
Ey=int(yˆ2,t,-0.5, 0.5)
y=y/sqrt(Ey);
figure(1)
subplot(221)
ezplot(x,[-0.6 0.6])
subplot(222)
ezplot(y,[-0.6 0.6])
X=fourier(x)
Y=fourier(y)
subplot(223)
ezplot(10*log10(abs(X)ˆ2),[-30 30]);grid
subplot(224)
ezplot(10*log10(abs(Y)ˆ2),[-30 30]);grid

x(t) magnitude spectrum of X(Ω)


1.5 0

−20
1
−40
0.5
−60

0 −80
−1 −0.5 0 0.5 1 −200 −100 0 100 200

y(t) magnitude spectrum of Y(Ω)


1.5 0

−20
1
−40
0.5
−60

0 −80
−1 −0.5 0 0.5 1 −200 −100 0 100 200

Figure 5.9: Problem 33: signals and their magnitude spectra (in dB).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.42

5.34 (a) The triangular pulse x(t) is even

x(t) = r(t + 1) − 2r(t) + r(t − 1)

and its derivative is


y(t) = u(t + 1) − 2u(t) + u(t − 1)
which is an odd signal composed of two pulses of duration 1.
(b) The Fourier transform of x(t) is computed from its Laplace transform
1 s es es
X(s) = 2
[e − 2 + e−s ] = 2 [1 − 2e−s + e−2s ] = 2 (1 − e−s )2
s s s
which cancels out the poles at s = 0 so that the region of convergence is the whole s-plane. By letting
s = jΩ we have that
2 sin2 (Ω/2)
X(Ω) = [cos(Ω) − 1] =
−Ω2 (Ω/2)2
which is real given that x(t) is even.
(c) Because of the derivative
sin2 (Ω/2)
Y (Ω) = jΩX(Ω) = jΩ
(Ω/2)2
which is imaginary given that y(t) is odd. The magnitude

|Y (Ω)| = |X(Ω)||Ω|

which is the product of the sinc square and the absolute value of Ω. Thus x(t) is smoother than its
derivative y(t).

%% Pr. 5_34
syms x t w y X Y
x=(t+1)*(heaviside(t+1)-heaviside(t))+(1-t)*(heaviside(t)-heaviside(t-1));
y=heaviside(t+1)-2*heaviside(t)+heaviside(t-1);
figure(1)
subplot(211)
ezplot(x,[-1.5,1.5]);grid
subplot(212)
ezplot(y,[-1.5,1.5]);grid
X=int(x*exp(-j*w*t),t,-Inf,-Inf);
Y=int(y*exp(-j*w*t),t,-Inf,-Inf);
figure(2)
subplot(211)
XX=X*conj(X);
ezplot(10*log10(XX),[-100,100]);grid;axis([-100 100 -80 1]);ylabel(’X(\Omega)’)
subplot(212)
YY=Y*conj(Y);
ezplot(10*log10(YY),[-100,100]);grid;axis([-100 100 -80 1]);ylabel(’Y(\Omega)’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.43

(t+1) (heaviside(t+1)−heaviside(t))+(1−t) (heaviside(t)−heaviside(t−1))


10 log(16/w2 sin(1/2 w)2 conj(1/w2 sin(1/2 w)2))/log(10)
1
0
0.8

0.6 −20

X(Ω)
0.4 −40

0.2
−60
0
−80
−1.5 −1 −0.5 0 0.5 1 1.5 −100 −80 −60 −40 −20 0 20 40 60 80 100
t w
heaviside(t+1)−2 heaviside(t)+heaviside(t−1) 10 log(16/w sin(1/2 w)2 conj(1/w sin(1/2 w)2))/log(10)

1 0

0.5 −20

Y(Ω)
0 −40

−0.5 −60

−1 −80
−100 −80 −60 −40 −20 0 20 40 60 80 100
−1.5 −1 −0.5 0 0.5 1 1.5 w
t

Figure 5.10: Problem 34: signals and their magnitude spectra (in dB).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.44

5.35 (a) The signal x(t) is composed of two pulses, a non-causal positive pulse starting at −1 and ending at
zero, and a negative causal pulse from 0 to 1, the integral of this signal is a triangular signal y(t) from
−1 to 1. See the script below.
(b) The Fourier transform is given by

1 (sin(Ω/2))2
X(Ω) = (2 cos(Ω) − 2) = j
jΩ Ω/4

which is imaginary given that x(t) is odd.


(c) According to the integration property the Fourier transform of y(t) is
 2
X(Ω) sin(Ω/2)
Y (Ω) = =
jΩ Ω/2

which is real given that y(t) is even. It can also be obtained from the Laplace transform. The y(t) is
given as
y(t) = r(t + 1) − 2r(t) + r(t − 1)

with Laplace transform


1 s 1
Y (s) = (e − 2 + e−s ) = 2 (es/2 − e−s/2 )2
s2 s
with region of convergence the whole s-plane excluding the origin. Thus,
 2
1 sin(Ω/2)
Y (Ω) = (−4 sin2 (Ω/2)) =
−Ω2 Ω/2

which is real given that y(t) is even. It can be generalized that when the signal is even the FT is real and
when the signal is odd the FT is imaginary.
(d) The signal y(t) is smoother since it goes faster to zero as Ω increases. Integration smoothes out a
signal.

%% Pr. 5_35
syms x t y X Y
x=heaviside(t+1)-2*heaviside(t)+heaviside(t-1)
y=int(x);
figure(1)
subplot(211)
ezplot(x,[-2,3]);grid
subplot(212)
ezplot(y,[-2,3]);grid
X=int(x*exp(-j*w*t),t, -1,1);
Y=int(y*exp(-j*w*t),t,-1,1);
figure(2)
subplot(211)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.45

XX=X*conj(X);
ezplot(sqrt(XX),[-50,50]);grid;axis([-50 50 0 1.5]);ylabel(’X(\Omega)’)
subplot(212)
YY=Y*conj(Y);
ezplot(sqrt(YY),[-50,50]);grid;axis([-50 50 0 1.5]);ylabel(’Y(\Omega)’)
heaviside(t+1)−2 heaviside(t)+heaviside(t−1) 4 (1/w sin(1/2 w)2 conj(1/w sin(1/2 w)2))1/2
1.5
1

0.5 1

X(Ω)
0

−0.5 0.5

−1
0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3 −50 −40 −30 −20 −10 0 10 20 30 40 50
t w
2 2 2 2 1/2
heaviside(t+1) t+heaviside(t+1)−...−heaviside(t−1) 4 (1/w sin(1/2 w) conj(1/w sin(1/2 w) ))
1.5
1

0.8
1
0.6

Y(Ω)
0.4
0.5
0.2

0
0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3 −50 −40 −30 −20 −10 0 10 20 30 40 50
t w

Figure 5.11: Problem 35: signals and their magnitude spectra.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.46

5.36 Voltage across capacitor The transfer function is

VC (s) 1/s 1
= = 2
Vs (s) 1 + s + 1/s s +s+1

corresponding to a low-pass filter.


Voltage across inductor The transfer function is

VL (s) s s2
= = 2
Vs (s) 1 + s + 1/s s +s+1

corresponding to a high-pass filter.


Voltage across resistor The transfer function is

VR (s) 1 s
= = 2
Vs (s) 1 + s + 1/s s +s+1

corresponding to a band-pass filter.

%% Pr 5_36
clear all; clf
%% in descending order
n=[0 0 1]; d=[1 1 1];
figure(1)
wmax=20;
freq_resp_s(n,d,wmax)
n1=[1 0 0]; d1=d;
figure(2)
freq_resp_s(n1,d1,wmax)
n2=[0 1 0];d2=d;
figure(3)
freq_resp_s(n2,d2,wmax)

Magnitude response Phase response in degrees Magnitude response Phase response in degrees Magnitude response Phase response in degrees
0
1
1 −50 50 1 150
0.8
< H(j Ω)

< H(j Ω)

< H(j Ω)
|H(j Ω)|

|H(j Ω)|

|H(j Ω)|

0.6 100
−100 0
0.5 0.4 0.5
−150 −50 50
0.2

0 0 0 0
0 5 10 0 5 10 0 5 10 0 5 10 0 5 10 0 5 10
Ω Ω Ω Ω Ω Ω
Poles/Zeros Poles/Zeros Poles/Zeros
1 1 1
Imaginary Part

Imaginary Part

Imaginary Part

0.5 0.5 0.5

2
0 0 0

−0.5 −0.5 −0.5

−1 −1 −1
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
Real Part Real Part Real Part

Figure 5.12: Problem 36: left to right: low-pass, band-pass and high-pass filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.47

5.37 (a) The impulse response of the given filter is obtained by duality. It is of the form h(t) = A[u(t + t0 ) −
u(t − t0 )] where A and t0 are obtained by finding its Fourier transform
Z t0
ejΩt t0
H(jΩ) = AejΩt dt = A |
−t0 jΩ −t0
2j sin(Ωt0 )
= A
jΩ

so that t0 = π and 2A = 1/π or A = 1/2π. Thus

1
h(t) = [u(t + π) − u(t − π)] = 0.16[u(t + π) − u(t − π)].

which is non-causal since h(t) 6= 0 for t < 0.
(b) The impulse response of the bandpass filter is

g(t) = 2h(t) cos(5πt) = 0.32

which is real. Its magnitude response is

G(jΩ) = H(j(Ω − 5π)) + H(j(Ω + 5π))

%% Pr. 5_37
syms H w t h g G
H=sinc(w);
h=real(ifourier(H,t));
figure(1)
subplot(211)
ezplot(H,[-2*pi,2*pi]);grid;axis([-2*pi 2*pi -0.5 1.2])
xlabel(’\Omega’);ylabel(’H(j\Omega)’)
subplot(212)
ezplot(h,[-20,20]);grid;axis([-20 20 -0.05 0.2])
xlabel(’t’); ylabel(’h(t)’)
g=2*h*cos(5*t);
G=int(g*exp(-j*w*t),t,-100,100)
figure(2)
subplot(211)
ezplot(g,[-10,10]);grid;axis([-10 10 -0.5 0.5]);xlabel(’t’);title(’ ’)
xlabel(’t’);ylabel(’g(t)’)
subplot(212)
ezplot(sqrt(G*conj(G)),[-30,30]);
grid;axis([-30 30 -0.1 1.1])
xlabel(’\Omega’);title(’ ’)
xlabel(’\Omega’);ylabel(’G(j\Omega)’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.48

sin(π w)/(π w)
0.5
1

0.5
H(jΩ)

g(t)
0

−0.5 −0.5
−6 −4 −2 0 2 4 6 −10 −8 −6 −4 −2 0 2 4 6 8 10
Ω t
2 2
(π conj(heaviside(π + t)) − π conj(heaviside(t − π)))/(4 π ) + (π heaviside(π + t) − π heaviside(t − π))/(4 π )
0.2
1
0.15
0.8
0.1 0.6

G(jΩ)
h(t)

0.05 0.4

0.2
0
0
−0.05
−20 −15 −10 −5 0 5 10 15 20 −30 −20 −10 0 10 20 30
t Ω

Figure 5.13: Problem 37: non–causal low-pass (left) and bandpass filters (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.49

5.38 The transfer functions are


(s − 1)(s − 1 + jπ)(s − 1 − jπ) (s − 1)((s − 1)2 + π 2 )
H1 (s) = =
(s + 1)(s + 1 − jπ)(s + 1 + jπ) (s + 1)((s + 1)2 + π 2 )
(s + jπ)(s − jπ) s2 + π 2
H2 (s) = =
(s + 1)(s + 1 + jπ)(s + 1 − jπ) (s + 1)((s + 1)2 + π 2 )
s−1 s−1
H3 (s) = =
(s + 1)(s + 1 + jπ)(s + 1 − jπ) (s + 1)((s + 1)2 + π 2 )

H1 (s) is the transfer function of an all-pass filter. H2 (s) corresponds to a notch type of filter (the notches
are at ±π) and behaves like a low-pass in the low frequencies and goes to zero at high frequencies. H3 (s)
corresponds to a low-pass filter.

%% Pr. 5_38
clear all; clf
%% in descending orde
n=[1 -3 3+piˆ2 -(1+piˆ2)];
d=[1 3 3+piˆ2 (1+piˆ2)];
figure(1)
wmax=20;
freq_resp_s(n,d,wmax)
n1=[0 1 0 piˆ2]; d1=d;
figure(2)
freq_resp_s(n1,d1,wmax)
n2=[0 0 1 -1];;d2=d;
figure(3)
freq_resp_s(n2,d2,wmax)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 5.50

Magnitude response Phase response in degrees Magnitude response Phase response in degrees
1 150 0
0.8
0.8 100
50
< H(j Ω)

< H(j Ω)
0.6 −50
|H(j Ω)|

|H(j Ω)|
0.6
0
0.4 −50 0.4
−100
−100
0.2 0.2
−150 −150
0 0
0 5 10 15 20 0 5 10 15 20 0 5 10 15 20 0 5 10 15 20
Ω Ω Ω Ω
Poles/Zeros Poles/Zeros
3 3
2 2
Imaginary Part

Imaginary Part
1 1
0 0
−1 −1
−2 −2
−3 −3
−4 −2 0 2 4 −4 −2 0 2 4
Real Part Real Part

Magnitude response Phase response in degrees

0.15 150
100
50
< H(j Ω)
|H(j Ω)|

0.1
0
−50
0.05
−100
−150
0
0 5 10 15 20 0 5 10 15 20
Ω Ω
Poles/Zeros
3
2
Imaginary Part

1
0
−1
−2
−3
−4 −2 0 2 4
Real Part

Figure 5.14: Problem 38: frequency responses and poles/zeros of H1 (s), H2 (s) (top) and H3 (s) (bottom)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 6

Application of Laplace Analysis to


Control

6.1 Basic Problems


6.1 (a) Nodal equations (circuit (a) in Fig. 6.1)
    
V1 (s)/1 2 + s −1 V2 (s)
=
0 −1 1+s V3 (s)

then
 
2+s V1 (s)
det
−1 0 V (s) V3 (s) 1
V3 (s) =   = 2 1 ⇒ = 2
2+s −1 s + 3s + 1 V1 (s) s + 3s + 1
det
−1 1+s

(b) With the voltage follower (circuit (b) in Fig. 6.1)

V3 (s) V3 (s) V2 (s) 1


= =
V1 (s) V2 (s) V1 (s) (s + 1)(s + 1)

there is no loading in this case so we obtain the desired transfer function.


(c) Three stages with transfer functions

1000 1 1
H1 (s) = , H2 (s) = , H3 (s) =
s + 1000 s+1 1000

as shown in circuit (c) of Fig. 6.1 will give the desired transfer function G(s).

1
Chaparro — Signals and Systems using MATLAB 6.2

1Ω 1Ω 1Ω -
1Ω
v2 (t) +
+ + + + + +
v1 (t) 1F 1F v3 (t) v1 (t) 1F v2 (t) 1F v3 (t)
− − − − −

(a) (b)

999 Ω
1Ω 1Ω -
-
+
+
+ +
1Ω vo (t)
vi (t) 10−3 F 1F
− −

(c) +

Figure 6.1: Problem 1: Cascade of two RC circuits (a) with loading and(b) no loading; (c) cascading 3
circuits to implement given G(s)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.3

6.2 (a) Using Kirchkoff’s voltage laws we have


(i) Vi (s) = I(s)[R1 + R2 ] + Vo (s)
(ii) Vi (s) = R1 I(s) + V− (s)
(iii) Vo (s) = −AV− (s)
where Vi (s), Vo (s), V− (s), I(s) are Laplace transforms of vi (t), vo (t), v− (t) and the current i(t) through
R1 and R2 (the current into the negative terminal is assumed zero). From (i)
Vi (s) − Vo (s)
I(s) =
R1 + R2
We then have in (ii)
R1 (Vi (s) − Vo (s))
(iv) Vi (s) = + V− (s)
R1 + R2
which can be rewritten as after replacing V− (s) in (iii)
 
R1 −R1 Vo (s) + V− (s)(R1 + R2 )
Vi (s) 1 − =
R1 + R2 R1 + R2
 
R2 Vo (s) R2
− Vi (s) = Vo (s) + 1+
R1 A R1
which represents a negative feedback as shown in Fig. 6.2.
Notice that (iv) becomes

Vi (s) + Vo (s)
−R2
R1

R1 + R 2
AR1

Figure 6.2: Problem 2: negative feedback equivalent of op-amp inverting amplifier.

R1 (Vi (s) − Vo (s)) Vo (s)


Vi (s) = −
R1 + R2 A
after replacing equation (iii). If we let A → ∞ we get Vo (s)/Vi (s) = −R2 /R1 . According to Fig. 6.2
the feedback signal is then zero giving the same result.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.4

6.3 (a) The transfer function of the RC circuit is

Vo (s) 1/RC
=
Vi (s) s + 1/(RC)

An equivalent negative feedback with a feed–forward transfer function G(s), and feedback transfer func-
tion H(s) = 1 gives

Vo (s) G(s)
=
Vi (s) 1 + G(s)

Comparing the two we get that G(s) = 1/(RCs). Considering an integrator has a transfer function 1/s
then we have the equivalent representations for the RC circuit shown in Fig. 6.4.

+ e(t) 1 !
vi (t) (.)dt vo (t)
RC

Figure 6.3: Problem 3: negative feedback equivalent of RC circuit.

(b) If vi (t) = Au(t), Vi (s) = A/s, then

A/RC B D
Vo (s) = = +
s(s + 1/(RC)) s s + 1/RC

Since 1/RC > 0, i.e., the pole of Vo (s) is in the left-hand s-plane, then in the steady state vo (t) = B,
where
A/RC
B = Vo (s)s|s=0 = =A
1/(RC)
so that in the steady–state the error signal e(t) = vi (t) − vo (t) will be zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.5

6.4 (a) The transfer function of the RLC circuit with output Vo (s) = Vc (s) is
Vo (s) 1/Cs 1/LC
= = 2
Vi (s) R + Ls + 1/Cs s + (R/L)s + 1/LC
Letting, R = L = C = 1 the differential equation corresponding to the above transfer function is
d2 vo (t) dvo (t)
+ + vo (t) = vi (t)
dt2 dt
which can be implemented using two integrators and an adder as shown in Fig. 6.4(a).
(b) Letting the negative feedback be the one shown in Fig. 6.4(b), comparing it to the above transfer
function (let again R = L = C = 1) we have
Vo (s) 1/s G(s)
= =
Vi (s) 1 + s + 1/s 1 + G(s)H(s)
so that
1
G(s) =
s
1
G(s)H(s) = s + ⇒ H(s) = s2 + 1
s
(c) E(s) = Vi (s) − (s2 + 1)Vo (s) and

vi (t) + vo(2) (t) ! vo(1) (t) ! vo (t)


(.)dt (.)dt
− −

(a)

vi (t) + e(t) 1
G(s) = vo (t)
s

H(s) = s2 + 1

(b)

Figure 6.4: Problem 4: feedback equivalents of RLC circuit: (a) from differential equation, (b) from transfer
function (R = L = C = 1).

1 A Bs + C
Vo (s) = = + 2
s(s2
+ s + 1) s s +s+1
2 2
p
since s + s + 1 = (s + 1/2) + 3/4, its roots are s1,2 = −1/2 ± j 3/4, in the left-hand s–plane, and
the steady state response is vo (t) = A where A = 1. The steady–state error is then
d2 vo (t)
lim [e(t) = vi (t) − − vo (t)] = 1 − 0 − 1 = 0.
t→∞ dt2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.6

6.5 (a) The transfer function of a stable second–order all–pass filter is of the form

(s − α + jβ)(s − α − jβ) (s − α)2 + β 2 N (s)


T (s) = = =
(s + α + jβ)(s + α − jβ) (s + α)2 + β 2 N (−s)

for α > 0 and β ≥ 0. The poles of T (s) are in the left-hand s-plane, and the poles an zeros are symmetric
with respect to the jΩ–axis, i.e., have the same imaginary parts and opposite real parts. If we call the
numerator N (s), the denominator of T (s) is N (−s).
For a negative feedback system with feed-forward transfer function G(s) and feedback transfer function
H(s) we have
G(s) N (s)
=
1 + G(s)H(s) N (−s)
which gives
N (s)
G(s) =
N (−s) − N (s)H(s)
Thus if we let H(s) = 1, then

N (s) (s − α)2 + β 2
G(s) = =
N (−s) − N (s) (s + α)2 + β 2 − (s − α)2 − β 2
2 2
(s − α) + β
=
4αs

For a positive feedback we let H(s) = −1 and then

N (s) (s − α)2 + β 2
G(s) = =
N (−s) + N (s) (s + α) + β 2 + (s − α)2 + β 2
2

(s − α)2 + β 2
=
2(s2 + α2 + β 2 )

For the given √


s2 − 2s + 1 N (s)
T (s) = √ =
2
s + 2s + 1 N (−s)
√ √
we have also that α = 2/2, β = 2/2. Thus for the negative feedback implementation we let

H(s) = 1

s2 − 2s + 1
G(s) = √
2 2s
and for the positive feedback implementation we let

H(s) = −1

s2 − 2s + 1
G(s) =
2(s2 + 1)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.7

6.6 (a) Replacing F (s) we have


 
G(s) 1
E(s) = X(s) 1 − = X(s)
1 + G(s) 1 + N (s)
D(s)
X(s)D(s)
=
D(s) + N (s)

If X(s) = 1/s then for the error to go to zero in the steady state, the roots of D(s) + N (s) should be
in the left–hand s-plane and D(s) must cancel the pole of E(s) at zero contributed by X(s), i.e., D(s)
must be of the form D(s) = sD1 (s).
(b) For G(s) = 1/(s + 1)(s + 2) and X(s) = 1/s the Laplace transform of the error is

D(s) (s + 1)(s + 2)
E(s) = =
s(1 + D(s)) s(s2 + 3s + 3)

According to the initial value theorem we have that

(1 + 1/s)(1 + 2/s)
e(0) = lim sE(s) = lim =1
s→∞ s→∞ 1 + 3/s + 3/s2
p
The poles of E(s) are s = 0 and s1,2 = −3/2 ± j 3/4 since s2 + 3s + 3 = (s + 3/2)2 + 3/4. A partial
fraction expansion for E(s) is
A Bs + C
E(s) = + 2
s s + 3s + 3
where
D(0) 2
A = sE(s)|s=0 = =
1 + D(0) 3
in this case the steady state error is 2/3. The error is not zero in the steady–state because D(s) does not
cancel the pole due to X(s).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.8

6.7 (a) h(t) = hp (t)e−t = e−t sin(t)u(t) so

1
H(s) =
(s + 1)2 + 1

For feedback system

Hc (s)Hp (s) Hc (s)


H(s) = = 2
1 + Hc (s)Hp (s) s + 1 + Hc (s)

after replacing Hp (s) = 1/(s2 + 1). Then

Hc (s) 1 s2 + 1
= ⇒ Hc (s) =
s2 + 1 + Hc (s) 2
(s + 1) + 1 (s + 1)2

(b) Unit-step response s(t)

H(s) 1
S(s) = =
s s((s + 1)2 + 1)
A B B∗
= + +
s s − (−1 + j) s − (−1 − j)

where

A = sS(s)|s=0 = 0.5
1 1
B = |s=−1+j = √ ej3π/4
s(s + 1 + j) 2 2
thus
s(t) = [0.5 + 0.707 cos(t + 3π/4)]u(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.9

6.8 (a) Transfer function of feedback system



G(s) 1 α−1
H(s) = = 2 =√
1 + F (s)G(s) s + 2s + α α − 1((s + 1)2 + α − 1)

with inverse Laplace transform


1 √
h(t) = √ e−t sin( α − 1t)u(t)
α−1
so that α = 4.
(b) i. When F (s) = 0, the system is open-loop, Y (s) = X(s)G(s) so

Y (s) s(s + 1)
G(s) = = 2
X(s) s +1

corresponding to an unstable system because of poles at s = ±j.


ii. When F (s) 6= 0, i.e., the feedback loop is closed, the transfer function of the overall system is

Y (s) s2 + 1 G(s)
H(s) = = =
X(s) s(s + 1) 1 + G(s)F (s)

then solving for F (s) in the last equation

G(s) − H(s) 1 1
F (s) = = −
H(s)G(s) H(s) G(s)
s(s + 1) s2 + 1 2s3 − s2 − 1
= − =
s2 + 1 s(s + 1) s(s + 1)(s2 + 1)

iii. Poles of F (s) are 0, −1, ±j, three of which are in jΩ-axis of the s-plane, so the corresponding
system is unstable.
iv. H(s) is not proper rational so we divide to obtain

s2 + 1 −s + 1 1 2
H(s) = =1+ =1+ − ⇒ h(t) = δ(t) + u(t) − 2e−t u(t)
s(s + 1) s(s + 1) s s+1

The feedback system is not BIBO stable because there is a pole at s = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.10

6.9 (a) Output of system A: x(t) = δ(t) − [u(t) − u(t − 1)] and by superposition

y(t) = e−2t u(t) − 0.5(1 − e−2t )u(t) + 0.5(1 − e−2(t−1) )u(t − 1)

(b) When x(t) = δ(t), y(t) = e−2t u(t) which is the impulse response, thus H(s) = Y (s)/X(s) =
1/(s + 2) so

dy(t)
+ 2y(t) = x(t)
dt
dz(t)
=
dt

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.11

6.10 (a) Laplace transforms

(s + 1)W (s) = X(s)


(s + 2)Y (s) = W (s)

replacing W (s) in the second equation gives

X(s) Y (s) 1 1
(s + 2)Y (s) = ⇒ = = 2
s+1 X(s) (s + 1)(s + 2) s + 3s + 2

so that
d2 y(t) dy(t)
2
+3 + 2y(t) = x(t)
dt dt
(b) i. For the first system, the Laplace transform of its differential equation is
1
sW (s) − w(0) + W (s) = 0 ⇒ W (s) = ⇒ w(t) = e−t u(t)
s+1
ii. For the second system with input w(t) = e−t u(t)
1 1
sY (s) − y(0) + 2Y (s) = ⇒ Y (s) =
s+1 (s + 1)(s + 2)

so that
1 1
Y (s) = − ⇒ y(t) = (e−t − e−2t )u(t)
s+1 s+2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.12

6.11 (a) Using linearity

Y (s) 1/s
V (s) = 0 → =
X(s) 1 + 1/(s(s + 1))
s+1
= 2
s +s+1
Y (s) 1
X(s) = 0 → =
V (s) 1 + 1/(s(s + 1))
s(s + 1)
=
s2 + s + 1

(b) Letting X(s) = 1/(s + 1) and V (s) = 1/s − 1/(s + 1) = 1/(s(s + 1)) and using superposition
we have
s+1 s(s + 1)
Y (s) = X(s) + 2 V (s)
s2 + s + 1 s +s+1
1 1 2
= 2
+ 2 = 2
s +s+1 s +s+1 s +s+1
and so
p
2 3/4
Y (s) = p then
3/4 (s + 0.5)2 + 3/4

4 3 −0.5t p
y(t) = e sin( 3/4t)u(t)
3

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.13

6.12 (a) Let G(s) = 1/(s(s + 1/Q)) be the Laplace transform in the feedforward loop and with unit gain
in the feedback then
G(s) 1/(s(s + 1/Q)) 1
H(s) = = = 2
1 + G(s) 1 + 1/(s(s + 1/Q)) s + s/Q + 1

(b) Writing s2 + s/Q + 1 = (s + 1/(2Q))2 + (1 − 1/(4Q2 )) the poles are


1 p
p1,2 = − ± j 1 − 1/(4Q2 )
2Q
which have a magnitude of one and the angle φ measured with respect to the negative real–axis is
p
1 − 1/(4Q2 ) p
−1
φ = tan = tan−1 ( 4Q2 − 1)
1/2Q

The real part


1 1
= 1 cos(φ) → Q =
2Q 2 cos(φ))
(c) When Q = 0.5, 0.707, ∞ the angle φ = 0, π/4, π/2. For
1
H(s) = when
(s + 1/(2Q))2
+ (1 − 1/(4Q2 ))
1
Q = 0.5 → H(s) =
(s + 1)2
1
Q = 0.707 → H(s) = √
(s + 1/ 2)2 + 1/2
1
Q → ∞ → H(s) = 2
s +1
and the corresponding impulse responses are

h(t) = te−t u(t)


1 √ √
h(t) = √ e−t/ 2 sin(t/ 2)u(t)
2
h(t) = sin(t)u(t)

As Q increases the impulse response becomes more oscillatory.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.14

6.13 (a) The feedforward transfer function is


K1 + K2 s
G(s) = Gc (s)Gp (s) =
s(s + 1)

so that
K1 +K2 s
Y (s) G(s) s(s+1)
H(s) = = =
X(s) 1 + G(s) 1 + Ks(s+1)
1 +K2 s

K1 + K2 s
=
s2 + s(1 + K2 ) + K1

(b) (i) K1 = 1, K2 = 1 then H(s) = (s + 1)/(s2 + 2s + 1) = 1/(s + 1), no zero and pole at −1. For
X(s) = 1/s then
1 1 1
Y (s) = = −
s(s + 1) s s+1
and the steady–state is yss (t) = 1 and thus the steady–error is |ε(t)| = |1 − 1| = 0.
(ii) K1 = 0, K2 = 1 then H(s) = s/(s2 + 2s) = 1/(s + 2), no zero and pole at −2. For
X(s) = 1/s then
1 0.5 0.5
Y (s) = = −
s(s + 2) s s+2
and the steady–state is yss (t) = 2 and thus the steady–error is |ε(t)| = |1 − 0.5| = 0.5.
(iii) K1 =√1, K2 = 0 then H(s) = 1/(s2 + s + 1) = 1/((s + 0.5)2 + 0.75), no zero and pole at
−0.5 ± j 0.75. For X(s) = 1/s then

1 1 Bs + C
Y (s) = 2
= +
s((s + 0.5) + 0.75) s ((s + 0.5)2 + 0.75)

and the steady–state is yss (t) = 1 and thus the steady–error is |ε(t)| = |1 − 1| = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.15

6.14 The ordinary differential equation for this system is

a0 y(t) + a1 ẏ(t) + ÿ(t) = b0 x(t) + b1 ẋ(t)

The derivative of the given state equations are

(i) v̇1 (t) = ẏ(t)


(ii) v̇2 (t) = ÿ(t) + a1 ẏ(t) − b1 ẋ(t)

From the differential equation we have that

ÿ(t) + a1 ẏ(t) − b1 ẋ(t) = −ao y(t) + bo x(t)

and since y(t) = v1 (t) equation (ii) is equivalently written as

(ii) v̇2 (t) = −ao v1 (t) + bo x(t)

Likewise, from the definition of v2 (t) we have that equation (i) can be rewritten using the expression for
v2 (t) as
(i) v̇1 (t) = ẏ(t) = v2 (t) − a1 y(t) + b1 x(t) = v2 (t) − a1 v1 (t) + b1 x(t)
after replacing y(t) = v1 (t).
The state and the output equations are then
      
v̇1 (t) −a1 1 v1 (t) b1
= + x(t)
v̇2 (t) −a0 0 v2 (t) b0
 
  v1 (t)
y(t) = 1 0
v2 (t)

The block diagram for the realization is shown in Fig. 14.

b1

� v2 (t) � v1 (t)
b0 + +
x(t) y(t)

−a1

−a0

Figure 6.5: Problem 14

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.16

6.15 (a) The matrix/vectors for the new form are


   
−a1 1 b1  
Ao = , bo = , cTo = 1 0
−a0 0 b0

and the transformed vectors and matrix are

(i) cTc = cTo F, (ii) bc = F−1 bo , (iii) Ac = F−1 Ao F

If we let the transformation matrix be


 
f11 f12
F=
f21 f22

and assume that it is invertible. Then equation (i) gives


 
    f11 f12
b1 b0 = 1 0 then
| {z } | {z } f21 f22
cT
c cT
o

f11 = b1 , f12 = b0

Equation (ii) givess

Fbc = bo
    
b1 b0 1 b1
= then
f21 f22 0 b0
f21 = b0

Finally, equation (iii) gives

FA = Ao F
 c     
b1 b0 −a1 −a0 −a1 1 b1 b0
=
b0 f22 1 0 −a0 0 b0 f22
−a1 b0 + f22 = −a0 b1 → f22 = a1 b0 − a0 b1

Then the matrix is  


b1 b0
F=
b0 a1 b0 − a0 b1
with the condition that det [F] = a1 b0 b1 − a0 b21 − b20 6= 0.
(b) Replacing a1 = −1, a0 = −2 and b1 = 1 and b0 = −2 we find that the matrix
 
1 −2
F=
−2 4

is not invertible because its determinant is zero, so there is no possible transformation in this case.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.17

6.16 For the realization (1) we have the following equations

y1 (t) = v1 (t) − 2v2 (t)


v̇1 (t) = x1 (t) + v1 (t) + 2v2 (t)
v̇2 (t) = v1 (t)

which in the Laplace transform are

(i) Y1 (s) = V1 (s) − 2V2 (s)


(ii) V1 (s)(s − 1) = 2V2 (s) + X1 (s)
(iii) sV2 (s) = V1 (s)

Replacing V2 (s) = V1 (s)/s from equation (iii) in equation (ii) we have that

V1 (s)(s − 1 − 2/s) = X1 (s)

so that V1 (s) = X1 (s)/(s−1−2/s) and and using (iii) 2V2 (s) = 2V1 (s)/s = X1 (s)(2/s)/(s−1−2/s)
so that equation (i) becomes
1 − 2/s
Y1 (s) = X1 (s)
s − 1 − 2/s
so that
Y1 (s) s−2
H1 (s) = = 2
X1 (s) s −s−2

For the realization (2) we have the following equations

y2 (t) = w1 (t)
ẇ1 (t) = x2 (t) + y2 (t) + w2 (t)
ẇ2 (t) = −2x2 (t) + 2y2 (t)

or in the Laplace domain

(i) Y2 (s) = W1 (s)


(ii) sW1 (s) = X2 (s) + Y2 (s) + W2 (s)
(iii) sW2 (s) = −2X2 (s) + 2Y2 (s)

Replacing W2 (s) from equation (iii) into equation (ii) we get

W1 (s) = (1/s − 2/s2 )X2 (s) + (1/s + 2/s2 )Y2 (s)

which replaced in equation (i) gives

(1 − 1/s − 2/s2 )Y2 (s) = (1/s − 2/s2 )X2 (s)

so that the system transfer function is


Y2 (s) s−2
H2 (s) = = 2
X2 (s) s −s−2
Indicating that the two realizations are different realizations of the same system.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.18

6.2 Problems using MATLAB


6.17 (a) The Laplace transform of the error is
 
G(s) X(s)
E(s) = X(s) − Y (s) = X(s) 1 − =
1 + G(s) 1 + G(s)
s(s + 1)(s + 2)
= X(s)
1 + s(s + 1)(s + 2)
(b) For x(t) = u(t) then
(s + 1)(s + 2)
E1 (s) =
1 + s(s + 1)(s + 2)
According to the final value theorem
s(s + 1)(s + 2)
e1ss = lim sE1 (s) = lim =0
s→0 s→0 1 + s(s + 1)(s + 2)

(c) If x(t) = r(t), X(s) = 1/s2 , we then have


(s + 1)(s + 2)
E2 (s) =
s(1 + s(s + 1)(s + 2))
and the final value theorem gives
(s + 1)(s + 2) 2
e2ss = lim sE2 (s) = lim = =2
s→0 s→0 1 + s(s + 1)(s + 2) 1
larger than e1ss as r(t) is harder to follow that u(t).

% Pr 6_17
clear all; clf
% computation e_1(t)
num=[0 1 3 2] % high order to low order
den=[1 3 2 1]% high order to low order
figure(1)
subplot(211)
[r,p]=pfeLaplace(num,den);
t=0:0.001:20;
e1=r(1)*exp(p(1).*t)+r(2)*exp(p(2).*t)+r(3)*exp(p(3).*t);
subplot(212)
plot(t,e1); grid; ylabel(’e_1(t)’); xlabel(’t’)
% computation of e_2(t)
num=[0 0 1 3 2] % high order to low order
den=[1 3 2 1 0]% high order to low order
figure(2)
subplot(211)
[r,p]=pfeLaplace(num,den);
t=0:0.001:20;
e2=r(1)*exp(p(1).*t)+r(2)*exp(p(2).*t)+r(3)*exp(p(3).*t)+r(4)*exp(p(4).*t);
subplot(212)
plot(t,e2);grid; ylabel(’e_1(t)’); xlabel(’t’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.19

1.5 1.5

1 1

0.5 0.5

0 0
jΩ

jΩ
−0.5 −0.5

−1 −1

−1.5 −1.5
−3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3
σ σ

1 2.5

0.8 2
0.6
1.5
e1(t)

e1(t)
0.4
1
0.2

0 0.5

−0.2 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
t t

Figure 6.6: Problem 17: poles/zeros of E1 (s) and e1 (t) (left), poles/zeros of E2 (s) and e2 (t) (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.20

6.18 (a) Transfer function


s−1 s−1 1
H(s) = = =
s2 + s − 2 (s + 2)(s − 1) s+2
the system is BIBO stable because of the cancellation of the pole s = 1 by the zero at the same
place.
(b)
W (s) Y (s)
H(s) =
X(s) W (s)
where
d2 w(t) dw(t)
W (s)(s2 + s − 2) = X(s) → + − 2w(t) = x(t)
dt2 dt
dw(t)
Y (s) = (s − 1)W (s) → y(t) = − w(t)
dt
The state variables are v1 (t) = ẇ(t) and v2 (t) = w(t). And so
      
v̇1 (t) −1 2 v1 (t) 1
= + x(t)
v̇2 (t) 1 0 v2 (t) 0
| {z } | {z }
A1 b1
 
  v1 (t)
y(t) = 1 −1
| {z } v2 (t)
cT
1

(c) Block diagram is shown in Fig. 6.7 (controller form)

R R
+

Figure 6.7: Problem 18: v1 (t) is output of first integrator, and v2 (t) the output of the second integrator.

(d) The matrices coincide with the controller form given by MATLAB.
% Pr 6_18
% State representation
num=[0 1 -1]
den=[1 1 -2]
[A,B,C,D]=tf2ss(num,den)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.21

num = 0 1 -1
den = 1 1 -2
A =
-1 2
1 0
B =
1
0
C =
1 -1
D =
0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.22

6.19 (a) Using the given state variables we have

v̇1 (t) = ẏ(t) = v2 (t) − v1 (t) + x(t)


v̇2 (t) = ÿ(t) + ẏ(t) − ẋ(t) = 2y(t) − x(t) = 2v1 (t) − x(t)

and y(t) = v1 (t). The state and output equations can be written using the following matrix and
vectors
   
−1 1 1
A2 = , b2 =
2 0 −1
T
 
c2 = 1 0

(b) The controller from before and the new observer realizations are shown in Fig. 6.8
y(t)
+
Controller

−1
� v1 (t) � v2 (t)
x(t) +

−1
2

Observer
x(t)

−1

� v2 (t) � v1 (t)
+ +
y(t)
2 −1

Figure 6.8: Problem 19

(c) A2 = AT1 , b2 = cT1 , and cT2 = bT1


(d) Yes, making the changes suggested we transform the diagram in part 1 into the diagram in part
2. The duality is due to the transpose which exchanges the order of the state variables, and by the
exchange of the b and c vectors due to the interchange of the input and the output.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.23

6.20 (a)(b) To find the transfer function let the input v(t) = δ(t), y(t) = h(t) and initial conditions equal
zero, then in the Laplace domain
  
1   s 1 1 s−1
H(s) = cTo (sI − Ao )−1 b = 2 1 0 = 2
s +s−2 2 s+1 −1 s +s−2
The denominator of H(s) is D(s) = s2 + s − 2 = (s − 1)(s + 2) is the determinant of sI − Ao , or
the characteristic equation. Notice the pole-zero cancellation so that the simplified transfer function is
H(s) = 1/(s + 2).

% Pr. 6_20
% Observer
Ao=[-1 1; 2 0]
bo=[1 ;-1]
co=[1 0]’
% Transfer function
[num,den]=ss2tf(Ao,bo,co’,0)
roots(den)
% Diagonalization
[V,D]=eigs(Ao)
A=(inv(V))*Ao*V
b=(inv(V))*bo
c=V’*co
[num,den]= ss2tf(A,b,c’,0)
roots(den)

Ao = -1 1
2 0
bo = 1
-1
co = 1
0
num = 0 1.0000 -1.0000
den = 1 1 -2
ans = -2
1
V =-0.7071 -0.4472
0.7071 -0.8944
D = -2 0
0 1
A = -2.0000 0.0000
0 1.0000
b = -1.4142
0
c = -0.7071
-0.4472
num = 0 1 -1
den = 1 1 -2
ans =-2
1

Showing that the two realizations correspond to the same transfer function.
(c)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.24

%Controller
Ac=Ao’
bc=co’
cc=bo’
[V,D]=eigs(Ao)
A=(inv(V))*Ao*V
b=(inv(V))*bo
c=V’*co
[num,den]= ss2tf(A,b,c’,0)
roots(den)

Ac = -1 2
1 0
bc = 1 0
cc =1 -1
V =-0.7071 -0.4472
0.7071 -0.8944
D =-2 0
0 1
A =-2.0000 0.0000
0 1.0000
b =-1.4142
0
c =-0.7071
-0.4472
num = 0 1 -1
den =1 1 -2
ans =-2
1

Again showing that the two realizations correspond to the same transfer function and that the observer
and the controller forms represent the same system.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.25

6.21 The characteristic function corresponding to this realization is


 
s + 2 −1
det(sI − Ao ) = det = s2 + 2s + 1 = (s + 1)2
1 s
i.e., we have a double pole at s = −1. The transfer function in this case is
  
1   s 1 1 s−1
H(s) = cTo (sI − Ao )−1 b = 1 0 =
(s + 1)2 −1 s + 2 −1 (s + 1)2
% Pr 6_21
%multiple poles
Ao=[-2 1; -1 0]
bo=[1 ;-1]
co=[1 0]’
[num,den]= ss2tf(Ao,bo,co’,0)
roots(den)

Ao =

-2 1
-1 0

bo =

1
-1

co =

1
0

num = 0 1.0000 -1.0000

den = 1.0000 2.0000 1.0000

ans =
-1.0000 + 0.0000i
-1.0000 - 0.0000i

To obtain the minimal realization let


Y (s) W (s) 1
H(s) = = (s − 1)
W (s) X(s) (s + 1)2
so that we get
y(t) = ẇ(t) − w(t)
ẅ(t) + 2ẇ(t) + w(t) = x(t)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 6.26

which provide the necessary equations for the minimal realization. A block diagram is shown in Fig. 6.9.

R R
+

Figure 6.9: Problem 21

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 7

Fourier Analysis in Communications


and Filtering

7.1 Basic Problems


7.1 (a) By voltage division

Vo (s) 1 1
H(s) = = =
Vi (s) 1 + RCs 1 + s/100

(b) If km = 104 and kf = 102 the values of Rn and Cn are unity. The normalized transfer function is
T (S) = 1/(S + 1).
(c) Notice that
1 1
H(s) = =
1 + (km Rn )(Cn /(km kf ))s 1 + (s/kf )
1
= = T (S) for S = s/kf = s/100
1+S
If s = jΩ then S = jΩ/100 so that H(jΩ) = T (jΩ/100), so that the frequency response H(jΩ0 )
is exactly the same as that of T (jΩ0 /100), i.e., when the frequency scale is divided by 100.

1
Chaparro — Signals and Systems using MATLAB 7.2

7.2 (a) The dc gain is |H(j0)| = 1.


The poles are s1,2 = e±j3π/4 , and no zeros. The magnitude response corresponds to that of a
low-pass filter with dc gain of 1, flat in the low-frequencies and decaying as Ω increases.
(b) Magnitude squared response
1
|H(jΩ)|2 =
(1 − Ω2 )2 + 2Ω2

has maximum when the denominator has a minimum that satisfies


d[(1 − Ω2 )2 + 2Ω2 ]
=0 ⇒ − 4(1 − Ω2 )Ω + 4Ω = 0, or Ω3 = 0
dΩ
i.e., the maximum magnitude response occurs at Ω = 0.
(c) Yes, from the magnitude square function we have

|H(j1)|2 (1/2)
= = 1/2
|H(j0)|2 1

i.e., Ω = 1 is the half–power frequency.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.3

7.3 (a) Magnitude response



jΩ/Q |Ω/Q|
|H(jΩ)| = = p
−Ω + jΩ/Q + 1
2
(1 − Ω2 )2 + (Ω/Q)2

Ω |H(jΩ)|
0 0
1 1
∞ 0
It is a band-pass filter.
(b) The given transfer function can be written
BW s
H(s) =
s2 + BW s + 1
The half-power frequencies are frequencies that make

|H(jΩi )| |H(jΩi )| 1
= = √ , i = 1, 2
|H(j1)| 1 2
then for Ω1 and replacing 1 = Ω2 Ω1 , BW = 1/Q in the denominator,

BW 2 Ω21
|H(jΩ1 )|2 =
(Ω2 Ω1 − Ω21 )2 + BW 2 Ω21
BW 2 Ω21
=
Ω1 (Ω2 − Ω1 )2 + BW 2 Ω21
2

BW 2
=
(Ω2 − Ω1 )2 + BW 2
BW 2 1
= =
2BW 2 2
and similarly for Ω2 .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.4

7.4 (a) |H(j0)| = K|z1 |/|p1 | = 1, so K = |p1 |/|z1 |


(b) Low-pass, high-pass and all-pass can be obtained with this first-order system. Band-pass and stop-
band require second or higher-order systems, as poles must be complex conjugates.
(c) For the low-pass filter, |H1 (j0)| = 1, the half-power frequency Ωhp is such that

|H1 (jΩhp )|2 = |H1 (j0)|2 /2 = 1/2


1 1
2 =
Ωhp + 1 2

so Ωhp = 1.
(d) The filter with H2 (s) = (s − 1)/(s + 1) is an all-pass filter. Its pole is s = −1 and zero s = 1.
Given this symmetry the magnitude response is unity for all values of Ω.
(e) The filter with H3 (s) = s/(s + 1) is a high-pass filter, |H(j0)| = 0 and when Ω → ∞ the
magnitude response grows and becomes 1 at ∞.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.5

7.5 (a) The magnitude square of the filter is


1
|H(jΩ)|2 =
(1 − Ω ) + Ω2 /Q2
2 2
| {z }
D(Ω)

To maximize it, we equivalently minimize D(Ω) so


 
dD(Ω) 1
= 2(1 − Ω2 )(−2Ω) + 2Ω/Q2 = 2Ω 2(Ω2 − 1) + 2 = 0
dΩ Q

which gives as possible frequencies that minimize D(Ω)

Ω=0
p
Ω1,2 = ± 1 − 1/(2Q2 )

where the second possibility is limited to real frequencies so that 1 − 1/(2Q2 ) > 0 (zero is already
considered) or
1
Q > √ = 0.707
2
So the maximum magnitude response occurs at frequencies

0p when Q ≤ 0.707
1 − 1/(2Q2 ) when Q > 0.707

(b) When Q = 1/ 2 = 0.707 the magnitude-squared at Ω = 1 is
1 1
|H(j)|2 = =
1/Q2 2

so that Ω = 1 is the half-power frequency since |H(j0)| = 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.6

7.6 (a) Transfer function

Y (s) 1
H(s) = = 2
X(s) s + 2s + 1

Since H(s) has no zeros, the filter is a low-pass filter.


(b) If x(t) = 2u(t) then

2 2 A B C
Y (s) = H(s) = 2
= + +
s s(s + 1) s s + 1 (s + 1)2

where

A=2
C = −2
B = −2

so that
y(t) = 2u(t) − 2e−t (1 + t)u(t)
in the steady state, yss (t) = 2.
(c) If x1 (t) = 2[u(t) − u(t − 1)] then the filter output is

y1 (t) = y(t) − y(t − 1)


= 2u(t) − 2e−t (1 + t)u(t) − 2u(t − 1) − 2e−(t−1) (1 + t − 1)u(t − 1)
= 2[u(t) − u(t − 1)] − 2e−t [(1 + t)u(t) − e tu(t − 1)]

(d) The difference between the outputs and the inputs of the filter in the above cases is

y(t) − x(t) = −2e−t (1 + t)u(t)


y1 (t) − x1 (t) = −2e−t [(1 + t)u(t) − etu(t − 1)]

both of which tend to zero as t → ∞ and indicating that the responses eventually follow the input
exactly.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.7

7.7 (a) Ωc = 40π × 103 rad/sec.


(b) Figure 7.1(a) shows the conventional AM receiver. The filters are LTI but the demodulator is LTV. If
the ideal bandpass filter has a magnitude α, a center frequency Ωc and a bandwidth coinciding with that
of the message, its output is
p(t) = αm(t) cos(Ωc t)
and in frequency the output of the demodulator is

S(Ω) = 0.5 [P (Ω + Ωc ) + P (Ω − Ωc )]

Replacing
α
P (Ω) = [M (Ω + Ωc ) + M (Ω − Ωc )]
2
we get
α
S(Ω) = [2M (Ω) + M (Ω + 2Ωc ) + M (Ω − 2Ωc )]
4
When passing s(t) through an ideal lowpass filter with unit gain and bandwidth 2πBW (rad/sec) we get
as output (α/2)m(t) so that if α = 2 the output of the LP filter is m(t).
(c) When we interchange the demodulator and the BP filter, we have the BP and the LP in cascade which
being ideal do not overlap and so result in that the output y(t) is always zero independent of x(t) and
m(t).

cos(40π × 103 t)

r(t) p(t) s(t) m(t)


BP × LP (a)

cos(40π × 103 t)

r(t) x(t) y(t)


× BP LP (b)

4
1
f (KHz)
5 15 20 25
LP BP

Figure 7.1: Problem 7: possible AM receivers; BP, LP bandpass and lowpass ideal filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.8

7.8 (a) Using voltage division

Vc (s) 1/sC 1
= =
Vi (s) 1 + Ls + 1/Cs LCs2 + Cs + 1

which compared with the transfer function of the Butterworth filter gives

LC = 1

C= 2
√ √
so that C = 2 and L = 1/ 2.
(b) Again by voltage division

VR (s) 1 Cs 2s
= = 2
= √
Vi (s) 1 + Ls + 1/Cs LCs + Cs + 1 2
s + 2s + 1
This is a bandpass filter as it has s = 0 as a zero, so that for Ω = 0 this filter has zero magnitude, and as
frequency becomes infinity the frequency response is also zero.
(c) The transfer function would be

VLC (s) Ls + 1/Cs LCs2 + 1 s2 + 1


= = = √
Vi (s) 1 + Ls + 1/Cs LCs2 + Cs + 1 s2 + 2s + 1
which corresponds to a notch filter with a notch at Ω = 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.9

7.9 Using the loss function


 2N !
Ω Ω
α(Ω) = 10 log10 1+ ⇒ Ωhp =
Ωhp (100.1α(Ω) − 1)1/2N

which gives for Ω = 2000


2000
Ωhp = = 1280.9 rad/sec.
(101.94 − 1)0.1

When α(Ωp ) = αmax we have


Ωp = Ωhp (100.1αmax − 1)1/2N
which gives after replacing the values on the right term Ωp = 999.82 (rad/sec).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.10

7.2 Problems using MATLAB


7.10 (a) The difference between the two arguments of the cosines is
 
L1 − L0 π
2π(f0 − ν) =
c 2

which gives
c
L1 = L0 + = (10 + 38.5) × 103 = 48.5 × 103 meters
4(f0 − ν)

(b) The received signal can be written

r(t) = 1.9 cos(2π × 1950t − 2π × 0.065)

with period T1 = 1/1950 = 5.13 × 10−4 . The input signal is periodic of period T0 = 1/f0 = 1/2000 =
5 × 10−4 . The output of the channel has a different frequency than the input and as such it is not LTI.
(c) The following script computes and plots x(t) and r(t) sampled at the given rate Fs .

% Pr. 7_10
clear all; clf
Fs=10000; Ts=1/Fs;
t=0:Ts:(1999)*Ts;
f0=2000;nu=50;L0=10000;L1=48500;c=3*10ˆ8;
x=cos(2*pi*f0*t);
r=cos(2*pi*(f0-nu).*(t-L0/c))+0.9*cos(2*pi*(f0-nu).*(t-L1/c))
figure(1)
subplot(211)
plot(t(1:100),x(1:100));ylabel(’x(t)’);xlabel(’t’)
subplot(212)
plot(t(1:100),r(1:100));ylabel(’r(t)’);xlabel(’t’)

Input and output signals are shown in the left of Fig. 10. (d) The following script shows how to do the multipath
using parameters that change at random.

clear all;
Fs=10000; Ts=1/Fs;
t=0:Ts:(99)*Ts;
f0=2000;nu=50;L0=1000;L1=10000;c=3*10ˆ8;
figure(2)
for k=1:10,
eta=rand(1,1);
nuk=nu*eta;L0k=L0*eta;L1k=L1*eta;
alpha0=1-eta;alpha1=alpha0/10;
r=alpha0*cos(2*pi*(f0-nuk).*(t-L0k/c))+alpha1*cos(2*pi*(f0-nuk).*(t-L1k/c))
plot(t,r)
pause(0.1)
hold on
end
hold off
ylabel(’r(t)’);xlabel(’t’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.11

1 1

0.5 0.8

0.6
x(t)

−0.5 0.4

0.2
−1
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
t

r(t)
0

1.5
−0.2
1
−0.4
0.5
r(t)

0 −0.6
−0.5
−0.8
−1

−1.5 −1
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
t t

Figure 7.2: Problem 10: input and received signals (left); received signals affected by random parameters of
multipath (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.12

7.11 The following script is used in finding the answers in this problem.
% Pr 7_11
clear all; clf
alphamax=0.5 ;alphamin=30; Wp=1500; Ws=3500;
% Butterworth
D=(10ˆ(0.1*alphamin)-1)/(10ˆ(0.1*alphamax)-1);
E=Ws/Wp;
N=ceil(log10(D)/(2*log10(E)))
%Whp=Wp/(10ˆ(0.1*alphamax)-1)ˆ(1/(2*N))
Whp=Ws/(10ˆ(0.1*alphamin)-1)ˆ(1/(2*N))
alpha_p=10*log10(1+(Wp/Whp)ˆ(2*N))
alpha_s=10*log10(1+(Ws/Whp)ˆ(2*N))
% Chebyshev
N=ceil(acosh(Dˆ(0.5))/acosh(E))
eps=sqrt(10ˆ(0.1*alphamax)-1)
Whp1=Wp*cosh(acosh(1/eps)/N)
alpha_p= 10*log10(1+(epsˆ2)*(cos(N*acos(1)))ˆ2)
alpha_s=10*log10(1+(epsˆ2)*cosh(N*acosh(Ws/Wp))ˆ2)
%% Check with MATLAB
[N1,Whp1]=buttord(Wp,Ws,alphamax,alphamin,’s’)
[N2,Wn]=cheb1ord(Wp,Ws,alphamax,alphamin,’s’)

The orders and the half-power frequency (Butterworth) and the passband frequency (Chebyshev) are
verified using MATLAB functions buttord and cheb1ord.
(a) The lowpass Butterworth filter that satisfies the specifications is of minimum order Nb = 6, while
the corresponding Chebyshev filter has minimum order Nc = 4. Typically for the same specifications
Nc < Nb
(b) The half-power frequency of the designed Butterworth filter is Ωhp = 1787.4 (calculated so that the
loss α(Ωp ) = αmax ). Another possible value for which α(Ωs ) = αmin is Ωhp = 1968.4.
To compute the half-power frequency of the Chebyshev filter we need the ripple factor  which we find
to be 0.3493. We obtain Ωhp = 1639.7.
(c) For the designed Butterworth filter with the first value of Ωhp we get
α(Ωp ) = 0.5 dB
α(Ωs ) = 35.023 dB
and for the second half-power frequency
α(Ωp ) = 0.1635 dB
α(Ωs ) = 30 dB

The values of the loss function for the Chebyshev filter are
α(Ωp ) = 0.5 dB
α(Ωs ) = 36.65 dB
These values do not depend on the half–power frequency but rather on Ωp which is the normalized
frequency.
(d) The formulas for the order of the Butterworth and the Chebyshev filters depend on the ratio of Ωp
and Ωs , so the orders of the filters do not change.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.13

7.12 Since the dc loss is not zero, the normalized loss specifications are
αmax = α1 − α(0) = 0.5
αmin = α2 − α(0) = 30
with a dc loss of 20 dB. The following script is used to find the answers

% Pr 7_12
clear all; clf
alphamax=0.5 ;alphamin=30; Wp=1500; Ws=3500;
alpha0=20;
% Butterworth
K=10ˆ(alpha0/20)
D=(10ˆ(0.1*alphamin)-1)/(10ˆ(0.1*alphamax)-1);
E=Ws/Wp;
N=ceil(log10(D)/(2*log10(E)))
Whp=Wp/(10ˆ(0.1*alphamax)-1)ˆ(1/(2*N))
alpha_p=10*log10(1+(Wp/Whp)ˆ(2*N))
alpha_s=10*log10(1+(Ws/Whp)ˆ(2*N))
% Chebyshev
N=ceil(acosh(Dˆ(0.5))/acosh(E))
eps=sqrt(10ˆ(0.1*alphamax)-1)
Whp1=Wp*cosh(acosh(1/eps)/N)
alpha_p= 10*log10(1+(epsˆ2)*(cos(N*acos(1)))ˆ2)
alpha_s=10*log10(1+(epsˆ2)*cosh(N*acosh(Ws/Wp))ˆ2)
alpha1=alpha0+10*log10(1+(epsˆ2)*cosh(N*acosh(0))ˆ2);
Kc=10ˆ(alpha1/20)

The following are the results

% Butterworth
K = 10 % dc gain
N =6 % minimum order
Whp =1.7874e+03 % half-power frequency
alpha_p = 0.5000 % loss at Wp
alpha_s =35.0228 % loss at Ws
% Chebyshev
N = 4 % min order
eps = 0.3493 % ripple factor
Whp1 = 1.6397e+03 % half-power frq
alpha_p = 0.5000 % loss at Wp
alpha_s = 36.6472 % loss at Ws
Kc =10.5925 % dc gain

Notice the computation of the dc gain in the Chebyshev filter. In this case the dc loss depends on the
order of the filter and so it is not necessarily 0 dB, so to get the dc gain Kc we use
 
K2 2 2
α(0) = 10 log10 2 (0) = 20 log10 K − 10 log10 (1 +  CN (0))
1 + 2 C N
as indicated in the script.
(d) The minimum orders of the filters depend on the ratio of the two frequencies and since it remains the
same these do not change.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.14

7.13 (a)–(c) The following script is used to design the three filters. To get the Butterworth or the Chebyshev
filters get rid of the comments symbols in front of the corresponding functions.

% Pr 7_13
clear all; clf
alphamax=0.5; alphamin=20; Wp=1000;Ws=2000;
W=0:2500;
% Butterworth
[Nb,Whp]=buttord(Wp,Ws,alphamax,alphamin,’s’)
[b,a]=butter(Nb,Whp,’s’);
% Chebyshev 1
%[Nc,Wn]=cheb1ord(Wp,Ws,alphamax,alphamin,’s’)
%[b,a]=cheby1(Nc,alphamax,Wn,’s’)
% Elliptic
%[Ne,Wn]=ellipord(Wp,Ws,alphamax,alphamin,’s’)
%[b,a]=ellip(Ne,alphamax,alphamin,Wn,’s’)
H=freqs(b,a,W);
alpha=-20*log10(abs(H));
M=length(H);
alpha1=alphamax*ones(1,M);
alpha2=alphamin*ones(1,M);
Ang=unwrap(angle(H));
figure(1)
subplot(221)
plot(W,abs(H));grid;axis([0 2500 0 1.1]);ylabel(’|H|’);xlabel(’\Omega’)
subplot(222)
plot(W,Ang);axis([0 2500 1.1*min(Ang) 1.1*max(Ang)]);grid
ylabel(’<H’);xlabel(’\Omega’)
subplot(223)
splane(b,a)
subplot(224)
plot(W,alpha); axis([0 2500 1.1*min(alpha) 1.1*max(alpha)])
ylabel(’\alpha(\Omega)’);xlabel(’\Omega’)
hold on
plot(W,alpha1,’r’)
hold on
plot(W,alpha2,’r’)
hold off
grid

The order of the three filters decreases from the Butterworth to the Chebyshev to the elliptic. The mag-
nitude frequency responses are equally good and the phase responses are approximately linear in the
passband.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.15

0 0
1 1
−1 −1
0.8 −2 0.8 −2
0.6 −3 0.6 −3

<H

<H
|H|

|H|
−4 −4
0.4 0.4
−5
0.2 0.2 −5
−6
−6
0 0
0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500
Ω Ω Ω Ω

1000
1000 30 40
25 500
500 30
20
α(Ω)

α(Ω)
0 0
jΩ

jΩ
15 20
−500 10
−500 10
5
−1000
0 −1000
−1000 −500 0 0 500 1000 1500 2000 2500 −400 −300 −200 −100 0 0 500 1000 1500 2000 2500
σ Ω σ Ω

0
1

0.8 −1

0.6 −2
|H|

<H
0.4
−3
0.2
−4
0
0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500
Ω Ω

1500

1000 80

500 60
α(Ω)

0
jΩ

40
−500

−1000 20

−1500 0
−600 −400 −200 0 0 500 1000 1500 2000 2500
σ Ω

Figure 7.3: Problem 13: frequency response, poles/zeros and loss functions of Butterworth, Chebyshev (top)
and elliptic (bottom) filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.16

7.14 (a) The Chebyshev low-pass filter is designed using the following script:

%% Pr 7_14
clear all; clf
alphamax=0.1; alphamin=60; Wp=1000;Ws=2000;
W=0:2500;
% Chebyshev 1
[Nc,Wn]=cheb1ord(Wp,Ws,alphamax,alphamin,’s’)
[b,a]=cheby1(Nc,alphamax,Wn,’s’)
H=freqs(b,a,W);
alpha=-20*log10(abs(H));
M=length(H);
alpha1=alphamax*ones(1,M);
alpha2=alphamin*ones(1,M);
alpha3=3*ones(1,M);
Ang=unwrap(angle(H));
figure(1)
subplot(221)
plot(W,abs(H));grid;axis([0 2500 0 1.1]); ylabel(’|H|’);xlabel(’\Omega’)
subplot(222)
plot(W,Ang);axis([0 2500 1.1*min(Ang) 1.1*max(Ang)])
ylabel(’<H’);xlabel(’\Omega’)
subplot(223)
splane(b,a)
subplot(224)
plot(W,alpha); axis([0 2500 1.1*min(alpha) max(alpha)])
ylabel(’\alpha(\Omega)’);xlabel(’\Omega’)
hold on
plot(W,alpha1,’r’)
hold on
plot(W,alpha2,’r’)
hold on
plot(W,alpha3,’g’)
hold off
grid
eps=sqrt(10ˆ(0.1*alphamax)-1)
Whp1=Wp*cosh(acosh(1/eps)/Nc)

(b) The half-power frequency is computed by finding first the ripple factor as shown in the following
script that follows the above script (i.e., it uses the necessary values computed before).

eps=sqrt(10ˆ(0.1*alphamax)-1)
Whp1=Wp*cosh(acosh(1/eps)/Nc)

The value obtained is Ωhp = 1051.9 (rad/sec). In the above script an additional line, corresponding to
the 3 db, is used to determine approximately this value.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.17

0
1
−2
0.8 −4
0.6 −6

|H|

<H
0.4 −8
−10
0.2
−12
0
0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500
Ω Ω

1000
80

500
60

α(Ω)
0
jΩ

40

−500 20

−1000
−300 −200 −100 0 0 500 1000 1500 2000 2500
σ Ω

Figure 7.4: Problem 14: Chebyshev low-pass: frequency response, poles/zeros, and loss.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.18

7.15 The following script is used to compute the different signals, filters, and to plot them.

% Pr 7_15
clear all; clf
syms t w
x=cos(100*pi*t)-2*cos(50*pi*t);
y=x+cos(120*pi*t);
figure(1)
subplot(211)
ezplot(x,[0:1]) % desired signal
subplot(212)
ezplot(y,[0:1]) % signal with hum
X=fourier(x);
% butterworth filter
N=5;
%wn=[2*pi*59.9 2*pi*60.1]; [b,a]=butter(N,wn,’stop’,’s’);C=1 % band-eliminating
% [b,a]=butter(2*N,110*pi,’high’,’s’);C=2 % high-pass
[b,a]=butter(N,[20*pi 90*pi],’s’);C=2 % band-pass
% frequency responses
W=0:1:150*pi;
Hm=abs(freqs(b,a,W));
figure(2)
subplot(211)
plot(W/(2*pi),Hm); axis([0 75 0 1.1]);xlabel(’f (Hz)’); ylabel(’|H|’)
M=2*N
% generation of frequency response from coefficients
n=M:-1:0;
U=(j*w).ˆn;
num=b*conj(U’); den=a*conj(U’);
H=num/den; % Butterworth LPF
% output of filter
Y1=X*H;
y1=real(ifourier(Y1,t));
subplot(212)
if C==1,
ezplot(y1,[0:1])
else
ezplot(x-y1,[0:1])
end
title(’denoised signal’)

The most natural of the three approaches is the one using the stopband filter, the other depend on infor-
mation on the desired signal that might or might not be available. The only needed information for the
stopband filter is the frequency of the hum.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.19

cos(100 π t)−2 cos(50 π t)

−1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


t

cos(100 π t)−2 cos(50 π t)+cos(120 π t)

4
3
2
1
0
−1
−2

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


t

1 1 1

0.8 0.8 0.8


0.6 0.6 0.6
|H|

|H|

|H|
0.4 0.4 0.4

0.2 0.2 0.2

0 0 0
0 10 20 30 40 50 60 70 0 10 20 30 40 50 60 70 0 10 20 30 40 50 60 70
f (Hz) f (Hz) f (Hz)
denoised signal denoised signal denoised signal
3
3 1
2 2
0
1 1
0 0 −1

−1 −1
−2
−2
−2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
t t t

Figure 7.5: Problem 15: top: original and original with hum signals; bottom left to right: notch filter and
filtered signal, high-pass filter and denoised signal, an bandpass filter and denoised signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.20

7.16 % Pr 7_16
clear all; clf
%% signal generation
Ts=5/512;t1=0:Ts:1-Ts;t2=1:Ts:2-Ts;t3=2:Ts:5;M=length(t3);t=[t1 t2 t3];
x1=[t1 2-t2 zeros(1,512-length(t1)-length(t2))];
x2=[ones(1,200) zeros(1,512-200)];
[X1,W]=AFT(x1,Ts);
[X2,W]=AFT(x2,Ts);

%% low-pass filtering to get m1 and m2


N=10;whp=10;
[b,a]=butter(N,whp,’s’); % low-pass filter
H=freqs(b,a,W);
Z1=H.*X1;
[m1,t]=AIFT(Z1,Ts);
Z2=H.*X2;
[m2,t]=AIFT(Z2,Ts);

figure(1)
subplot(221)
plot(t,x1); title(’triangular pulse x_1(t)’);axis([0 5 -0.1 1.2]);grid
subplot(222)
plot(W,abs(X1));axis([-40 40 -0.1 1.5]); title(’spectrum |X_1|’);grid
hold on
plot(W,abs(H),’r’)
hold off
subplot(223)
plot(t,x2); title(’rectangular pulse x_2(t)’);axis([0 5 -0.1 1.2]);grid
subplot(224)
plot(W,abs(X2));axis([-40 40 -0.1 2.5]); title(’spectrum |X_2|’);grid
hold on
plot(W,abs(H),’r’)
hold off

figure(2)
subplot(221)
plot(t,m1); title(’message m_1(t)’);axis([0 5 -0.1 1.2]);grid
subplot(222)
plot(t,m2); title(’message m_2(t)’);axis([0 5 -0.5 1.2]);grid
subplot(223)
plot(W,abs(Z1));axis([-20 20 -0.1 1.5]);title(’|M_1|’); grid
subplot(224)
plot(W,abs(Z2));axis([-20 20 -0.1 2.5]);title(’|M_1|’); grid

%% received signal
m11=m1.*cos(20*t);
m22=m2.*cos(100*t);
u=m11+m22;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.21

[U,W]=AFT(u,Ts);

%% bandpass filtering
Wn=[15,25];
[bb,aa]=butter(N,Wn,’s’) % bandpass filter
Hp=freqs(bb,aa,W);
M=Hp.*U;
[mhat,t]=AIFT(M,Ts);
figure(3)
subplot(221)
plot(W,abs(U));axis([-120 120 -0.1 1.5]);title(’Spectrum |U| of received signal and
hold on
plot(W,abs(Hp),’r’)
hold off
subplot(222)
plot(t,mhat); title(’output of BPF’);axis([0 5 -1.1 1.1]);grid

%% demodularion and LPF


y=mhat.*cos(20*t);
[Y1,W]=AFT(y,Ts);
subplot(223)
plot(W,abs(Y1));axis([-60 60 -0.1 1.2]); grid; title(’LPF of demodulated signal’)
hold on
plot(W,abs(H),’r’)
hold off
M=H.*Y1;
[m,t]=AIFT(M,Ts);
subplot(224)
plot(t,3*m);axis([0 5 -0.5 1.5]);grid; title(’ recovered m_1(t)’); % scaled by 3

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.22

triangular pulse x1(t) spectrum |X1| message m1(t) message m2(t)


1.5
1 1 1

0.8 1 0.8
0.5
0.6 0.6
0.4 0.5 0.4
0
0.2 0.2
0 0 0
−0.5
0 1 2 3 4 5 −40 −20 0 20 40 0 1 2 3 4 5 0 1 2 3 4 5

rectangular pulse x2(t) spectrum |X2| |M1| |M1|


2.5 1.5 2.5
1 2 2
0.8 1
1.5 1.5
0.6
0.4 1 1
0.5
0.2 0.5 0.5
0 0 0 0
0 1 2 3 4 5 −40 −20 0 20 40 −20 −10 0 10 20 −20 −10 0 10 20

Spectrum |U| of received signal and BPF output of BPF


1.5 1

1 0.5

0
0.5
−0.5

0 −1
−100 −50 0 50 100 0 1 2 3 4 5

LPF of demodulated signal recovered m1(t)


1.5
1
1
0.8
0.6 0.5
0.4
0.2 0
0
−0.5
−60 −40 −20 0 20 40 60 0 1 2 3 4 5

Figure 7.6: Problem 16: demodulation of AM signals.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.23

7.17 (a)
% Pr 7_17
clear all; clf
%% signal generation
Ts=5/512;t1=0:Ts:1-Ts;t2=1:Ts:2-Ts;t3=2:Ts:5;M=length(t3);t=[t1 t2 t3];
x1=[t1 2-t2 zeros(1,512-length(t1)-length(t2))];
x2=[ones(1,200) zeros(1,512-200)];
[X1,W]=AFT(x1,Ts);
[X2,W]=AFT(x2,Ts);

%% low-pass filtering to get m1 and m2


N=10;whp=10;
[b,a]=butter(N,whp,’s’); % low-pass filter
H=freqs(b,a,W);
Z1=H.*X1;
[m1,t]=AIFT(Z1,Ts);
Z2=H.*X2;
[m2,t]=AIFT(Z2,Ts);

figure(1)
subplot(221)
plot(t,x1); title(’triangular pulse x_1(t)’);axis([0 5 -0.1 1.2]);grid
subplot(222)
plot(W,abs(X1));axis([-40 40 -0.1 1.5]); title(’spectrum |X_1|’);grid
hold on
plot(W,abs(H),’r’)
hold off
subplot(223)
plot(t,x2); title(’rectangular pulse x_2(t)’);axis([0 5 -0.1 1.2]);grid
subplot(224)
plot(W,abs(X2));axis([-40 40 -0.1 2.5]); title(’spectrum |X_2|’);grid
hold on
plot(W,abs(H),’r’)
hold off

figure(2)
subplot(221)
plot(t,m1); title(’message m_1(t)’);axis([0 5 -0.1 1.2]);grid
subplot(222)
plot(t,m2); title(’message m_2(t)’);axis([0 5 -0.5 1.2]);grid
subplot(223)
plot(W,abs(Z1));axis([-20 20 -0.1 1.5]);title(’|M_1|’); grid
subplot(224)
plot(W,abs(Z2));axis([-20 20 -0.1 2.5]);title(’|M_1|’); grid

%% received signal
m11=m1.*cos(50*t);
m22=m2.*sin(50*t);
s=m11+m22;
[S,W]=AFT(s,Ts);

figure(3)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.24

subplot(221)
plot(W,abs(S));axis([-120 120 -0.1 1.5]);title(’Spectrum |S| of received signal’); grid

%% demodularion and LPF


y1=s.*cos(50*t);
y2=s.*sin(50*t);
[Y1,W]=AFT(y1,Ts);
[Y2,W]=AFT(y2,Ts);

subplot(222)
plot(W,abs(Y1));axis([-60 60 -0.1 1.2]); grid; title(’LPF of cos demodulated signal’)
hold on
plot(W,abs(H),’r’)
hold off
subplot(223)
plot(W,abs(Y2));axis([-60 60 -0.1 1.2]); grid; title(’LPF of sin demodulated signal’)
hold on
plot(W,abs(H),’r’)
hold off

M1=H.*Y1;
M2=H.*Y2;
[m1,t]=AIFT(M1,Ts);
[m2,t]=AIFT(M2,Ts);

subplot(224)
plot(t,m1);axis([0 5 -0.1 1]);grid; title(’ recovered m_1(t)’); hold on
plot(t,m2,’r’);axis([0 5 -0.1 1]);grid; title(’ recovered m_2(t)’); hold off
legend(’m_1(t)’,’m_2(t)’); grid

The following two functions are used too compute the direct and inverse Fourier transforms.

function [X,W] = AFT(x,Ts)


% Analog Fourier transform
% implemented using FFT
N=length(x);
X=fft(x)*Ts; W=[0:N-1]*2*pi/N-pi;W=W/Ts;
X=fftshift(X);

function [x,t] = AIFT(X,Ts)


% Analog Fourier transform
% implemented using FFT
N=length(X);

X=fftshift(X);
x=real(ifft(X))/Ts;t=[0:N-1]*Ts;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.25

triangular pulse x1(t) spectrum |X1| message m1(t) message m2(t)


1.5
1 1 1

0.8 1 0.8
0.5
0.6 0.6
0.4 0.5 0.4
0
0.2 0.2
0 0 0
−0.5
0 1 2 3 4 5 −40 −20 0 20 40 0 1 2 3 4 5 0 1 2 3 4 5

rectangular pulse x2(t) spectrum |X2| |M1| |M1|


2.5 1.5 2.5
1 2 2
0.8 1
1.5 1.5
0.6
0.4 1 1
0.5
0.2 0.5 0.5
0 0 0 0
0 1 2 3 4 5 −40 −20 0 20 40 −20 −10 0 10 20 −20 −10 0 10 20

Spectrum |S| of received signal LPF of cos demodulated signal


1.5
1
1 0.8
0.6
0.5 0.4
0.2
0 0
−100 −50 0 50 100 −60 −40 −20 0 20 40 60

LPF of sin demodulated signal recovered m2(t)


1
1 m1(t)
0.8
0.8 m2(t)
0.6
0.6
0.4
0.4
0.2 0.2

0 0
−60 −40 −20 0 20 40 60 0 1 2 3 4 5

Figure 7.7: Problem 17: demodulation of QAM signals.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 7.26

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 8

Sampling Theory

8.1 Basic Problems


8.1 (a) The maximum frequency in a speech signal is fmax = 5 kHz, so that its sampling frequency should
be
fs ≥ 2fmax = 10kHz or 10, 000 samples/sec
The number of samples in an hour of sampling speech is

Samples/hour ≥ 3, 600 sec/hour × 10, 000 samples/sec = 3.6 × 107 samples/hour

and the number of bits is

Bits/hour ≥ 3.6 × 107 samples/hour × 8 bits/sample = 288 × 106 bits/hour

(b) Since fmax = 22 kHz can be considered the maximum frequency in a music signal, then the sampling
frequency should be
fs ≥ 2fmax = 44 kHz
(c) We need to use the higher of the above sampling frequencies to accommodate both signals, so fs ≥ 44
kHz. If fs does not satisfy the Nyquist condition it would cause aliasing, and the signal will sound
distorted.

1
Chaparro — Signals and Systems using MATLAB 8.2

8.2 (a) To find X(Ω), we use duality or find the inverse Fourier transform of a pulse of amplitude A and
bandwidth Ω0 , that is
X(Ω) = A[u(Ω + Ω0 ) − u(Ω − Ω0 )]
so that
Z Ω0
1 A jΩt Ω0
x(t) = AejΩt dΩ = e −Ω0
2π −Ω0 2πjt
A
= sin(Ω0 t)
πt
which when compared with the given x(t) = sin(t)/t gives that A = π and Ω0 = 1 or

X(Ω) = π[u(Ω + 1) − u(Ω − 1)]

indicating that x(t) is band-limited with a maximum frequency Ωmax = 1 (rad/sec).


(b) To sample without aliasing the sampling frequency should be chosen to be
1 Ωmax
fs = ≥2
Ts 2π
which gives a sampling period
π
Ts ≤ = π sec/sample
Ωmax
(c) The spectrum of y(t) = x2 (t) is the convolution in the frequency
1
Y (Ω) = (X(Ω) ∗ X(Ω))

which would have a maximum frequency Ωmax = 2, giving a sampling frequency which is double the
one for x(t). The sampling period for y(t) should be
π
Ts ≤ .
2
(d) The signal x(t) = sin(t)/t is zero whenever t = ±kπ, for k = 1, 2, · · · so that choosing Ts = π (the
Nyquist sampling period) we obtain the desired signal xs (0) = 1 and x(nTs ) = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.3

8.3 (a) The Fourier transform is

X(Ω) = 2π[u(Ω + 0.5) − u(Ω − 0.5)]

x(t) is clearly band-limited with Ωmax = 0.5 (rad/sec).


(b) According to the Nyquist sampling rate condition, we should have that

Ωs = ≥ 2Ωmax
Ts
or the sampling period
π
Ts ≤ = 2π
Ωmax
The given value satisfies the Nyquist sampling rate condition so we can sample the signal with no alias-
ing. The given sampling period is the Nyquist sampling period.
Plotting the sinc function it can be seen that it is zero at values of 0.5t = ±πk or t = ±2πk for an integer
k. The sampled signal using Ts = 2π is

sin(0.5 2πn) sin(πn)


x(nTs ) = =
0.5n 2π πn
which is 1 for n = 0, and 0 for any other value of n.
(c) It seems the signal cannot be reconstructed from the samples, that frequency aliasing has occurred.
Ideally, that is not the case. The spectrum of the sampled signal xs (t) for Ts = 2π (Ωs = 1) is
∞ ∞
1 X 1 X
Xs (Ω) = X(Ω − kΩs ) = X(Ω − k) = 1
Ts 2π
k=−∞ k=−∞

Passing this signal through an ideal low-pass filter with amplitude 2π and cut-off frequency Ωs /2 = 1/2
the reconstructed signal, the output of this filter, is the inverse Fourier transform of a pulse in frequency,
i.e., a sinc function, that coincides with the original signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.4

8.4 (a) X(Ω) = ejΩ + e−jΩ = 2 cos(Ω) which has no maximum frequency, so x(t) is not bandlimited.
(b) Y (Ω) = X(Ω)H(jΩ) = 2 cos(Ω)[u(Ω + 1) − u(Ω − 1)] with maximum frequency of 1 and so
y(t) is band-limited.
(c) It is not time limited, as
Z 1 Z 1
1 jΩt 1
y(t) = 2 cos(Ω)e dΩ = [ejΩ(t+1) + ejΩ(t−1) ]dΩ
2π −1 2π −1
sin(t + 1) sin(t − 1)
= +
π(t + 1) π(t − 1)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.5

8.5 (a) Inverse Fourier transform


Z 1
1 sin(t)
x(t) = ejΩt dΩ =
2π −1 πt

of infinite support in time but finite support in frequency.


(b) y(t) = (x ∗ x)(t) then Y (Ω) = X(Ω)X(Ω) = X(Ω) so that y(t) = x(t)
(c) 2πfmax = 1 then fs ≥ 2fmax = 1/π so Ts ≤ π.
(d) If Ts = π we get samples

1/π n=0
x(nTs ) =
sin(nπ)/(nπ 2 ) = 0 n =
6 0

Ts = π barely satisfies Nyquist.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.6

8.6 (a) The Fourier transform of x(t) is

X(Ω) = 0.5M (Ω − Ωc ) + 0.5M (Ω + Ωc )

where M (Ω) is the Fourier transform of m(t). The maximum frequency present in x(t) is

Ωmax = Ωc + 2π × 22 × 103 = 2π(10 + 22)103 = 64π 103

(b) The sampling frequency is



Ωs = ≥ 2 × 64π × 103 = 128π × 103
Ts
so that
1
Ts ≤ 10−3 sec/sample
64
(c) The bandwidth of the message is B = 2π × 22 × 103 = 44π × 103 rad/sec, using this frequency x(t)
can be sampled at 2B = 88π × 103 rad/sec which is much smaller than the one found above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.7

8.7 (a) If the signal x(t) is band-limited y(t) = x2 (t) has a Fourier transform Y (Ω) = (1/2π)(X(Ω)∗X(Ω))
having a bandwidth double that of x(t), or

Ωmax y = 2ΩM = 4000π

so y(t) is band-limited.
(b) Filtering with a low-pass filter of cut-off frequency 5000π would not change the maximum frequency
of Y (Ω) so that
π 1
Ts ≤ = = 0.25 × 10−3
4000π 4000
(c) No. For x(t),
π
Ts1 ≤ = 0.5 × 10−3
2000π
and if Ts = 0.25 × 10−3 then Ts1 ≤ 2Ts , so that we need to use Ts to sample both x(t) and y(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.8

8.8 (a) The maximum frequency of s(t) is fmax = 12 × 103 Hz thus according to Nyquist fs ≥ 2fmax =
24 × 103 Hz.
(b) The different spectra are shown in Fig. 8.1. By the modulation property the sampler shifts the
spectrum of s(t) up and down to center frequencies 10m (in kHz) for m = 0, ±1, ±2, · · · giving
the spectrum Ss (f ) in Fig. 8.1. If we filter the sampled signal with a low-pass filter of magnitude
Ts = 1/fs = 10−4 and bandwidth 2 kHz we recover the original message.

M (f )
1

f (kHz)
−2 2

S(f )
1/2

f (kHz)
−12 −8 8 10 12

Ss (f )
1/Ts
··· ···
f (kHz)
−12 −8 −2 2 8 10 12

s(t) ss (t)
LPF
fs1 = 10 kHz

Figure 8.1: Problem 8

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.9

8.9 (a) If F(cos(t)) = X(Ω), then F(x2 (t)) = (X ∗ X)(Ω)/(2π), i.e., the convolution of X(Ω) with
itself, having twice the bandwidth of X(Ω), so the maximum frequency of x(t) is Ωmax = 2, and
Ts ≤ π/2. Thus x(t) is band-limited with twice the maximum frequency of cos(t).
Using cos2 (t) = 0.5(1 + cos(2t)) we see that its maximum frequency is 2 and it is band-limited
and Ts ≤ π/2.
(b) In general F(xN (t)) would be N convolutions of X(Ω) with itself, and the bandwidth being
N ×bandwith of cos(t), i.e., N , so the maximum frequency is Ωmax = N and Ts ≤ π/N .
If N = 3 , cos3 (t) = 0.25(3 cos(t) + cos(3t)) with Ωmax = 3, and Ts ≤ π/3.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.10

8.10 (a) If Ts = 1 then



Ωs = ≥ 2Ωmax
Ts
or Ωmax ≤ π. To reconstruct the original signal we choose the cutoff frequency of the ideal low-pass
filter to be
Ωmax < Ωc < 2π − Ωmax
and the magnitude Ts = 1.
( b) Since Ts ≤ π/Ωmax , and Ts = 1 then Ωmax ≤ π. If Ωmax = π for an ideal low-pass filter, then
Ωc = π to recover the original signal. Thus the maximum frequency has to be smaller than π to make it
possible to use an ideal or a non-ideal low-pass filter to recover the original signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.11

8.11 (a) x(t) is not band-limited as the maximum frequency of x(t) is infinite, although the Fourier series
coefficients make the contribution of high frequencies very small.
(b) Total power

X p ∞
X 2
Px = ( 0.5|k| )2 = 2 0.5k − 1 = −1=3
1 − 0.5
k=−∞ k=0

(c) The power of the approximating signal is


N
X p N
X 2(1 − 0.5N +1 )
Px̂ = ( 0.5|k| )2 = 2 0.5k − 1 = − 1 = 4(1 − 0.5N +1 ) − 1
1 − 0.5
k=−N k=0

Letting Px̂ = 0.9Px = 2.7 we have

2.7 = 4(1 − 0.5N +1 ) − 1


 
N +1 3.7 log(1 − 3.7/4)
0.5 =1− ⇒ N= −1 =3
4 log(0.5)

where we chose an integer larger than the argument of d.e.


(d) The maximum frequency of x̂(t) is N Ω0 = N = 3 as Ω0 = 1, and thus Ts ≤ π/3 is a sampling
period that can be used to avoid aliasing when sampling x̂(t) with it, and minimizes the aliasing
effect when used to sample x(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.12

8.12 (a) The sample values for Ts = 0.5 are


nTs x(nTs )
0 cos(0) = 1
0.5 cos(π/2) = 0
1.0 cos(π) = −1
1.5 cos(3π/2) = 0
2.0 cos(2π) = 1

x(nTs ) = 0 nTs > 2.


The binary code for nTs = 0, 0.5, 1, 1.5, 2, 2.5 · · · is

01 00 10 00 01 00 · · ·

corresponding to the quantized signal

x̂(nTs ) = ∆δ(nTs ) + 0δ((n − 1)Ts ) − 2∆δ((n − 2)Ts ) + 0δ((n − 3)Ts ) + ∆δ((n − 4)Ts )

where ∆ = 2/4 = 0.5, so that the quantization error is

ε(nTs ) = x(nTs ) − x̂(nTs )


= 0.5δ(nTs ) + 0δ((n − 1)Ts ) + 0δ((n − 2)Ts ) + 0δ((n − 3)Ts ) + 0.5δ((n − 4)Ts )

(b) The sample values for Ts = 0.25 are


nTs x(nTs )
0 cos(0) = 1
0.25 cos(π/4) = 0.707
0.5 cos(π/2) = 0
0.75 cos(3π/4) = −0.707
1.0 cos(π) = −1
1.25 cos(5π/4) = −0.707
1.5 cos(3π/2) = 0
1.75 cos(7π/4) = 0.707
2.0 cos(2π) = 1
The binary code for nTs = 0, 0.25, · · · , 1.75, 2., 2.25, · · ·

01 01 00 11 10 11 00 01 01 00, · · ·

corresponding to the quantized signal

x̂(nTs ) = ∆δ(nTs ) + ∆δ((n − 1)Ts ) + 0δ((n − 1)Ts ) − ∆δ((n − 3)Ts )


−2∆δ((n − 4)Ts ) − ∆δ((n − 5)Ts ) − 0δ((n − 6)Ts ) + ∆δ((n − 7)Ts )
+∆δ((n − 7)Ts )

where as before ∆ = 0.5, so that the quantization error is

ε(nTs ) = 0.5δ(nTs ) + 0.207δ((n − 1)Ts ) + 0δ((n − 2)Ts ) − 0.207δ((n − 3)Ts )


+0δ((n − 4)Ts ) − 0.207δ((n − 5)Ts ) + 0δ((n − 6)Ts ) + 0.207δ((n − 7)Ts )
+0.5δ((n − 8)Ts )

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.13

8.13 (a) For x(t) to be sampled without aliasing we need Ωs > 2Ωmax = 2.
(b) If y(t) = x2 (t) then Y (Ω) = [X ∗ X](Ω)/(2π) which gives a triangular spectrum in [−2 2]
frequency band, i.e., it is band-limited.
(c) The maximum frequency of z(t) is Ωmax = 2 (rad/sec) so Ωs ≥ 4 (rad/sec) and Ts ≤ π/2 sec.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.14

8.14 (a) The samples of the sampled signals are obtained by letting t = nTs

x1 (0.5n) = cos(πn)
x2 (0.5n) = cos(πn + 4πn) = cos(πn)

which coincide. The sampling period for x1 (t) should be T1s ≤ π/Ωmax = 1/2 for no aliasing.
For x2 (t) we would need a sampling period T2s ≤ π/Ωmax = 1/6 < T1s thus aliasing occurs
when we sample x2 (t) with T1s .
(b) We want
x2 (0.5n) = cos(πn + 0.5φn) = x1 (0.5n) = cos(πn)
which is obtained by letting 0.5φ = 2πk, for an integer k 6= 0, i.e.,

φ = 4πk, k = ±1, ±2, · · ·

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.15

8.15 (a) The sampling frequency is Ωs = 4π then Ts = 0.5 sec/sample.


(b) The spectrum of x(t) is
X(Ω) = r(Ω + π) − 2r(Ω) + r(Ω − π)
where r(.) is the ramp function. By duality, we have that if z(t) = r(t + π) − 2r(t) + r(t − π) its
Fourier transform is
esπ − 2 + e−sπ
Z(Ω) = Z(s)|s=jΩ = |s=jΩ
s2
1 − cos(πΩ) sin2 (πΩ/2)
= 2 = 4
Ω2 Ω2
 2
sin(πΩ/2)
=
Ω/2

then
Z(t) ⇔ 2πz(−Ω) = 2πz(Ω)
so that  2
Z(t) 1 sin(πt/2)
x(t) = =
2π 2π t/2
(c) An ideal low-pass filter of dc gain Ts = 1/2 and bandwidth π < B < 3π.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.16

8.2 Problems using MATLAB


8.16 (a) Because both of these signals have finite time support they are not band-limited, their support in
frequency is infinite. For x(t), its Fourier transform is
1 1 −jΩ/2 sin(Ω/2) −jΩ/2
X(Ω) = (1 − e−s )|s=jΩ = e 2j sin(Ω/2) = e
s jΩ Ω/2
For y(t) we have that
dy(t)
= u(t) − 2u(t − 1) + u(t − 2) = x(t) − x(t − 1)
dt
so that
1 −s s 2 −jΩ 4 −jΩ 2
jΩY (Ω) = e (e − 2 + e−s ) |s=jΩ = e (cos(Ω) − 1) = e sin (Ω/2)
s jΩ jΩ
using − sin2 (θ) = 12 (cos(2θ) − 1). So that
 2
−jΩ sin(Ω/2)
Y (Ω) = e = X 2 (Ω)
Ω/2

(b) The energy of x(t) is unity (the area under |x(t)|2 ), i.e., Ex = 1. According to Parseval, 90% of the
energy of x(t) is within the frequency band [−Ω0 , Ω0 ] or
Z Ω0
1
0.9 = |X(Ω)|2 dΩ
2π −Ω0
Z Ω0
1 sin(Ω/2 2
= dΩ
2π −Ω0 Ω/2
Using MATLAB symbolic computation we find the integral
% Pr. 8_16
clear all; clf
syms x t X X1 Y Y1 w z
x=heaviside(t)-heaviside(t-1);
X=fourier(x);
X1=(abs(X))ˆ2;
figure(1)
subplot(211)
ezplot(x,[-1,2]);grid;axis([-1 2 -2 2])
subplot(212)
ezplot(X1,[-30,30]);grid;axis([-10 10 -0.25 1.25])
for k=1:70,
omega0=0.1*k;
z=int(X1,w,0,omega0);
zz(k)=subs(2*z)/(2*pi);
if zz(k)<=0.9,
omega0
else
return
end
end

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.17

This script gives that Ω0 = 5.3 (rad/sec) can be considered the maximum frequency in the sampling of
x(t).
For y(t), the energy is
Z 1
t3 1 2
Ey = 2 t2 dt = 2 |t=0 =
0 3 3
Ninety percent of the energy for this signal is in the frequency band [−Ω1 , Ω1 ] or
Z Ω1
2 1
0.9 = |X(Ω)|4 dΩ
3 2π −Ω1
Z Ω1
1 sin(Ω/2 4
=
2π Ω/2 dΩ
−Ω1

because |Y (Ω)| = |X(Ω)|2 .


Again, we use MATLAB symbolic computation to find the value of Ω1 .

y=t*(heaviside(t)-heaviside(t-1))+(2-t)*(heaviside(t-1)-heaviside(t-2));
Y=Xˆ2
Y1=(abs(Y))ˆ2;
figure(2)
subplot(211)
ezplot(y,[-1,2]);grid;axis([-1 2 -2 2])
subplot(212)
ezplot(Y1);grid;axis([-5 5 -0.25 1.25])

for m=1:35,
omega1=m*0.1;
v=int(Y1,w,0,omega1);
zz(m)=subs(2*v)/(2*pi);
if zz(m)<=0.6,
omega1
else
return
end
end

This script gives that Ω1 = 2.6 (rad/sec) < Ω0 can be used as a good approximation to the maximum
frequency of y(t).
(c) The signal y(t) is smoother than x(t) (this signal displays higher frequencies than y(t)) so that we
expect that Ωmax y < Ωmax x . Accordingly the sampling period Tsy to sample without aliasing y(t) is
larger than the one required to sample x(t). If we choose as maximum frequencies the values Ω0 and
Ω1 for the signals x(t) and y(t) we calculated above, we should have that Ω0 > Ω1 and choosing the
Nyquist sampling periods (the values that give an equality in the Nyquist sampling rate condition)
π π
Tsy = > = Tsx
Ω1 Ω0

Thus aliasing would be caused by using Tsy to sample x(t).


(d) On the other hand, Tsx would be appropriate to sample x(t) as well as y(t).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.18

heaviside(t)−heaviside(t−1) t (heaviside(t)−heaviside(t−1))+(2−t) (heaviside(t−1)−heaviside(t−2))


2 2

1 1

0 0

−1 −1

−2 −2
−1 −0.5 0 0.5 1 1.5 2 −1 −0.5 0 0.5 1 1.5 2
t t
abs((−1+exp(−i w))/w)2 16/w2 sin(1/2 w)2 exp(−i w) conj(1/w2 sin(1/2 w)2 exp(−i w))

1 1

0.5 0.5

0 0

−10 −8 −6 −4 −2 0 2 4 6 8 10 −5 −4 −3 −2 −1 0 1 2 3 4 5
w w

Figure 8.2: Problem 16. Left: x(t) and |X(Ω)|2 . Right: y(t) and |Y (Ω)|2 .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.19

8.17 (a) For the Gaussian signal we notice that the signal and its spectrum look very similar, and that the
spectrum is narrower that the signal. For x1 (t), we notice that it has discontinuities and its spectrum has
high frequencies because of them. See Figs. 8.3 and 8.4.
(b) Computing ∆(t) and ∆(Ω) we verify the uncertainty bound. It is 1 for the Gaussian signal (the only
signal that will give this value) and 1.2197 for the square pulse x1 (t). You need to make some simple
changes to the script for x1 (t), the script shown is for the Gaussian signal.

% Pr. 8_17
clear all; clf
syms x t X X1 w z
sigma=1
%x=heaviside(t+sigma)-heaviside(t-sigma);
x=exp(-tˆ2/(2*sigmaˆ2));
X=fourier(x,w);
XX=X*conj(X);

figure(1)
subplot(211)
ezplot(x,[-4*sigma,4*sigma]);grid;
subplot(212)
ezplot(XX,[-4*sigma,4*sigma]);grid;

Ex=int(xˆ2,t,-4*sigma,4*sigma)

figure(2)
subplot(211)
ezplot((xˆ2)*(tˆ2)/Ex,[-4*sigma,4*sigma]);grid;
subplot(212)
ezplot(XX*(wˆ2)/Ex,[-4*sigma,4*sigma]);grid;
z=int((xˆ2)*(tˆ2),t, -4*sigma, 4*sigma)/Ex
zz=subs(sqrt(z)) % Delta(t)
v=int((Xˆ2)*(wˆ2)/(2*pi),w, -4*sigma,4*sigma)/Ex
vv=subs(sqrt(v)) % Delta(W)
2*zz*vv

1/exp(t2/2) t2/(π1/2 erf(4) exp(t2))


1 0.2
0.8
0.15
0.6
0.1
0.4

0.2 0.05

0 0
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
t t

(2 π)/(exp(w2/2) exp(conj(w)2/2)) (2 π1/2 w2)/(erf(4) exp(w2/2) exp(conj(w)2/2))

6
5 1
4
3
0.5
2
1
0 0
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
w w
Figure 8.3: Problem 17: Gaussian signal x(t) and its spectrum (both are real) (left); integrands used to
calculate ∆(t) and ∆(Ω) (right)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.20
heaviside(t + 1) − heaviside(t − 1) (t2 (heaviside(t − 1) − heaviside(t + 1))2)/2
0.8
1

0.8 0.6

0.6 0.4
0.4
0.2
0.2

0 0

−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
t t

((cos(w) i − sin(w))/w − (cos(w) i + sin(w))/w) ((cos(conj(w)) i − sin(conj(w)))/conj(w) − (cos(conj(w)) i + sin(conj(w)))/conj (w2 ((cos(w) i − sin(w))/w − (cos(w) i + sin(w))/w) ((cos(conj(w)) i − sin(conj(w)))/conj(w) − (cos(conj(w)) i + sin(conj(w)))/conj

4 2

3 1.5

2 1

1 0.5

0 0

−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
w w
Figure 8.4: Problem 17: Rectangular pulse x1 (t) and its spectrum (left); integrands used to calculate ∆(t)
and ∆(Ω) (right

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.21

8.18 (a) The Fourier transform is


2 2
X(Ω) = |s=jΩ =
1 − s2 1 + Ω2

x(t) is not band-limited, the frequency support of X(Ω) is infinite.


(b) The energy of the signal is

Z ∞
e−2t ∞
Ex = 2 e−2t dt = 2 | =1
0 −2 0

thus 99% of the energy in the frequency domain is

Z
1 Ω0 2 2
0.99 =
2π 1 + Ω2 dΩ
−Ω0

for some value of Ω0 which can be obtained using the following script:

% Pr. 8_18
clear all; clf
syms x t X X1 w v
x=exp(-abs(t));
X=fourier(x);
X1=X*conj(X);
figure(1)
subplot(211)
ezplot(x,[-10,10]);grid;axis([-10 10 -0.2 1.2])
subplot(212)
ezplot(X1,[-5, 5]);grid;axis([-5 5 -0.2 4.2])

for m=1:34,
omega1=m*0.1;
v=int(X1,w,0,omega1);
zz(m)=subs(2*v)/(2*pi);
if zz(m)<=.9900,
zz(m)
omega1
else
m
end
end

The maximum frequency is found to be 3.3 (rad/sec).


(c) For a sampling frequency Ωs = 5Ω0 = 16.5 the sampling period would be Ts = 2π/Ωs =
2π/16.5 = 0.3808 sec/sample.
(d) Looking at the spectrum |X(Ω)|, an anti-aliasing filter would be an ideal low-pass filter with a mag-
nitude of 1 and a cut-off frequency Ωc = Ω0 = 3.3 (rad/sec).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.22

1/exp(abs(t))

1
0.8
0.6
0.4
0.2
0
−0.2
−10 −8 −6 −4 −2 0 2 4 6 8 10
t
2 2
4/((w + 1) (conj(w) + 1))
4

0
−5 −4 −3 −2 −1 0 1 2 3 4 5
w

Figure 8.5: Problem 18: signal x(t) and |X(Ω)|2 .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.23

8.19 (a)–(c) The sampled signal is given as


x(nTs ) = x[n] = 0.8 cos(2πn 0.025) + 0.15 0 ≤ n ≤ 40
The following script performs the sampling, quantization and coding.
% Pr 8_19
clear all; clf
% analog signal
t=0:0.025:1; x=0.8*cos(2*pi*t)+0.15;
% sampled signal
Ts=0.025; N=length(t); n=0:N-1;
xs=0.8*cos(2*pi*n*Ts)+0.15;
figure(1)
subplot(211)
plot(t,x)
hold on
% quantized signal
Q=2; % quantization levels is 2Q
[d,y,e]=quantizer(x,Q);
stem(t,y)
hold off
subplot(212)
stem(t,e)
% binary signal
z=coder(y,d)

0.5
x(t),xs(nTs),xq

−0.5

−1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0.5

0.4

0.3
e(nTs)

0.2

0.1

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
nTs

Figure 8.6: Problem 19: original signal with discrete signal and quantized signal superposed. Quantization
error.

The functions used are given below.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 8.24

function [d,y,e]=quantizer(x,Q)
% Input: x, signal to be quantized at 2Q levels
% Outputs: y quantized signal
% e, quantization error
% d quantum
% USE [d,y,e]=quantizer(x,Q)
%
N=length(x);
d=max(abs(x))/Q;
for k=1:N,
if x(k)>=0,
y(k)=floor(x(k)/d)*d;
else
y(k)=-(floor(abs(x(k))/d)*d+d);
end
if y(k)==2*d,
y(k)=d;
end
end
e=x-y;

function z1=coder(y,delta)
% Coder for 4-level quantizer
% input: y quantized signal
% output: z1 binary sequence
% USE z1=coder(y)
%
z1=’00’; % starting code
N=length(y);
for n=1:N,
y(n)
if y(n)== delta
z=’01’;C
elseif y(n)==0
z=’00’;
elseif y(n)== -delta
z=’11’;
else
z=’10’;
end
z1=[z1 z];
end
M=length(z1);
z1=z1(3:M) % get rid of starting code

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 9

Discrete–time Signals and Systems

9.1 Basic Problems

9.1 See Fig. 9.1 for some of the answers.


Expressing x[n] = δ[n + 1] + δ[n] + δ[n − 1] + 0.5δ[n − 2] we then have
(a) x[n − 1] is x[n] delayed by 1 (shifted right 1 sample); x[−n] is the reflection of x[n], and x[−n + 2]
is x[n] reflected and shifted right by 2 samples, or x[−n + 2] = 0.5δ[−n] + δ[−n + 1] + δ[−n + 2] +
δ[−n + 3] = 0.5δ[n] + δ[n − 1] + δ[n − 2] + δ[n − 3] because δ[n] is even.
(b)(c) Even


 1 n = −1, 0, 1
xe [n] = 0.5(x[n] + x[−n]) 0.25 n = −2, 2

0 otherwise

and the odd component is


 −0.25 n = −2
xo [n] = 0.5(x[n] − x[−n]) 0.25 n=2

0 otherwise

1
Chaparro — Signals and Systems using MATLAB 9.2

x[n]
1
0.5

xe [n]
1
0.25
n

xo [n]
0.25
n

−0.25
x[−n + 2]
1
0.5
n

Figure 9.1: Problem 1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.3

9.2 (a) The discrete frequency of x[n] is


2π × 7
ω0 = 0.7π =
20
so that the fundamental period is N0 = 20 and m = 7.
(b) x(t)|t=nTs = x(nTs ) = cos(πnTs ), so Ts = 0.7 sec/sample, and the sampling frequency Ωs =
2π/Ts = π × (20/7) rad/sec which satisfies Nyquist since Ωmax = π rad/sec. i.e., Ωs > 2Ωmax .
The discrete–time signal here coincides with the one given above.
(c) To make cos(πnTs ) look like cos(πt) we need to divide its fundamental period into large number
of points, e.g., the fundamental period of x(t) is T0 = 2, letting Ts = T0 /N for N ≥ 2 would
satisfy Nyquist but also would provide a discrete signal that looks like the analog signal when N is
large. For instance, in this case Ts ≤ 1 so that Ts = 1 (N = 2) and Ts = 0.1 (N = 20) both satisfy
Nyquist but the latter one gives a signal that looks like the analog signal while the other does not.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.4

9.3 (a) The discrete frequency for the given signals are

(i) x[n] : ω0 = π = ⇒ periodic with period N0 = 2
2
2πm
(ii) y[n] : ω0 = 1 6= , not periodic
N0
(iii) z[n] : not periodic, as y[n] is not periodic
3π 2π
(iv) v[n] : ω0 = = 3, ⇒ periodic with period N0 = 4
2 4

(b) x1 [n] is periodic of fundamental period N1 = 4, and y1 [n] is periodic of fundamental period
N2 = 6 so that
N1 4 2
= =
N2 6 3
then the sum z1 [n] = x1 [n] + y1 [n] is periodic of period 3N1 = 2N2 = 12, i.e., three periods of
x1 [n] fit in 2 of y1 [n].
Similarly, v1 [n] is periodic of period 12. Indeed,

v1 [n + 12] = x1 [n + 12]y1 [n + 12] = x1 [n]y1 [n]

since 12 is three times the period of x1 [n] and two times the period of y1 [n].
The compressed signal w1 [n] = x1 [2n] has period N1 /2 = 2:

w1 [n + 2] = x1 [2(n + 2)] = x1 [2n + 4] = x1 [2n] = w1 [n]

since x1 [2n] is periodic of period 2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.5

9.4 (a) x[n] = ej(n/8−1) = cos(n/8 − 1) + j sin(n/8 − 1) so ω0 = 1/8 which cannot be expressed as
2πm/N0 for non-divisible integers m and N0 . So x[n] is not periodic.
x1 [n] has a discrete frequency ω1 = π/8 = 2π/16 so it is periodic with fundamental period
N1 = 16.
(b) i. ω1 = π/5 = 2π/10 and ω2 = π/10 = 2π/20 so that N1 = 10 and N2 = 20 are the
fundamental periods of the two components of the signal. Since N1 /N2 = 1/2 then 2N1 =
N2 = 20 is the fundamental period of x[n] and the fundamental frequency is 2π/20 = 0.1π.
ii. The power of x[n] is
19
1 X 2
Px = x [n]
20 n=0

x2 [n] = (cos(πn/5) + sin(πn/10))2


= cos2 (πn/5) + 2 cos(πn/5) sin(πn/10) + sin2 (πn/10)

since
2 cos(πn/5) sin(πn/10) = sin(3πn/10) − sin(πn/10)
then
19
X 19
X
2 cos(πn/5) sin(πn/10) = (sin(3πn/10) − sin(πn/10)) = 0 + 0 = 0
n=0 n=0

because we are adding the values over periods of the sinusoids. Thus
19 19 19
1 X 2 1 X 2 1 X 2
Px = x [n] = cos (πn/5) + sin (πn/10) = Px1 + Px2
20 n=0 20 n=0 20 n=0

where x1 [n] = cos(πn/5) and x2 [n] = sin(πn/10).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.6

9.5 (a) Energy of x[n]


10
X 10 × 11 × 21
εx = n2 = = 385
n=0
6
Using the formula
N
X N (N + 1)(2N + 1)
k2 =
6
k=1

(b) Calling p[n] = u[n] − u[n − 11] so x[n] = r[n]p[n] we have

xe [n] = 0.5(r[n]p[n] + r[−n]p[−n])


xo [n] = 0.5(r[n]p[n] − r[−n]p[−n])

The energy

X
εx = (xe [n] + xo [n])2
n=−∞
X∞
= x2e [n] + x2o [n] + 2xe [n]xo [n]
n=−∞
X∞ ∞
X
= x2e [n] + x2o [n]
n=−∞ n=−∞

since xe [n]xo [n] is odd its sum is zero. Also from plots of xe [n] and xo [n] we have that

X10 X10
n2
εx = 4 = n2 = 385
n=0
4 n=0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.7

9.6 (a) i. If input is x[n] the output is y[n] = x[n]x[n − 1], if input is αx[n], α 6= 1, the output is
α2 x[n]x[n − 1] 6= αx[n]x[n − 1] so system is non-linear.
If input is x[n] the output is y[n] = x[n]x[n − 1], and if input is x[n − 1] the output is
x[n − 1]x[n − 2] = y[n − 1] so system is time-invariant.
ii. Causal, y[n] depends on present and past inputs and it is zero when the input is zero. Moreover,
when x[n] = 0 then y[n] = 0.
If x[n] is bounded for all n, then |x[n]| < M and |x[n − 1]| < M and |y[n]| = |x[n]||x[n −
1]| < M 2 , so bounded. Yes, BIBO stable.
Indeed, if x[n] = u[n] then
Non-linearity:

x[n] = u[n] ⇒ y[n] = u[n]u[n − 1] = u[n − 1]


x1 [n] = 2u[n] ⇒ y1 [n] = 4u[n − 1] 6= 2u[n − 1]

Time-invariance

x[n] = u[n] ⇒ y[n] = u[n − 1]


x1 [n] = u[n − 1] ⇒ y1 [n] = u[n − 2] = y[n − 1]

(b) i. No, it is a modulation system as such LTV.


ii. Expressing x[n] = cos(2πn/8) its fundamental period is N0 = 8. We have

y[n + 8] = x[n + 8] cos((n + 8)/4) = x[n] cos(n/4 + 2) 6= y[n]

since 2 cannot be expressed in terms of π, so y[n] is not periodic. It will also be true for any
multiple of 8.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.8

9.7 (a) Yes, the quantizer is time-invariant. Indeed, x(nTs ) and x(nTs − M Ts ) will give the same values
just shifted in time. In this case the M must be an integer as the sampled signal is discrete in time.
(b) The samples are given by x(nTs ) = nTs = 0.1n. For ∆ = 0.25 the sample x[1] = 0.1 when
quantized gives x̂[1] = 0 since 0 < 0.1 < ∆. If we multiply the signal by 3 so that the value 3x[1] = 0.3
would give x̂[1] = 1 since ∆ < 0.3 < 2∆. Since the second output is not the first output multiplied by
3, the quantizer is not linear.
We saw before that the sampler is linear but time-varying, while the quantizer is time-invariant but non-
linear, so the A/D converter which is composed of these systems is not LTI.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.9

9.8 (a) x[n] is periodic of fundamental period N0 = 4 and f [n] is periodic of fundamental period N1 = 7,
so y[n] is periodic of fundamental period N = 28.
(b) f [n] is a window of width 2 so that y[n] = x[n]f [n] = u[n](u[n] − u[n − 2]) = f [n] and if we
delay the input so that x1 [n] = x[n − 3], then y1 [n] = 0 6= y[n − 3] so the system is time-varying.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.10

Pn+4
9.9 (a) If input is αx[n], output is k=n−2 αx[k] = αy[n], so system is linear. If input is x1 [n] = x[n − 1]
the output is
n+4
X n+4
X
y1 [n] = x1 [k] = x[k − 1] let m = k − 1
k=n−2 k=n−2
n+3
X
= x[m] = y[n − 1]
m=n−3

so the system is time–invariant.


(b) Non–causal since output depends on future values of input:
n+4
X n
X n+4
X
y[n] = x[k] = x[k] + x[k]
k=n−2 k=n−2 k=n+1

If |x[n]| < M , i.e., bounded, then y[n] is bounded, indeed


n+4
X n+4
X
|y[n]| ≤ |x[k]| ≤ M = 7M
k=n−2 k=n−2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.11

9.10 (a) Impulse response: using the difference equation

h[n] = −0.5h[n − 1] + δ[n]

obtained when the input is δ[n] and the outputs is h[n] (no initial conditions) we have

h[n] = −0.5h[n − 1] + δ[n]


= −0.5(−0.5h[n − 2] + δ[n − 1]) + δ[n] = 0.52 h[n − 2] − 0.5δ[n − 1] + δ[n]
= 0.52 (−0.5h[n − 3] + δ[n − 2]) − 0.5δ[n − 1] + δ[n] = −0.53 h[n − 3]
+0.52 δ[n − 2]) − 0.5δ[n − 1] + δ[n]
..
.

indicating that h[n] = (−0.5)n u[n].


(b) Writing x[n] = δ[n] + δ[n − 1] + δ[n − 2] the output is

y[n] = h[n] + h[n − 1] + h[n − 2]


= (−0.5)n u[n] + (−0.5)n−1 nu[n − 1] + (−0.5)n−2 u[n − 2]

Recursive solution of the difference equation gives the same result.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.12

9.11 (a) The convolution integral gives

y(t) = r(t) − r(t − 2.5) − r(t − 3.5) + r(t − 6)

See Fig. 9.2

y(t)
h(t − τ ) x(τ )
1 1

τ t
t − 2.5 t 3.5 2.5 3.5 6

Figure 9.2: Problem 11(a)

(b) If we discretize both x[n] and h[n] with Ts = 0.5, i.e., t = 0.5n, we get

1 0 ≤ n2 ≤ 3.5 or 0 ≤ n ≤ 7
x[n] =
0 otherwise

1 0 ≤ n2 ≤ 2.5 or 0 ≤ n ≤ 5
h[n] =
0 otherwise

The convolution sum gives




 n+1 0≤n≤5

6 n = 6, 7
y[n] =

 6 − (n − 7) 8 ≤ n ≤ 12

0 otherwise

Thus y[n]/6 approximates the continuous convolution. Notice that the length of the convolution is
length x[n]+ length of h[n] = 8 + 6 − 1 = 13.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.13

9.12 (a) Moving averages

y[2] = (0.9 + 1.2 + 1)/3 = 1.03


y[3] = (0.7 + 0.9 + 1.2)/3 = 0.93
y[4] = (1.2 + 0.7 + 0.9)/3 = 0.93
y[5] = (1 + 1.2 + 0.7)/3 = 0.97

(b) Impulse response of averager

h[n] = (1/3)(δ[n] + δ[n − 1] + δ[n − 2])

the convolution sum


n
X
y[n] = h[m]x[n − m]
m=0
2
X 1 1 1
y[2] = h[m]x[2 − m] = 0.9 + 1.2 + 1
m=0
3 3 3
2
X 1 1 1
y[3] = h[m]x[3 − m] = 0.7 + 0.9 + 1.2
m=0
3 3 3
2
X 1 1 1
y[4] = h[m]x[4 − m] = 1.2 + 0.7 + 0.9
m=0
3 3 3
2
X 1 1 1
y[5] = h[m]x[5 − m] = 1 + 1.2 + 0.7
m=0
3 3 3

The results are the same as before.


(c) Median

ym [2] = median[0.9, 1.2, 1] = 1


ym [3] = median[0.7, 0.9, 1.2] = 0.9
ym [4] = median[1.2, 0.7, 0.9] = 0.9
ym [5] = median[1, 1.2, 0.7] = 1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.14

9.13 Discretization of differential equation:

y(nT + T ) − y(nT ) x(nT + T ) − x(nT )


+ y(nT ) = 2x(nT ) +
T T
⇒ y((n + 1)T ) = (1 − T )y(nT ) + (2T − 1)x(nT ) + x((n + 1)T )

and letting m = n + 1 we get

y(mT ) = (1 − T )y((m − 1)T ) + (2T − 1)x((m − 1)T ) + x(mT )

Figure 9.3 shows the block diagram when T = 1.

x[n] x[n − 1]
D
y[n]
+

Figure 9.3: Problem 13: block diagram of difference equation when T = 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.15

9.14 (a) We have

e[n] = x[n] − y[n − 1], y[n] = 2e[n − 1] = 2x[n − 1] − 2y[n − 2]


⇒ y[n] + 2y[n − 2] = 2x[n − 1]

(b) The impulse response is found by letting x[n] = δ[n], IC zero, and y[n] = h[n]. Recursively,

h[n] = −2h[n − 2] + 2δ[n − 1]


h[0] = 0, h[1] = 2, h[2] = 0, h[3] = −4, h[4] = 0, h[5] = 8, · · ·

or h[n] = 2(−2)(n−1)/2 , n odd, 0 otherwise, which grows as n increases, so it is not absolutely


summable, i.e., system is not BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.16

9.15 (a) x[n] = δ[n] + δ[n − 1] + δ[n − 2] and y[n] = δ[n − 1] + δ[n − 2] + δ[n − 3], and

length (y[n]) = length (x[n]) + length (h[n]) − 1.


Thus length of h[n] is 3 − 3 + 1 = 1.
(b) Since the input is x[n] = δ[n] + δ[n − 1] + δ[n − 2] the output is y[n] = h[n] + h[n − 1] + h[n − 2]
but also y[n] = δ[n − 1] + δ[n − 2] + δ[n − 3] so that

y[0] = 0 = h[0]
y[1] = 1 = h[1] + h[0]
y[2] = 1 = h[2] + h[1] + h[0]
y[3] = 1 = h[3] + h[2] + h[1]

solving for the impulse response values we get h[0] = 0, h[1] = 1 − h[0] = 1 and the rest of the
values are zero. Thus the length of h[n] is 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.17

9.16 (a) Since δ[n] = u[n] − u[n − 1] using the LTI of the system

h[n] = s[n] − s[n − 1] = (3 − 3(0.5)n+1 )u[n] − (3 − 3(0.5)n )u[n − 1]

(b) i. We have

0.5 n = 0, 1, 2
0.5x[n] =
0 otherwise

0.5 n = 0, −1, −2
0.5x[−n] =
0 otherwise

 0.5 n = ±1, ± 2
y[n] = 1 n=0

0 otherwise

No, the system is not causal; y[n] depends on future values of the x[n], e.g., y[−1] = 0.5(x[−1]+
x[1]).
ii. The delayed input is x1 [n] = u[n − 1] − u[n − 4] and the corresponding output is

y1 [n] = 0.5(u[n − 1] − u[n − 4] + u[−n − 1] − u[−n − 4])


= 0.5(u[n + 4] − u[n + 1]) + 0.5(u[n − 1] − u[n − 4])

while y[n − 1] = 0.5δ[n + 1] + 0.5δ[n] + 1δ[n − 1] + 0.5δ[n − 2] + 0.5δ[n − 3] which are not
equal.
iii. Output is

y[n] = 0.5 cos(2πn/5)u[n] + 0.5 cos(−2πn/5)u[−n]



1 n=0
=
0.5 cos(2πn/5) n 6= 0

The output is not periodic, because y[0] = 1 does not repeat.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.18

9.17 (a) For N = 4 the length of the output y[n] = length of x[n]+ length h[n] − 1 = 5 + 4 − 1 = 8. For
N = 4, the convolution sum gives (see Fig. 9.4):

n y[n] n y[n]
0, 7 1 2, 5 3
1, 6 2 3, 4 4

0 otherwise.

3
y[n]

−1
−2 −1 0 1 2 3 4 5 6 7 8
n

Figure 9.4: Problem 17: convolution sum y[n] of x[n] and h[n]

(b) The values of the convolution sum


3
X
y[3] = h[k]x[3 − k] = x[3] + x[2] + x[1] + x[0] = 3
k=0
6
X
y[6] = h[k]x[6 − k] = x[6] + x[5] + x[4] + x[3] = 0
k=0

can be obtained by letting x[n] = u[n] − u[n − 3] so that the second summation is zero as x[n] = 0
for n ≥ 3 and h[n] = 0 for n ≥ 4, and the first summation is 3 given that x[3] = 0 and the other
terms are one.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.19

9.18 (a) Solving recursively the first difference equation y[n] = 0.5y[n − 1] + x[n], with x[n] = δ[n], IC
zero:
y[0] = δ[0] = 1
y[1] = 0.5 × 1 + 0 = 0.5
..
.
y[n] = 0.5n
For the second difference equation y[n] = 0.25y[n − 2] + 0.5x[n − 1] + x[n], with x[n] = δ[n], IC
zero:
y[0] = 0 + 0 + δ[0] = 1
y[1] = 0 + 0.5δ[0] + 0 = 0.5
y[2] = 0.25 + 0 + 0 = 0.52
..
.
y[n] = 0.5n
The second equation is obtained by replacing y[n − 1] = 0.5y[n − 2] + x[n − 1] (calculated by
changing n by n − 1 in the first difference equation) into the first equation.
(b) Replacing y[n − 1] = 0.5y[n − 2] + x[n − 1] we get the previous second equation, then replacing
y[n − 2] = 0.5y[n − 3] + x[n − 2] we get a new equation,
y[n] = 0.53 y[n − 3] + 0.52 x[n − 2] + 0.5x[n − 1] + x[n]
and repeating this process we finally obtain

X
y[n] = 0.5k x[n − k]
k=0

which is the convolution sum of h[n] = 0.5n u[n] (impulse response) and x[n] which coincides with
the response obtained above.
(c) For x[n] = u[n] − u[n − 11] the convolution sum is (do the convolution sum graphically to verify
these results)

 0P n<0
n k
y[n] = 0.5 0 ≤ n ≤ 10
 Pk=0 n k
k=n−10 0.5 n ≥ 11
For 0 ≤ n ≤ 10 we get
1 − 0.5n+1
y[n] = = 2(1 − 0.5n+1 )
1 − 0.5
for n ≥ 11, letting m = k − n + 10
10
X
y[n] = 0.5m+n−10 = 0.5n−10 × 2(1 − 0.511 )
m=0

As n → ∞ we get y[n] → 0.
(d) The maximum occurs at n = 10 when y[10] = 2(1 − 0.511 ).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.20

9.19 The convolution sum is


n
X
y[n] = x[m]h[n − m]
m=0
y[0] = x[0]h[0] = 1
y[1] = x[0]h[1] + x[1]h[0] = −1 + 1 = 0
y[2] = x[0]h[2] + x[1]h[1] + x[2]h[0] = 1 − 1 + 1 = 1
y[3] = x[0]h[3] + x[1]h[2] + x[2]h[1] + x[3]h[0] = −1 + 1 − 1 + 0 = −1
y[4] = x[0]h[4] + x[1]h[3] + x[2]h[2] + x[3]h[1] + x[4]h[0] = 1 − 1 + 1 + 0 + 0 = 1
y[n] = x[0]h[n] + x[1]h[n − 1] + x[2]h[n − 2] = (−1)n + (−1)n−1 + (−1)n−2 = (−1)n−2 n ≥ 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.21

9.20 Recursively,

c[1] = (1 − β)c[0] + α
c[2] = (1 − β)c[1] + α = (1 − β)2 c[0] + [(1 − β) + 1]α
c[3] = (1 − β)c[2] + α = (1 − β)3 c[0] + [(1 − β)2 + (1 − β) + 1]α
..
.
n−1
X
c[n] = (1 − β)n c[0] + α (1 − β)m
m=0
α(1 − (1 − β)n )
= (1 − β)n c[0] +
1−1+β
α
= (1 − β) c[0] + (1 − (1 − β)n )
n
β

for c[n] → α/β as n → ∞ then |1 − β| < 1 or 0 < β < 2, independent of c[0].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.22

9.21 (a) Using a change of variable m = n − k we have



X
y[n] = (m + 2) x[n − m]
m=0
| {z }
h[m]

so that h[n] = (n + 2)u[n] is the impulse response.


(b) If x[n] = u[n] then
n
X
y[n] = (n − k + 2)
k=0
Xn
= (m + 2)
m=0
n(n + 1)
= + 2(n + 1)
2
(n + 1)(n + 4)
=
2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.23

9.22 (a) The input-output equation can be written


−1
X N
X
1 1
y(nTs ) = x(nTs − kTs ) + x(nTs − kTs )
2N + 1 2N + 1
k=−N k=0
N
X X N
1 1
= x(nTs + mTs ) + x(nTs − kTs )
2N + 1 m=1 2N + 1
k=0

which requires future inputs, so this averager is non-causal.


(b) For N = 2 and x(nTs ) = δ(nTs ) then
2
1 X
h(nTs ) = δ(nTs − kTs )
5
k=−2

(c) The output is the convolution sum of x(nTs ) and h(nTs ) which gives

y(nTs ) = δ((n + 2)Ts ) + 2δ((n + 1)Ts ) + 3δ(nTs )


+3δ((n − 1)Ts ) + 3δ((n − 2)Ts ) + 2δ((n − 3)Ts ) + δ((n − 4)Ts ).

Notice that the length of y(nTs ) is the sum of the lengths of x(nTs ) and and of h(nTs ) minus 1, or
3 + 5 − 1 = 7.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.24

9.23 (a) If y1 [n] = (x1 ∗ h)[n] then

y[n] = y1 [n] − y1 [n − 2] + y1 [n − 4]

The convolution

y1 [n] = (x ∗ h)[n]
1
 1 n=0


2 n=1
=

 1 n=2

0 otherwise

then the output is 



1 n = 0, 6

2 n = 1, 5
y[n] =

 −2 n=3

0 otherwise

(b) If x[n] = δ[n] then the input to the second system is w[n] = h[n] = δ[n] + δ[n − 1] and

hT [n] = g[n] + g[n − 1]

For n ≥ 0 the values of g[n] are obtained using the above equation

hT [0] = g[0] + g[−1] = g[0] → g[0] = hT [0] = 1


hT [1] = g[1] + g[0] = g[1] + 1 → g[1] = hT [1] − 1 = −1
hT [2] = g[2] + g[1] = g[2] − 1 → g[2] = hT [2] + 1 = 1
hT [3] = g[3] + g[2] = g[3] + 1 → g[3] = hT [3] − 1 = 0
hT [4] = g[4] + g[3] = g[4] → g[4] = hT [4] = 0
.. ..
. .

or 
 1 n = 0, 2
g[n] = −1 n=1

0 otherwise

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.25

9.24 (a) According to the difference equation the output is

y[0] = −y[−1] + x[0] = 0 + 1 = 1


y[1] = −y[0] + x[1] = −1 + 1 = 0
y[2] = −y[1] + x[2] = 0 + 1 = 1
y[3] = −y[2] + x[3] = −1 + 0 = −1
y[4] = −y[3] = 1
..
.

or

y[n] = 0 n<0
y[0] = 1
y[1] = 0
y[n] = (−1)n n≥2

(b) By linearity and time-invariance since x1 [n] = x[n] + x[n − 3] then




 y[n] n ≤ 2

0 n=3
y1 [n] = y[n] + y[n − 3] =
 1
 n=4

0 n≥5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.26

9.25 (a) y[n] depends on a future value of the input x[n + 1] so the system is non-causal.
(b) This can be done in two equivalent ways:
(i) If x[n] is bounded, i.e., there is a value M such that |x[n]| < M < ∞, then

1 3M
|y[n]| ≤ (|x[n + 1]| + |x[n]| + |x[n − 1]|) ≤ =M ≤∞
3 3
or bounded, so that the system is BIBO stable.
(ii) System is BIBO stable if its impulse response is absolutely summable. If x[n] = δ[n] then
1
h[n] = (δ[n + 1] + δ[n] + δ[n − 1])
3
and X
|h[n]| = |h[−1]| + |h[0]| + |h[1]| = 1 < ∞
n

so the system is BIBO stable.


(c) The discrete-time signal is

2 cos(10n) when using Ts1 = 1
x[n] = 2 cos(10t)|t=nTsi =
2 cos(10πn) when using Ts2 = π

For Ts1 = 1, the frequency of x[n] is ω0 = 10 which cannot be expressed as 2πm/N for not
canceling integers m and N , so x[n] is then not periodic.
For Ts2 = π, the frequency of x[n] is
2πm 2π × 5
ω0 = 10π = =
N 1
so that x[n] in that case is periodic of period N = 1.
(d) y[n] is periodic as x[n], x[n + 1] and x[n − 1] are periodic of same period. The fundamental period
of y[n] is then N = 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.27

9.26 (a) The discrete frequency of x[n] is ω0 = π/2 which can be written as 2πm/N0 with m = 1, N0 = 4.
So x[n] is periodic of fundamental period N0 = 4.
(b) Since x[n − kN0 ] = x[n] for any integer k and the fundamental period N0 = 4, then taking
N = kN0 we will have that

z[n] = x[n − kN0 ]w[n] = x[n]w[n] = y[n]

so that delaying the input by a multiple of N0 does not change the output. The output in this case
is just the period of x[n] between 0 and 4. However, that is not so if the delay is different from a
multiple of the fundamental period, thus the system is time-varying.
(c) The output corresponding to x1 [n] = x[n]u[n] is

y1 [n] = x1 [n]w[n] = x[n]u[n]w[n] = x[n]w[n] = y[n]

obtained before. However, the output corresponding to x1 [n − 4] is

x1 [n − 4]w[n] = x[n − 4]u[n − 4]w[n] = x[0]w[4] = 4 sin(0)w[4] = 0

which is not the previous result shifted, so that the system is time-varying.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.28

9.27 (a) If x[n] = δ[n] then h[n] = δ[n] − δ[n − 5]. System is causal and BIBO stable.
(b) x[n] = u[n] = cos(0n)u[n] has infinite energy, and the corresponding output is y[n] = u[n] −
u[n − 5] having finite energy. Notice the output has a finite support, as when n > 5 then y[n] = 0.
(c) When x[n] = sin(2πn/5)u[n], then the output is

y[n] = x[n] − x[n − 5] = sin(2πn/5)u[n] − sin(2π(n − 5)/5)u[n − 5]


= sin(2πn/5)(u[n] − u[n − 5])

which again has finite support and y[n] = 0 for n > 5. The energy of the output is finite, while that
of the input is not.
(d) Since x[n] = (ejω0 n − e−jω0 n )u[n]/2j and the system is causal, linear and time invariant, consider
the response to ejω0 n u[n]. The convolution sum, or response to x1 [n] = ejω0 n u[n]/2j
n
X
y1 [n] = h[k]ejω0 (n−k) /(2j)
k=0

given that h[n] = δ[n] − δ[n − 5], or h[0] = 1, h[5] = −1 and the other values are zero, for n ≥ 5
we have
n
X
y1 [n] = h[k]ejω0 (n−k) /(2j) = ejω0 n (h[0] + h[5]e−j5ω0 )/(2j)
k=0
= ejω0 n
(1 − e−j5ω0 )/(2j)

which can be made zero by letting 1 − e−j5ω0 = 0 or for frequencies ω0 = 2πm/5 for m =
0, ±1, ±2, · · · . Similarly when the input is e−jω0 n u[n]. Thus for those frequencies the output is
of finite support, i.e., having finite energy. For any other frequencies the output is not zero after
n ≥ 5, and it is not guaranteed the finite support or the finite energy.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.29

9.28 (a) We have


i. You can only use (A), as it is causal. Filter (B) requires future inputs (for any negative k the
required input x[n − k] are in the future).

ii. You can use either, because causality is not needed, future values as well as present and past
values are available in the tape.
(b) We have
i. The impulse response of the IIR filter is found by solving the difference equation

h1 [n] = δ[n] − 0.5h1 [n − 1] n≥0

obtained by letting y1 [n] = h1 [n], x[n] = δ[n] and initial conditions equal to zero. Recursively
we obtain

h1 [0] = 1
h1 [1] = −0.5h1 [0] = −0.5
h1 [2] = −0.5h1 [1] = (−0.5)2
···

which gives in general h1 [n] = (−0.5)n u[n].


The impulse response of the FIR system is obtained by letting x[n] = δ[n] and y2 [n] = h2 [n]
so that
h2 [n] = δ[n] + 0.5δ[n − 1] + 3δ[n − 2] + δ[n − 5]
ii. The condition for BIBO stability of a LTI system is that its impulse response be absolutely
summable. The given IIR and FIR systems are LTI. The stability condition for the IIR system
is that the following sum converges

X
|h1 [n]| < ∞
n=0

It can be shown that this sum converges, i.e.,



X ∞
X 1
|(−0.5)n | = 0.5n = =2
n=0 n=0
1 − 0.5

therefore the IIR system is BIBO stable.


For the FIR, the stability condition is satisfied since we are adding a finite number of values.
Indeed,

X
|h2 [n]| = 1 + 0.5 + 3 + 1 < ∞
n=0

thus the FIR is BIBO stable.

iii. Because of the finite support of the impulse response of an FIR filter it is always absolutely
summable and therefore FIR filters are always BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.30

9.1.1 Problems using MATLAB


9.29 The equation
x[n] = x[n − 1] + x[n − 3] n≥3
with initial conditions x[0] = 0, x[1] = 1 and x[2] = 2 can be solved recursively for n ≥ 3 as follows

n=3 x[3] = x[2] + x[0] = 2


n=4 x[4] = x[3] + x[1] = 2 + 1 = 3
n=5 x[5] = x[4] + x[2] = 3 + 2 = 5
.. ..
. .

The following script obtains the recursive solution for 0 ≤ n ≤ 49

% Pr 9_29
clear all; clf
x(1)=0; x(2)=1; x(3)=2; % initial conditions
for m=4:50,
x(m)=x(m-1)+x(m-3);
end
n=0:49;
figure(1)
stem(n,x); title(’x[n]’); xlabel(’n’)
grid
7 x[n]
x 10
10

0
0 5 10 15 20 25 30 35 40 45 50
n

Figure 9.5: Problem 29.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.31

9.30 (a) The signal is computed and plotted with MATLAB using the following script:

% Pr 9_30
n=0:20;
x=[zeros(1,5) (0.5).ˆn]; N=length(x);
figure(1)
stem([-5 -4 -3 -2 -1 n],x); axis([-5 20 -0.1 1.1])

(b) To check if the signal is finite energy we need to compute the sum


X ∞
X
|x[n]|2 = 0.25n
n=0 n=0
1 4
= =
1 − 0.25 3

Thus, x[n] is a finite energy signal. To show that


X 1
αn = |α| < 1
n=0
1−α

we need to consider first that if |α| ≥ 1 the sum is infinite, so the condition on α. Second, that the above
expression is equivalent to

X ∞
X ∞
X
(1 − α) αn = αn − αn = 1
n=0 n=0 n=1

The third comment is that α can be complex as long as its magnitude is less than 1.
(c) The following script is used to compute the energy of the signal, numerically and symbolically. These
results coincide with the analytic results obtained in (b)

% energy
% numeric computation
Ex=x(1)ˆ2;
for m=2:N-1;
Ex=Ex+x(m)ˆ2;
end
Ex
% symbolic computation
syms k
symsum(0.5ˆ(2*k),0,Inf)

Ex = 1.3333

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.32

0.8

0.6

x[n]
0.4

0.2

−5 0 5 10 15 20
n

Figure 9.6: Problem 30: signal x[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.33

9.31 (a) The discrete-time signal is

x[n] = x(nTs ) = cos(3πTs n + π/4) = A cos(ω0 n + π/4)

so that its magnitude is A = 1 and its discrete frequency ω0 = 3πTs (rad).


(b) Any value for which
2πm
3πTs =
N
where m and N are non-divisible positive integers, or
2m
Ts =
3N
would make x(nTs ) periodic of period N . Suppose for instance that we let N = 2 and m = 1, then
Ts = 1/3 would satisfy the condition, giving x[n] = x(nTs ) = cos(3πn/3+π/4) = cos(2πn/2+π/4),
of fundamental period N = 2. If Ts = 1/π the frequency of x[n] is
2πm
ω0 = 3 6=
N
for integers m and N that are not multiples of each other. So x[n] is not periodic.
The following script shows the periodic and non–periodic signals when Ts = 1/3 and Ts = 1/π.

% Pr 9_31
clear all;clf
n=0:99;
x1=cos(pi*n+pi/4); % Ts=1/3, periodic of period N=2
x2=cos(3*n+pi/4); % Ts=1/pi, non-periodic
figure(1)
subplot(211)
stem(n,x1);ylabel(’x_1[n]’)
subplot(212)
stem(n,x2);ylabel(’x_2[n]’);xlabel(’n’)

0.5
x1[n]

−0.5

−1
0 10 20 30 40 50 60 70 80 90 100

0.5
x2[n]

−0.5

−1
0 10 20 30 40 50 60 70 80 90 100
n

Figure 9.7: Problem 31: periodic signal x1 [n] when Ts = 1/3 (top), non-periodic x2 [n] when Ts = 1/pi
(bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.34

9.32 The discrete-time signal obtained from sampling x(t) using Ts = 0.25 is

1 − 0.25n 0 ≤ 0.25n ≤ 1 or 0 ≤ n ≤ 4
x[n] =
0 otherwise
(a) The reflected signal x[−n] = 1 + 0.25n for −4 ≤ n ≤ 0 and zero otherwise.
(b) The signal x[n] is neither even nor odd, so its even component is
1
xe [n] = [x[n] + x[−n]]
2
which can be written as 
 (1 − 0.25n)/2 1≤n≤4
xe [n] = 1 n=0

(1 + 0.25n)/2 −4 ≤ n ≤ −1
The odd component of x[n] is given by
1
xo [n] = [x[n] − x[−n]]
2
which can be written as

 (1 − 0.25n)/2 1≤n≤4
xo [n] = 0 n=0

−(1 + 0.25n)/2 −4 ≤ n ≤ −1
The following script displays the different signals given above
% Pr 9_32
n=0:4;
x=1-0.25*n;x=[zeros(1,6) x zeros(1,2)]
n1=[-6:6];
figure(1)
subplot(221)
stem(n1,x);axis([-5 5 0 1.1]); grid
n=-4:0;
x1=fliplr(x);
n1=[-6:6];
subplot(222)
stem(n1,x1);axis([-5 5 0 1.1]);grid
xe=0.5*(x+x1);
subplot(223)
stem(n1,xe);axis([-5 5 0 1.1; grid
xo=0.5*(x-x1);
subplot(224)
stem(n1,xo);axis([-5 5 -0.6 0.6]); grid

Clearly adding the even and the odd components gives x[n].
(c) The energy of the signal x[n] can be written in terms of the energy of the even and the odd components.
Since x[n] = 0 for n < 0 then
4
X 4
X
x2 [n] = x2 [n]
n=0 n=−4
4
X
= [x2e [n] + x2o [n] + 2xe [n]xo [n]]
n=−4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.35

1 1

0.8 0.8
0.6 0.6

x1[n]
x[n]
0.4 0.4

0.2 0.2

0 0
−5 0 5 −5 0 5

0.6
1
0.4
0.8
0.2
0.6
xe[n]

xo[n]
0
0.4 −0.2
0.2 −0.4
0
−5 0 5 −5 0 5
n n

Figure 9.8: Problem 32: from top left clockwise: x[n], x1 [n] = x[−n], xo [n] and xe [n].

the last term is zero, given that the signal xe [n]xo [n] is odd and is being computed over −4 ≤ n ≤ 4. So
we have that
εx = εxe + εxo

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.36

9.33 (a) A period of a train of pulses is




 0 n<0

r[n] = 0.5n 0≤n≤2
x[n] = 0.5(r[n] − 2r[n − 2] + r[n − 4]) =

 r[n] − 2r[n − 2] = 0.5(4 − n) 2<n≤4

r[n] − 2r[n − 2] + r[n − 4] = 0 n>4

The following MATLAB script will generate x[n] for n ≥ 0 (it is zero before) and the periodic signal
y[n].

% Pr 9_33
x=zeros(1,5);
for m=1:3,
x(m)=m-1;
end
for m=3:5,
x(m)=4-(m-1)
end
x=x/2;
n=0:4;
figure(1)
subplot(211)
stem(n,x); axis([0 4 -0.1 1.1])
hold on; plot(n,x,’:r’); hold off; title(’x[n]’)

%x=[0 0.5 1 0.5 0] % another way to get the first period


y=[x x x x]; % four periods of y
N=length(y); n=0:N-1;
subplot(212)
stem(n,y); axis([0 N-1 -0.1 1.1])
hold on; plot(n,y,’:r’); hold off; title(’y[n]’); xlabel(’n’)
x[n]

0.8

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4

y[n]
1

0.8

0.6

0.4

0.2

0
0 2 4 6 8 10 12 14 16 18
n
Figure 9.9: Problem 33: One period, 4 periods of y[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.37

9.34 (a) For x[n] = cos(2πn/7) the down-sampled by 2 signal is


 

z[n] = x[2n] = cos 2n
7

both of which have the same period, N = 7, but the frequency of z[n] = x[2n], 4π/7, is twice that of
x[n]. Thus the signal x[2n] is x[n] compressed in time, but expanded in frequency. The following script
is used to compute and plot x[n] and z[n].

% Pr 9_34
% downsampling
n=0:49;
x=cos(2*pi*n/7);
z=cos(4*pi*n/7);
figure(1)
subplot(211)
stem(n,x);hold on
plot(n,x,’:r’);hold off;ylabel(’x[n]’)
subplot(212)
stem(n,z);hold on
plot(n,z,’:r’);hold off;ylabel(’z[n]’);xlabel(’n’)

(b) The up–sampling by 2 gives a signal y[n] = x[n/2] = cos(2πn/14) for n even (so that n/2 is an
integer), zero otherwise. It seems there is a frequency compression (for even n the frequency is half that
of the original) so that there should be a time expansion in y[n] when compared with x[n]. The following
script computes and plots x[n] and y[n]

% upsampling
y=zeros(1,50);
for m=0:2:49,
y(m+1)=x(m+1);
end
figure(2)
subplot(211)
stem(n,x);hold on
plot(n,x,’:r’);hold off;ylabel(’x[n]’)
subplot(212)
stem(n,y);hold on
plot(n,y,’:r’);hold off;ylabel(’y[n]’);xlabel(’n’)

(c) Sampling x(t) = cos(2πt) using a sampling period Ts gives x[n] = cos(2πTs n) so that Ts = 1/7.
To get z[n] from x(t) we double the sampling period, i.e.,
 

z[n] = x(t)|t=2nTs = cos 2n
7

The upsampled signal, however, cannot be obtained by decreasing the sampling period as it would give
samples where the zeros are. In this case, the resulting signal is the interpolated signal that can be shown
to result from low-pass filtering the up-sampled signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.38

1 1

0.5 0.5

x[n]

x[n]
0 0

−0.5 −0.5

−1 −1
0 5 10 15 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50

1 1

0.5 0.5
z[n]

y[n]
0 0

−0.5 −0.5

−1 −1
0 5 10 15 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50
n n

Figure 9.10: Problem 34: x[n] and z[n] (left); x[n] and y[n] (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.39

9.35 (a) The sampled signal is given by

x(nTs ) = x[n] = e−2n u[n] = (e−2 )n u[n]

which indicates that α = 1/e2 < 1. The following MATLAB script is used to compute and plot x[n]
using the exponential and using α.

% Pr 9_35
Ts=1;t=0:Ts:9;
x=exp(-2*t); alpha=exp(-2);
n=0:length(t)-1; x1=alpha.ˆn;
figure(1)
subplot(211)
plot(t,x,’r’); hold on; stem(t,x)
hold off; ylabel(’x(nTs)’);grid
subplot(212)
plot(t,x,’r’); hold on; stem(n,x1)
hold off; ylabel(’x[n]’); xlabel(’n’); grid

(b) The sum



X 1
|α|n = |α| < 1
n=0
1 − |α|

or e2 /(e2 − 1) is finite, so x[n] is absolutely summable.


(c) Given that αn > α2n , because α < 1, we then have that if x[n] is absolutely summable it is finite
energy. Indeed,
X∞
1 e4
(α2 )n = = <∞
n=0
1 − α2 e4 − 1

so the signal x[n] is finite energy.


1

0.8

0.6
x(nTs)

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9

0.8

0.6
x[n]

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9
n

Figure 9.11: Problem 35: x(nTs ) and x[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.40

9.36 (a) The condition is that


N1 K
=
N2 M
for non-divisible integers M and K, i.e., that this ratio be a rational number. Thus, M N1 = KN2 = N0
is the period of x[n] + y[n].
(b) The product z[n] = x[n]y[n] is periodic of period N0 , indeed
z[n + N0 ] = x[n + N0 ]y[n + N0 ] = x[n + M N1 ]y[n + KN2 ] = x[n]y[n].
(c) The ratio of the periods can be written in the gcd (greatest common factor) form as
N1 K gcd[N 1, N 2]
=
N2 M gcd[N 1, N 2]
where the integers K and M are not divisible by each other. In the given formula if we replace N1 =
K gcd[N 1, N 2] we obtain
K gcd[N 1, N 2]N2
= KN2
gcd[N 1, N 2]
which equals N0 , the period of the sum. Likewise if we replace N2 = M gcd[N 1, N 2] we obtain M N1
which is also N0 . The given formula gives the same period as the one obtained using the ratio of the
periods.

Indeed, if x[n] is periodic of period N1 = 3 and y[n] of period N2 = 2, the gcd[2, 3] = 1 so that
N0 = (3 × 2)/1 = 6
Likewise, N1 /N2 = 3/2 where 3 and 2 are not divisible by each other, so that N0 = 2N1 = 3N2 = 6.
When x[n] is periodic of period N1 = 4 and y[n] is periodic of period 12, the gcd[4, 12] = 4, the largest
divider of 4 and 12. The period is then
4 × 12
N0 = = 12.
4
Likewise,
N1 4 1 K
= = =
N2 12 3 M
so that N0 = 3 × 4 = 12 × 1 = 12.
(d) The following script generates the signals x[n] and y[n] of periods N1 = 3 and N2 = 7, and their sum
and products z[n] and v[n] which using the given formula are shown to be periodic of period N0 = 21.

% Pr 9_36
clear all; clf
n=0:49;N1=3;N2=7;
x=cos(2*pi*n/N1);y=1+sin(6*pi*n/N2);
z=x+y;
v=x.*y;
P=gcd(N1,N2);
N0=N1*N2/P
figure(1)
subplot(211)
stem(n,z); ylabel(’z[n]=x[n]+y[n]’);grid;xlabel(’n’)
subplot(212)
stem(n,v); ylabel(’v[n]=x[n]y[n]’);grid;xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.41

z[n]=x[n]+y[n]
1

−1
0 5 10 15 20 25 30 35 40 45 50
n

2
1.5

v[n]=x[n]y[n]
1
0.5
0
−0.5
−1
0 5 10 15 20 25 30 35 40 45 50
n

Figure 9.12: Problem 36: z[n] = x[n] + y[n] and v[n] = x[n]y[n] periodic of fundamental period N0 = 21.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.42

9.37 (a) The delays are found as the times it would take the signal to travel 2Ri , i = 1, 2, where Ri are the
radii of the two circles in the theater. Thus
2Ri
Ti =
343
thus

T1 = 2 × 17.15/343 = 0.10 sec


T2 = 2 × 34.30/343 = 0.20 sec

With a sampling period Ts this translates into N1 = T1 /Ts = 0.10/Ts samples and N2 = T2 /Ts =
0.20/Ts . The sampling frequency for handel is Fs = 8, 192 samples/second, so N1 = d0.1Fs e and
N2 = d0.2Fs e samples, where dρe is the integer larger than ρ and which in MATLAB is implemented
by the function ceil.

%% Pr 9_37
clear all; clf
load handel
N=ceil(Fs*1.5)
y1=y(1:N)’;
N1=ceil(0.1*Fs)
N2=ceil(0.2*Fs)
r=y(1:N)’+[zeros(1,N1) y(1:N-N1)’]+[zeros(1,N2) y(1:N-N2)’];
n=0:N-1;
figure(1)
subplot(211)
plot(n,y1);axis([0 N-1 -2 2]);grid
subplot(212)
plot(n,r);axis([0 N-1 -2 2]);grid
y[n]
2

−1

−2
0 2000 4000 6000 8000 10000 12000

r[n]
2

−1

−2
0 2000 4000 6000 8000 10000 12000

Figure 9.13: Problem 37: Original handel signal y[n] and echoed signal r[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.43

9.38 (a) If the duration of e(t) is Te = 300Ts and for 100 cycles of the sinusoid 100T0 then T0 = Te /100 =
3Ts .
(b) If we let t = nTs , then the sampled envelope is

e(nTs ) = (1/3)(r(nTs ) − r((n − 30)Ts )) − (1/10)(r((n − 200)Ts − r((n − 300)Ts )



 nTs /3 0 ≤ nTs ≤ 30Ts
= 10Ts 30Ts ≤ nTs ≤ 200Ts

3 − nTs /10 200Ts ≤ nTs ≤ 300Ts

The following script generates the window e[n] and the modulated signal y[n] = e[n]x[n]

% Pr 9_38
clear all;clf
Ts=0.1;
t1=0:Ts:3;
t2=20:Ts:30;
e=[t1/3 ones(1,200-30) 3-t2/10]
t=0:Ts:30+Ts;
figure(1)
plot(t,e,’r’);grid
n=0:length(e)-1;
x=cos(2*pi*n/3);
hold on
plot(t,x.*e,’b’)
hold off; axis([0 30 -1.2 1.2]);
xlabel(’nT_s’);ylabel(’x(nT_s)e(nT_s)’)

0.8

0.6

0.4

0.2
x(nTs)e(nTs)

−0.2

−0.4

−0.6

−0.8

−1

0 5 10 15 20 25 30
nTs

Figure 9.14: Problem 38: window e(nTs ) and modulated cosine y(n) = x(nTs )e(nTs ) for Ts = 0.1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.44

9.39 (a) The sampler is linear: if xi (t), i = 1, 2, are the inputs then xi (nTs ), i = 1, 2 are the outputs.
When the input is ax1 (t) + bx2 (t), a combination of the previous two inputs, then the output will be
ax1 (nTs ) + bx2 (nTs ) or the combination of the previous outputs.
(b) For Ts = 1, the sampling of x(t) = cos(0.5πt)u(t) gives the signal

y(nTs ) = cos(0.5πn)u[n]

while for Ts = 1 the sampling of x(t − 0.5) = cos(0.5π(t − 0.5))u(t − 0.5) gives

z(nTs ) = cos(0.5π(n − 0.5))u(n − 0.5)

Let us compare the first five values

y(0) = 1 z(0) = 0
y(1) = 0 z(1) = cos(0.25π) = 0.707
y(2) = −1 z(2) = cos(0.75π) = −0.707
y(3) = 0 z(3) = cos(1.25π) = −0.707
y(4) = 1 z(4) = cos(1.75π) = 0.707
..
.

showing clearly that z(nTs ) is not y(nTs ) shifted. Thus the sampler is time-varying. Notice that if we
sample the analog signal shifted by exactly one or more sampling periods, the output signal is a shifted
version of the originally sampled signal. But if the shift is not a multiple of the sampling period, it is not.
To verify that the sampler is not TI we use the following script to plot y[n] and z[n] for 0 ≤ n ≤ 49. See
Fig. 9.15

% Pr 9_39
clear all;clf
n=0:49;
y=cos(0.5*pi*n);
n1=1:49;
z=[0 cos(0.5*pi*(n1-0.5))];
figure(1)
subplot(211)
stem(n,y); ylabel(’y[n]’)
subplot(212)
stem(n,z); ylabel(’z[n]’); xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.45

0.5

y[n]
0

−0.5

−1
0 5 10 15 20 25 30 35 40 45 50

0.5

z[n]
0

−0.5

−1
0 5 10 15 20 25 30 35 40 45 50
n

Figure 9.15: Problem 39: z[n] (bottom) is not shifted version of y[n] (top)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.46

9.40 (a) If w[n] = u[n] − u[n − N ] is the rectangular window, windowing the signal x[n] gives y[n] =
x[n]w[n]. If we have the following input/output pairs

x1 [n] ⇒ y1 [n] = w[n]x1 [n]


x2 [n] ⇒ y2 [n] = w[n]x2 [n]

then
ax1 [n] + bx2 [n] ⇒ w[n][ax1 [n] + bx2 [n]] = ay1 [n] + by2 [n]
thus the windowing process is linear.

(b)-(c) However, windowing it is not time invariant. If we window x[n] = nu[n] using a rectangular
window w[n] = u[n] − u[n − 6] results in y[n] = n(u[n] − u[n − 6]). If we shift x[n] by 6 to get
x[n − 6] = [n − 6]u[n − 6] (which is zero for 0 ≤ n ≤ 5) then x[n − 6]w[n] is zero for all n and not
equal to y[n − 6] which is what we should get if windowing was time-invariant. The following script
displays this.

% Pr 9_40
clear all; clf
w=[ones(1,6) zeros(1,20-6)];
n=0:19;
x=n;
x1=[zeros(1,6) x(1:20-6)];
figure(1)
subplot(211)
stem(n,w.*x);axis([0 19 0 5]);grid
subplot(212)
stem(w.*x1);axis([0 19 0 5]);grid

x[n]w[n]
5

0
0 2 4 6 8 10 12 14 16 18

x[n−6]w[n]
5

0
0 2 4 6 8 10 12 14 16 18

Figure 9.16: Problem 40: windowed signals x[n]w[n] and x[n − 6]w[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.47

9.41 (a) The impulse response can be found by solving the difference equation recursively, i.e., letting the
output be y[n] = h[n] and the input be x[n] = δ[n] and assuming zero initial conditions, i.e., h[n] = 0
for n < 0. We have then
h[n] = 0.15h[n − 2] + δ[n]
which for n ≥ 0 gives

h[0] = 0.15h[−2] + 1 = 1
h[1] = 0.15h[−1] + 0 = 0
h[2] = 0.15h[0] + 0 = 0.15
h[3] = 0.15h[1] + 0 = 0
h[4] = 0.15h[2] + 0 = 0.152
h[5] = 0.15h[3] + 0 = 0
..
.

or 
0.15n/2 for n ≥ 0 and even
h[n] =
0 otherwise
(b) Letting the initial conditions be zero, the input x[n] = δ[n] and y[n] = h[n] we have

h[n] = 0.15h[n − 2] + δ[n]

replacing h[n − 2] = 0.15h[n − 4] + δ[n − 2] according to the equation for the difference equation, we
get
h[n] = 0.15(0.15h[n − 4] + δ[n − 2]) + δ[n] = 0.152 h[n − 4] + 0.15δ[n − 2] + δ[n]
and again replacing h[n − 4] = 0.15h[n − 6] + δ[n − 4] we have

h[n] = 0.152 (0.15h[n − 6] + δ[n − 4]) + 0.15δ[n − 2] + δ[n]


= 0.153 h[n − 6] + 0.152 δ[n − 4] + 0.15δ[n − 2] + δ[n]

Repeating this process we realize that after more iterations we get that,

h[n] = δ[n] + 0.15δ[n − 2] + 0.152 δ[n − 4] + 0.153 δ[n − 6] + · · ·

which is the same result as in the previous part.

(c) The following script using filter computes and plots h[n]

% Pr 9_41
clear all;clf
a=[1 0 -0.15];
b=1;
x=[1 zeros(1,29)];
h=filter(b,a,x);
n=0:29;
figure(1)
stem(n,h); axis([0 29 0 1]); grid;ylabel(’h[n]’); xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.48

0.8

0.6

h[n]
0.4

0.2

0 5 10 15 20 25
n

Figure 9.17: Problem 41: impulse response h[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.49

9.42 (a) Letting x[n] = δ[n] the impulse response of the filter is

h[n] = 0δ[n] + δ[n − 1] + 2δ[n − 2] + 3δ[n − 3] + 4δ[n − 4] + 5δ[n − 5]


5
X
= kδ[n − k]
k=1

% Pr 9_42
% impulse response
clear all; clf
b=[0 1 2 3 4 5];
a=1;
x=[1 zeros(1,100)];
h=filter(b,a,x);
n=0:19;
figure(1)
subplot(211)
stem(n,h(1:20)); ylabel(’h[n]’)

The filter is causal since the output depends only on previous values of the input, and besides h[n] = 0
for n < 0. The system is BIBO stable since the sum of the values of |h[n]| is finite.
(b) Letting the input be x[n] = u[n] then the unit-step response is

5
X
s[n] = ku[n − k] = u[n − 1] + 2u[n − 2] + 3u[n − 3] + 4u[n − 4] + 5u[n − 5]
k=1

The values of s[n] increase from 0 to 15 (sum of the amplitudes of the delayed unit-step signals) and
remain there (steady state) as shown by the following script

% unit step response


x=ones(1,100);
s=filter(b,a,x);
n=0:19;
subplot(212)
stem(n,s(1:20));ylabel(’s[n]’); xlabel(’n’)

(c) If the input x[n] for the filter is bounded so that |x[n]| < 3, for the output

5
X 5
X
|y[n]| ≤ k|x[k]| < 3 k = 3 × 15 = 45
k=0 k=0

i.e., the bound M = 45.


(d) See the above scripts.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.50

h[n]
2

0
0 2 4 6 8 10 12 14 16 18 20

15

10

s[n]
5

0
0 2 4 6 8 10 12 14 16 18 20
n

Figure 9.18: Problem 42: Impulse response h[n] and unit-step response s[n] of FIR filter.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.51

9.43 (a) Using the superposition property of LTI systems and that h[n] is the response to δ[n] gives

y[n] = h[n] + h[n − 1] + h[n − 2] = (−0.5)n u[n] + (−0.5)n−1 u[n − 1] + (−0.5)n−2 u[n − 2]


 1 n=0

0.5 n=1
=

 0.75 n=2

3(−0.5)n n ≥ 3

as the output for the given input x[n].


(b) The convolution sum is given by


X
y[n] = x[k]h[n − k]
k=−∞
X∞
= (δ[k] + δ[k − 1] + δ[k − 2])h[n − k]
k=−∞
X∞ ∞
X ∞
X
= δ[k]h[n − k] + δ[k − 1]h[n − k] + δ[k − 2]h[n − k]
k=−∞ k=−∞ k=−∞
= h[n] + h[n − 1] + h[n − 2]

since the multiplication by the delta functions gives zero except when their arguments are zero, or k = 0,
k = 1 and k = 2. This result coincides with the one in part (a).

(c) The following script is used to compute the convolution sum of the given x[n] and h[n]:

% Pr 9_43
clear all; clf
x=[1 1 1 zeros(1,98)];
n=0:100;
h=(-0.5).ˆn;
y=conv(h,x);
n1=0:20;
figure(1)
subplot(311)
stem(n1,x(1:21)); ylabel(’x[n]’);grid
subplot(312)
stem(n1,h(1:21)); ylabel(’h[n]’);grid
subplot(313)
stem(n1,y(1:21)); ylabel(’y[n]’);grid;xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.52

x[n]
0.5

0
0 2 4 6 8 10 12 14 16 18 20

0.5

h[n]
0

−0.5
0 2 4 6 8 10 12 14 16 18 20

0.5

y[n]
0

−0.5
0 2 4 6 8 10 12 14 16 18 20
n

Figure 9.19: Problem 43: Input x[n], impulse response h[n] and convolution sum y[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.53

9.44 (a) If the steady state exists then y[n] = y[n − 1] = 2 as n → ∞, and since x[n] = 1 for n ≥ 1, the
value of a should be according to the difference equation

2 = 2a + 1 or a = 0.5

(b) Using causality, h[n] = 0 for n < 0, and that the input is x[n] = u[n], the initial condition is
zero, y[−1] = 0 and a = 0.5, as found above, we have according to the result from linearity and
time-invariance and the difference equation:

y[0] = h[0]
= 0.5y[−1] + 1 = 1
y[1] = h[1] + h[0]
= 0.5y[0] + 1 = 0.5 + 1
y[2] = h[2] + h[1] + h[0]
= 0.5y[1] + 1 = 0.5(0.5 + 1) + 1
···

solving for the impulse response values from the above equations gives:

h[0] = 1
h[1] = (1 + .5) − h[0] = 0.5
h[2] = 1 + 0.5 + 0.52 − h[1] − h[0] = 0.52
..
.

indicating that the impulse response is h[n] = 0.5n u[n].


(c) The following script computes and plots the impulse response h[n] using filter

% Pr 9_44
clear all;clf
a=[1 -0.5]
b=1;
x=[1 zeros(1,100)];
h=filter(b,a,x);
n=0:100;
figure(1)
stem(n,h)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.54

0.9

0.8

0.7

0.6

h[n]
0.5

0.4

0.3

0.2

0.1

0
0 2 4 6 8 10 12 14 16 18 20
n

Figure 9.20: Problem 44: impulse response h[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.55

9.45 (a) For a LTI system, if s[n] is the response to u[n], then the response to δ[n] = u[n] − u[n − 1] is
h[n] = s[n] − s[n − 1], i.e., the impulse response of the system. So we have that

h[n] = s[n] − s[n − 1] = (2(0.5)n − 2)u[n] − (2(0.5)n−1 − 2)u[n − 1]



0 n≤0
=
−2(0.5)n n ≥ 1

(b) The ramp in terms of the unit-step signal is given as


X
r[n] = u[n − k]
k=0

so that the response of the system to a ramp is


X
ρ[n] = s[n − k]
k=0
X∞
= 2[(−0.5)n−k − 1]u[n − k]
k=0

which tends to infinity as n → ∞. A close form of the ramp response is difficult to obtain, so we use
MATLAB to compute it at each sample and to plot it.

% Pr 9_45
% --- ramp response using filter
n=1:100;
h=[0 -2*(0.5).ˆn];
x=n;
rho=conv(h,x);
n1=0:49;
figure(1)
subplot(211)
stem(n1,rho(1:50));axis([0 49 -101 1]);grid
% --- ramp response using superposition
rho1=2*((0.5).ˆ(n-1)-1);
for k=1:49,
nk=1:100-k;
rho1=rho1+[zeros(1,k) 2*((0.5).ˆ(nk-1)-1)];
end
subplot(212)
stem(n1,rho1(1:50));axis([0 49 -101 1]);grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.56

−20

−40

−60

−80

−100
0 5 10 15 20 25 30 35 40 45

−20

−40

−60

−80

−100
0 5 10 15 20 25 30 35 40 45

Figure 9.21: Problem 45: ρ[n] computed using filter (top) and using superposition (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.57

9.46 (a) The input can be written as


3
X
x[n] = δ[n − k]
k=0

so the system response is


3
X
y[n] = h[n − k]
k=0

(b) If h[n] = 0.5n u[n] then


3
X n
X
y[n] = 0.5n−k u[n − k] = 0.5m u[m]
k=0 m=n−3
n n−1
= 0.5 u[n] + 0.5 u[n − 1] + 0.5n−2 u[n − 2] + 0.5n−3 u[n − 3]
= 0.5 (u[n] + 2u[n − 1] + 22 u[n − 2] + 23 u[n − 3])
n


 1 n=0

0.5(1 + 2) = 3/2 n=1
=

 0.25(1 + 2 + 4) = 7/4 n=2

0.5n (1 + 2 + 4 + 8) = 15 × 0.5n n ≥ 3

(c) Consider the input to be x1 [n] = u[n], the convolution sum would be for n ≥ 0

X ∞
X
y1 [n] = h[n − k]x1 [k] = 0.5n 0.5−k u[n − k]u[k]
k=−∞ k=−∞
n
X (n+1)
n 1−2
= 0.5 k
2 = 0.5n = 0.5n (2n+1 − 1)
1−2
k=0

and zero otherwise. So that




 0 n<0



 1 n=0

 0.5 × 3 = 3/2 n=1
y1 [n] = 0.52 × 7 = 7/4 n=2



 0.53 × 15 = 15/8 n=3



 .. ..
. .

then the output due to x[n] = u[n] − u[n − 4] is by superposition

y[n] = 0.5n (2n+1 − 1)u[n] − 0.5n−4 (2n+1−4 − 1)u[n − 4]



 0 n<0
= 0.5n (2n+1 − 1) 0≤n≤3

0.5n (2n+1 − 1) − 0.5n−4 (2n−3 − 1) = 0.5n (15) n ≥ 4

which coincides with the result obtained above. The following script computes and plots the different
signals in this problem, its result coincides with the ones above.

% Pr 9_46
clear all; clf

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.58

x=[1 1 1 1 zeros(1,96)];
n=0:99; h=(0.5).ˆn;
y=conv(x,h);
figure(1)
subplot(311)
stem(n(1:10),x(1:10)); title(’x[n]’)
subplot(312)
stem(n(1:10),h(1:10)); title(’h[n]’)
subplot(313)
stem(n(1:10),y(1:10)); title(’y[n]’); xlabel(’n’)

x[n]
1

0.5

0
0 1 2 3 4 5 6 7 8 9

h[n]
1

0.5

0
0 1 2 3 4 5 6 7 8 9

y[n]
2

0
0 1 2 3 4 5 6 7 8 9
n

Figure 9.22: Problem 46: input x[n], impulse response h[n] and response y[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.59

9.47 (a)–(c) The following script simulates the envelop detector:

% Pr 9_47
Ts=0.01;
t=0:0.01:100-0.01; N=length(t)
p=[ones(1,2000) zeros(1,2000) ones(1,2000) zeros(1,N-6000)];
P=1.1*abs(min(p))
x1=(p+P).*cos(20*pi*t);
figure(1)
subplot(221)
plot(t,p); ylabel(’p(nT_s)’); axis([0 max(t) -0.1 1.1]); title(’pulses’)
subplot(222)
plot(t,x1); ylabel(’x(nT_s)’); axis([0 max(t) -1.1 1.1]); title(’AM pulses’)
y=abs(x1);
subplot(223)
plot(t,y); ylabel(’y(nT_s)’); axis([0 max(t) -0.1 1.1]); title(’ absolute value’)
b=(1/(15*0.65))*ones(1,15);a=1;
z1=filter(b,a,y); z1=z1-P;
subplot(224)
plot(t,z1); ylabel(’z(nT_s)’); axis([0 max(t) -0.1 1.1]); title(’recovered signal’)

pulses AM pulses
1 1

0.8 0.5
p(nTs)

x(nTs)

0.6
0
0.4
0.2 −0.5

0 −1
0 20 40 60 80 0 20 40 60 80

absolute value recovered signal


1 1
0.8 0.8
y(nTs)

z(nTs)

0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 20 40 60 80 0 20 40 60 80

Figure 9.23: Problem 47: envelope detection for pulses.

(d) Considering x2 (nTs ) the input of the envelop detector, the following script illustrates that the system
is non-linear. Letting z2 (nTs ) be the output corresponding to x2 (nTs ), the output z3 (nTs ) corresponding
to 2x2 (nTs ) is shown to be different from 2z2 (nTs ), thus the system is nonlinear.

Ts=0.01;
t=0:0.01:100-0.01; N=length(t)
p=2*cos(0.2*pi*t);
P=1.1*abs(min(p))
x2=(p+P).*cos(20*pi*t);
figure(2)
subplot(221)
plot(t,p); ylabel(’p(nT_s)’); title(’sinusoidal input’)
subplot(222)
plot(t,x2); ylabel(’x_2(nT_s)’); title(’AM signal’)
y=abs(x2);
subplot(223)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 9.60

plot(t,y); ylabel(’y_2(nT_s)’); title(’absolute value’)


z2=filter(b,a,y);z2=z2-P;
subplot(224)
plot(t,z2); ylabel(’z_2(nT_s)’); title(’recovered signal’)
% double the input
x3=2*x2;
figure(3)
subplot(221)
plot(t,x3); ylabel(’x_3(nT_s)’); title(’ AM signal’)
y=abs(x3);
subplot(222)
plot(t,y); ylabel(’y_3(nT_s)’); title(’absolute value’)
z3=filter(b,a,y);z3=z3-P;
subplot(223)
plot(t,z3); ylabel(’z_3(nT_s)’) ; title( ’output for 2x_2’)
subplot(224)
plot(t,2*z2); ylabel(’2z_2(nT_s)’); title(’ 2 times output of x2’)

sinusoidal input AM signal AM signal absolute value


2 5 10 10

1 8
5
x2(nTs)
p(nTs)

6
x3(nTs)

y3(nTs)
0 0 0
4
−1 −5
2

−2 −5 −10 0
0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100

absolute value recovered signal output for 2x2 2 times output of x2


5 2 8 4
4 1 6 2

2z2(nTs)
3 0
y2(nTs)

z2(nTs)

4 0
z3(nTs)

2 −1 2 −2

1 −2 0 −4

0 −3 −2 −6
0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100

Figure 9.24: Problem 47: Example verifying non–linearity of system.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 10

The Z–transform

10.1 Basic Problems


10.1 (a) For Ts = 1 the transformation from the s-plane to the Z–plane z = es is such that for s = σ + jΩ

z = eσ ejΩ

For s = −1 ± j1, the poles of the analog system, the corresponding singularities in the Z–plane are
given by
z12 = e−1 e±j 1

which are inside the unit disk as e−1 < 1 with a radian frequency of ±1.
The pole s = 0 is mapped into z = e0 = 1, and the poles s = ±j1 are mapped into z = 1e±j1 with
unit magnitude and radian frequencies ±1.
(b) By expressing z = rejω = eσ ejΩ for Ts = 1, the radius is given by r = eσ so that if σ < 0 the
singularities are inside the unit circle, if σ = 0 they are on the unit circle, and if σ > 0 they are outside
the unit circle.

1
Chaparro — Signals and Systems using MATLAB 10.2

10.2 (a) We have s[n] = u[n] − u[−n], the Z-transform of s1 [n] = u[n] is

X 1
S1 (z) = z −n =
n=0
1 − z −1

provided that |z −1 | < 1, thus |z| > 1 is the region of convergence for S1 (z). The Z-transform of
s2 [n] = −u[−n] is given by
0
X ∞
X −1
S2 (z) = − z −n = − zm =
n=−∞ m=0
1−z

where the last sum converges for |z| < 1.


(b) The condition for

1 1 1 + z −1
S(z) = S1 (z) + S2 (z) = − =
1 − z −1 1−z 1 − z −1
to converge is that |z| > 1 and that |z| < 1 simultaneously, which is not possible. Since there is no
region of convergence for S(z), the Z-transform of s[n] does not exist.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.3

10.3 (a) The signal x[n] can be written as

x[n] = −δ[n] − α−1 δ[n + 1] − α−2 δ[n + 2] − · · ·


1 1
= −δ[n] − δ[n + 1] − 2 δ[n + 2] − · · ·
α α
So that its Z-transform is given by

z z2
X(z) = −1 − − 2 − ···
α α
X∞  n
z 1 αz −1
= − =− = |z| < |α|
n=0
α 1 − z/α 1 − αz −1

If α = 0.5, the ROC is the interior of a circle of radius 0.5, which does not include the unit circle. The
ROC in this case indicates that the signal is non-causal. If α = 2, the ROC is the interior of a circle
of radius 2, including the unit circle, and indicating the signal is non-causal. In this case X(ejω ) is
defined, but it is not when α = 0.5.
(b) Computing the derivative of X(z) with respect to z gives

X∞
d X(z) 1 2z 3z 2 z n−1
= − − 2 − 3 ··· = − n n
dz α α α n=1
α
−1
X
= mαm z −(m+1)
m=−∞

by letting m = −n in the last sum. Letting now k = m + 1 in the final sum we have
0
X
d X(z)
= (k − 1)α(k−1) z −k
dz
k=−∞

We thus have the pair


d X(z)
⇔ (n − 1)α(n−1) u[−n].
dz
Writing X(z) in positive powers of z, i.e., X(z) = α/(z − α) its derivative with respect to z is

d X(z) −α
=
dz (z − α)2

so that we have
−α −αz −2
= ⇔ (n − 1)α(n−1) u[−n].
(z − α)2 (1 − αz −1 )2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.4

10.4 (a) If Ts = 0.1 the discrete-time signal is


(
1 0 ≤ 0.1n ≤ 1 or 0 ≤ n ≤ 10
x(0.1n) = [u(t) − u(t − 1)] |t=0.1n =
0 otherwise

(b) Expressing x[n] as indicated, then N = 11.


The Laplace transform of the sampled signal is
10
X 10
X 1 − e−1.1s
Xs (s) = L[δ(t − nTs ) = e−0.1ns =
n=0 n=0
1 − e−0.1s

(c) The z-transform of the discrete-time signal is


10
X 1 − z −11
X(z) = z −n =
n=0
1 − z −1

To transform Xs (s) into X(z) we let z = e0.1s .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.5

10.5 (a)(b) The given signal can also be written


(
1 n ≥ 0 and even
x[n] =
0 otherwise

Using the above expression for x[n], we have



X ∞
X 1
X(z) = 1 z −n = 1 z −2m = |z| > 1
n=0, even m=0
1 − z −2

where we let n = 2m to find the final expression.


The z-transform of x[n] is also obtained by using its linearity

X(z) = 0.5Z[u[n]] + 0.5Z[(−1)n u[n]]


X∞
1
= + 0.5 (−z −1 )n
2(1 − z −1 ) n=0
1 1
= +
2(1 − z −1 ) 2(1 + z −1 )
1
= |z −1 | < 1 or |z| > 1
1 − z −2
(c) To find the poles and zeros expressing X(z) in positive powers:

z2
X(z) =
z2 − 1
the poles are z = ±1, and the zeros z = 0, double.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.6

10.6 (a) The Z-transform of the difference equation

y[n] = x[n] − 0.5y[n − 1] n≥0

with initial condition y[−1] is

Y (z) = X(z) − 0.5(z −1 Y (z) + y[−1])

so that
X(z) 0.5y[−1]
Y (z) = −1

1 + 0.5z 1 + 0.5z −1
(b) From the expression for Y (z), if X(z) = 1, y[−1] = 2 then Y (z) = 0 and therefore y[n] = 0 for
n ≥ 0 but y[−1] = 2.
If X(z) = 1 or x[n] = δ[n] and y[−1] = 2 the difference equation is

y[n] = δ[n] − 0.5y[n − 1] n≥0

and can be solved recursively

y[0] = 1 − 0.5 × 2 = 0
y[1] = 0 − 0.5 × 0 = 0
y[2] = 0 − 0.5 × 0 = 0
..
.

(c) If y[−1] = 0 and x[n] = δ[n] then we can compute y[n] = h[n], i.e., the impulse response. The
corresponding transfer function is then from the equation for Y (z):

Y (z) 1
H(z) = Z[h[n]] = =
X(z) 1 + 0.5z −1

If we want y[n] = δ[n] + 0.5δ[n − 1] or Y (z) = 1 + 0.5z −1 then

Y (z)
X(z) = = (1 + 0.5z −1 )2 = 1 + z −1 + 0.25z −2
H(z)

which gives x[n] = δ[n] + δ[n − 1] + 0.25δ(n − 2).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.7

10.7 (a) Writing X(z) as


1 z −10
X(z) = −
1 − z −1 1 − z −1
since the inverse Z-transform of the first term is u[n], then the inverse of the second is −u[n − 10] given
that z −10 indicates a delay of 10 samples. Thus,
(
1 0≤n≤9
x[n] = u[n] − u[n − 10] =
0 otherwise

(b) Although X(z) has been shown as a ratio of two polynomials, using the above representation of
x[n] its Z-transform is
X(z) = 1 + z −1 + · · · + z −9

i.e., a 9th –order polynomial in z −1 .


(c) We can rewrite X(z) as
Q9 Q9
z 10 − 1 (z − 1) k=1 (z − ejπk/5 ) k=1 (z − e
jπk/5
)
X(z) = 9 = =
z (z − 1) z 9 (z − 1) z9

which is obtained by finding that the zeros of X(z) are values zk10 = 1 or zk = ej2πk/10 for k =
0, · · · , 9. For k = 0 the zero is z0 = 1, which cancels the pole at 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.8

10.8 (a) If we let the input be zero, the z-transfom of y[n] is

Y (z) = 0.25z −2 Y (z) + 0.25y[−1]z −1 + 0.25y[−2]

where y[−1] and y[−2] are the initial conditions we are determining. If we want y[n] = 0.5n u[n] then
from the above equation

1 0.25(y[−1]z −1 + y[−2])
Y (z) = =
1 − 0.5z −1 (1 − 0.25z −2 )

Comparing the last two terms, we have that

1 + 0.5z −1
y[−1]z −1 + y[−2] =
0.25
so that y[−2] = 4 and y[−1] = 2.
(b) The poles of the transfer function

Y (z) 1
H(z) = =
X(z) 1 − 0.25z −2

are z = ±0.5 . The transient thus will disappear as n → ∞, and so in the steady state the output will
be a constant, i.e.,
lim y[n] = lim y[n − 2] = Y
n→∞ n→∞

and
lim x[n] = 1
n→∞

which gives according to the difference equation


4
Y = 0.25Y + 1 ⇒ Y =
3
as the steady–state response.
This can also be seen by means of the partial expansion (after replacing X(z) above) of Y (z) or

A B C
Y (z) = + +
1 − z −1 1 − 0.5z −1 1 + 0.5z −1
The inverse Z-transform of the second and third terms will go to zero as n → ∞ since the radii of the
corresponding poles are less than unity. The other term does not go to zero in the steady state. The
A = Y (z)(1 − z −1 )|z−1 =1 = 4/3 and so limn→∞ y[n] = 4/3.
(c) For zero initial conditions we want

X(z) 1
Y (z) = −2
=
1 − 0.25z 1 − 0.5z −1
which gives that
X(z) = 1 + 0.5z −1 ⇒ x[n] = δ[n] + 0.5δ[n − 1]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.9

(d) For x[n] = δ[n] + 0.5δ[n − 1] we get Y (z) = H(z)(1 + 0.5z −1 ) which from the difference equation
is equal to
1 + 0.5z −1
Y (z) =
1 − 0.25z −2
so that when comparing them we find that

1 + 0.5z −1 1 1
H(z) = −1 −2
= −2
=
(1 + 0.5z )(1 − 0.25z ) 1 − 0.25z (1 − 0.5z )(1 + 0.5z −1 )
−1

with poles at ±0.5 so that


A B
H(z) = −1
+
1 + 0.5z 1 − 0.5z −1
where
1
A = | −1 = 0.5
1 − 0.5z −1 z =−2
1
B = | −1 = 0.5
1 + 0.5z −1 z =2
so that
h[n] = 0.5(−0.5)n u[n] + 0.5n+1 u[n] = 0.5n+1 [1 + (−1)n ]u[n]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.10

10.9 (a) i. Yes. Cross-multiplying

H(z)(1 − αz −1 ) = (1 + αz −1 + · · · + αM −1 z −(M −1) )(1 − αz −1 )


= 1 + αz −1 + · · · + αM −1 z −(M −1) − αz −1 − · · · − αM z −M
= 1 − αM z −M

ii. H(z) = 1 + αz −1 + α2 z −2 and (1 − αz −1 )H(z) = 1 − α3 z −3 . Thus

1 − α3 z −3 z 3 − α3
H(z) = =
1 − αz −1 z 2 (z − α)

so the zeros of H(z) are zk = αej2πk/3 for k = 0, 1, 2, and the poles z = 0 of order 2,
and z = α. The pole z = α is cancelled by the zero at k = 0 so ROC is the whole Z–plane,
except z = 0.
(b) i. If we let


 0.5 n=0
h1 [n] = 0.5n 1≤n≤N −1


0 otherwise

then h[n] = h1 [n] + h1 [−n]


ii. For N = 4, Z-transform of h1 [n] is
3
X 1 − 0.54 z −4 0.5 + 0.25z −1 − 0.54 z −4
H1 (z) = 0.5n z −n − 0.5 = − 0.5 =
n=0
1 − 0.5z −1 1 − 0.5z −1

noticing that the initial expression for H1 (z) is a polynomial in z −1 then the ROC is |z| > 0.
The final expression being rational indicates that if z −1 = 2 or z = 1/2 is a zero and a pole
and they cancel so that only poles at the origin remain. The Z-transform
3
X 0.5 + 0.25z − 0.54 z 4
Z[h1 [−n]] = H1 (1/z) = 0.5n z n − 0.5 =
n=0
1 − 0.5z

with ROC the whole Z–plane as it is a polynomial in z. Verify that the pole at z = 2 of the
final expression for Z[h1 [−n]] is cancelled by a zero at the same place. Thus

0.5 + 0.25z −1 − 0.54 z −4 0.5 + 0.25z − 0.54 z 4


H(z) = +
1 − 0.5z −1 1 − 0.5z
with ROC: |z| > 0.
iii. If N → ∞, we have
1 1 −0.25
H(z) = −1
+ −1=
1 − 0.5z 1 − 0.5z (1 − 0.5z −1 )(1 − 0.5z)
0.5z
= ROC 0.5 ≤ |z| ≤ 2
(1 − 2z)(1 − 0.5z)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.11

(c) i. H(z) = 1 + 0.5z −1 , |z| > 0, H(z −1 ) is Z-transform of h[−n] so

z + 0.25z 2 + 0.25
He (z) = 0.5[H(z) + H(z −1 )] = 0.5[2 + 0.5(z −1 + z)] = |z| > 0
z
2
0.25 − 0.25z
Ho (z) = 0.5[H(z) − H(z −1 )] = 0.5[0.5(z −1 − z))] = |z| > 0
z
The ROC of H(z) = He (z) + Ho (z) is the intersection of the ROCs of He (z) Ho (z) or
|z| > 0.
ii. The inverse Z-transforms give

he [n] = 0.25δ[n + 1] + δ[n] + 0.25δ[n − 1]


ho [n] = −0.25δ[n + 1] + 0.25δ[n − 1]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.12

10.10 (a) Pole is z = 0.5 and zero z = −1. ROC is (iii), |z| > 0.5 because of causality.
(b) From H(z) = Y (z)/X(z) we have Y (z) − 0.5Y (z)z −1 = X(z) + X(z)z −1 the difference
equation is
y[n] − 0.5y[n − 1] = x[n] + x[n − 1]

(c) We can write


1 z −1
H(z) = +
1 − 0.5z −1 1 − 0.5z −1
so that

h[n] = 0.5n u[n] + 0.5n−1 u[n − 1] = δ[n] + (0.5n + 0.5n−1 )u[n − 1]


= δ[n] + 3 × 0.5n u[n − 1]

(d) The system is a low-pass filter. Drawing vectors from the pole and the zero to a point in the unit
circle gives
~ jω0 )
Z(e
H(ejω0 ) =
P~ (ejω0 )
which gives H(ej0 ) = 2/0.5 = 4, H(ejπ ) = 0 and decreases as ω increases form 0 to π.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.13

10.11 (a) Replacing w[n] in the smoother equation:


2 1
y[n] = y[n − 1] + (x[n] − x[n − 1])
3 3

(b) If x[n] = u[n], then w[n] = δ[n] and so the output of the smoother is its impulse response,
calculated using hs [n] = (2/3)hs [n − 1] + (1/3)δ[n] or
 n
1/3 1 2
Hs (z) = ⇒ y[n] = hs [n] = u[n]
1 − (2/3)z −1 3 3

(c) Transfer function of overall system

Y (z) 1 − z −1
H(z) = =
X(z) 3(1 − 2z −1 /3)

Input x[n] = cos(0n)u[n] + sin(πn/2)u[n] the steady-state response is

y[n] = |H(ej0 )| cos(0) + |H(ejπ/2 )| sin(πn/2 + ∠H(ejπ/2 ) where


H(ej0 ) = 0
1 − (−j) 1+j
H(ejπ/2 ) = =
3(1 − (−j)2/3) 3(1 + 2j/3)

2
|H(ejπ/2 )| = p , ∠H(ejπ/2 ) = π/4 − tan−1 (2/3)
3 1 + 4/9
⇒ y[n] = |H(ejπ/2 )| sin(πn/2 + ∠H(ejπ/2 ))

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.14

10.12 We have
Y (z) 2(1 − z −1 )
H(z) = =
X(z) 1 + 0.5z −1
Y (z) = H(z)(Z[u[n]] + Z[0.5n cos(πn)u[n]])

only the first of the above terms would give steady state due to its pole at z = 1, so

1 2(1 − z −1 ) 2
H(z) = =
1 − z −1 (1 − z −1 )(1 + 0.5z −1 ) 1 + 0.5z −1

which gives a transient, so yss [n] = 0. Since system is stable, changing the initial condition will not
change the steady state–response.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.15

10.13 For a = b = 2 the denominator of the transfer function is

D(z) = z 2 + 2z + 2 = (z + 1)2 + 1

so the poles are p1,2 = −1 ± j1 which have |p1,2 | = 2 > 1, outside the unit circle and as such system
is unstable.
For a = 1 and b = 1/2 the denominator is

D(z) = z 2 + z + 0.5 = (z + 0.5)2 + 0.25



so the poles are p1,2 = −0.5 ± j0.5 which have |p1,2 | = 2/2 < 1, inside the unit circle and as such
system is stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.16

10.14 Impulse response

y[n] = e[n − 1] = x[n − 1] − y[n − 1]


Y (z) z −1
H(z) = =
X(z) 1 + z −1
h[n] = (−1)n−1 u[n − 1]

System is unstable, h[n] is not absolutely summable:



X
|h[n]| → ∞
n=1
| {z }
1

Moreover, the pole z = 1 is on the unit disc and as such the system is not BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.17

10.15 (a) We have

Y (z) = 1 + 2z −1 + 2z −2 + z −3
X(z) = 1 + z −1
Y (z)
H(z) = = 1 + z −1 + z −2
X(z)

after division.
(b) i. Yes, because of the ROC.
ii. There is a pole-zero cancellation

1 − 0.5z −1
H(z) =
(1 − 0.5z −1 )(1 + 0.5z −1 )

so that h[n] = (−0.5)n u[n].


(c) By long division in negative powers of z

H(z) = z −1 + 2z −2 + 2z −3 + · · · + 2z −10000 + · · ·

so that h[0] = 0, h[1] = 1 and h[10000] = 2.


Another way is
z −1 z −2
H(z) = −1
+
1−z 1 − z −1
so that h[n] = u[n − 1] + u[n − 2] giving the same values as above.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.18

10.16 (a) The output can be written

y[n] = δ[n] + 2δ[n − 1] + 3δ[n − 2] + 3(−1)n u[n − 3]

where the last term can be expressed as 3(−1)n u[n − 3] = −3(−1)n−3 u[n − 3] so that we can
find its Z-transform by using the shift property, thus:
1
X(z) =
1 + z −1
z −3
Y (z) = 1 + 2z −1 + 3z −2 − 3
1 + z −1
Y (z)
H(z) = = (1 + 2z −1 + 3z −2 )(1 + z −1 ) − 3z −3 = 1 + 3z −1 + 5z −2
X(z)
so h[0] = 1, h[1] = 3, h[2] = 5 and the others are zero.
(b) i. The transfer function is
(z + 1)2
H(z) = K
z
where at dc H(ej0 ) = H(1) = 4K = 2, so K = 2/4 = 0.5. As an FIR its ROC is the whole
Z–plane except for z = 0.
ii. x[n] = [cos(0n) + cos(πn/2) + cos(πn)]u[n] the steady state response is

yss [n] = H(ej0 ) + |H(ejπ/2 )| cos(πn/2 + ∠H(ejπ/2 )) + |H(ejπ )| cos(πn + ∠H(ejπ ))

where

H(ej0 ) = 2,
(j + 1)2
H(ejπ/2 ) = 0.5 = 1ej0 ,
j
H(ejπ ) = 0

and the steady–state is then


yss [n] = 2 + cos(πn/2).

(c) i. The zero is z = 0 and the poles are z = 0.5 and z = −2, if h[n] is non-causal then the region
of convergence is ROC:1/2 < |z| < 2.
ii. If h[n] is causal, then the ROC is |z| > 2 and

z −1 A B
H(z) = = +
(1 − 0.5z −1 )(1 + 2z −1 ) 1 − 0.5z −1 1 + 2z −1
where
z −1 2
A = | −1 =
1 + 2z −1 z =2 5
−1
z −2
B = | −1 =
1 − 0.5z −1 z =−1/2 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.19

so the impulse response is

h[n] = (2/5)(0.5n − (−2)n )u[n]

iii. The ROC of convergence of the non-causal transfer function includes the unit circle, making
the system BIBO stable, that is not the case for the causal transfer function and as it can be
seen it is not BIBO stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.20

10.17 If input is δ[n] = u[n] − u[n − 1] the output is h[n] = s[n] − s[n − 1] where

s[n] = 3(1 − 0.5n+1 )u[n]

is the inverse Z-transform of S(z). Thus

h[n] = 3(1 − 0.5n+1 )u[n] − 3(1 − 0.5n )u[n − 1]


= 3(1 − 0.5)δ[n] + [3(1 − 0.5n+1 ) − 3(1 − 0.5n )]u[n − 1]
= 1.5δ[n] + 1.5 × 0.5n u[n − 1]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.21

10.18 (a) The output is

y[0] = 0 y[1] = 1
y[2] = 3 y[3] = 4
y[4] = 4 y[n] = 3 n ≥ 5

(b) x[n] can be written as

x[n] n(u[n] − u[n − 3]) + u[n − 3]) = δ[n − 1] + 2δ[n − 2] + u[n − 3]


=
z −3
X(z) = z −1 + 2z −2 +
1 − z −1
−1 −2
H(z) = 1 + z + z

thus

Y (z) = X(z)H(z) = X(z) + z −1 X(z) + z −2 X(z)

so that

y[n] = x[n] + x[n − 1] + x[n − 2]


= δ[n − 1] + 3δ[n − 2] + 4δ[n − 3] + 4δ[n − 4] + 3u[n − 5]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.22

10.19 (a) y[n] will have length equal to length of h[n] + length of x[n] − 1 = 3 + 3 − 1 = 5. The output is

y[0] = 1 y[1] = 2
y[2] = 2.25 y[3] = 1.25
y[4] = 0.25 y[5] = 0

(b) H(z) = 1 + z −1 + 0.25z −2 = (z 2 + z + 0.25)/z 2 , so system is BIBO stable.


(c) Ĥ(z) = 1/H(z) = z 2 /(z 2 + z + 0.25) with double pole z = −1/2, so stable. Yes, x[n] can be
recovered. The poles of Ĥ(z) are 0.5 double, so Ĥ(z) is stable and H(z)Ĥ(z) is also stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.23

10.20 (a) Voltage division gives the transfer function

Y (s) 2s
H(s) = = 2
X(s) s + 2s + 1

thus the differential equation relating x(t) and y(t) is

d2 y(t) dy(t) dx(t)


+2 + y(t) = 2
dt2 dt dt
With T = 1,

dη(t)/dt ≈ η[n] − η[n − 1]


2 2
d η(t)/dt = d(dη(t)/dt)/dt ≈ (η[n] − η[n − 1]) − (η[n − 1] − η[n − 2])
= η[n] − 2η[n − 1] + η[n − 2]

so that the differential equation is approximated by

(y[n] − 2y[n − 1] + y[n − 2]) + 2(y[n] − y[n − 1]) + y[n] = 2(x[n] − x[n − 1])
y[n] − y[n − 1] + 0.25y[n − 2] = 0.5(x[n] − x[n − 1])

(b) If x[n] = u[n], then x[n] − x[n − 1] = δ[n] and

y[n] − y[n − 1] + 0.25y[n − 2] = 0.5δ[n]

Using Z-transform

Y (z)[1 − z −1 + 0.25z −2 ] = 0.5


0.5
Y (z) = ⇒ y[n] = (n + 1)0.5n+1 u[n]
(1 − 0.5z −1 )2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.24

10.21 (a) Since fs ≥ 40 kHz (Nyquist) we select either fs = 40 kHz or fs = 50 kHz.


(b) Since system B is the only stable low-pass filter we select B
(c) The transfer function of filter B is

1 z(z + 1) 1
HB (z) = √ √
4 (z − 2/2 ejπ/4 ) (z − 2/2 e−jπ/4 )
1 z(z + 1)
=
4 z 2 − z + 0.5

(d) The magnitude response of filter B is that of a low-pass filter having

|H(ej0 )| = 1
|H(ejπ )| = 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.25

10.22 (a) Poles of H(z)

(α + β) ± (α − β)
z1,2 =
( 2
α
=
β

Impulse response
A B
H(z) = +
1 − z −1 α 1 − z −1 β
h[n] = Aαn + Bβ n = Ar1n ejnθ1 + Br2n ejnθ2

for h[n] → 0 as n → ∞ we need 0 ≤ ri < 1 for i = 1, 2.


(b) If we let α = j and β = −j, we would have zeros at ±1 giving the zero magnitude responses at
ω = 0, π. The poles will be at 1e±jπ/2 which will give the infinite magnitude response at ±π/2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.26

10.23 Let Hs (z) and H(z) be the transfer functions of the smoother and of the overall system.

(a) If x[n] = u[n] then w[n] = δ[n] and y[n] = hs [n]. Thus, from

Y (z) 1/3
Hs (z) = = ⇒ y[n] = hs [n] = (1/3)n+1 u[n]
W (z) 1 − z −1 /3

(b) For the overall system

Y (z) Y (z) W (z) (1/3)(1 − z −1 )


H(z) = = =
X(z) W (z) X(z) 1 − z −1 /3
x[n] = (−1)n = cos(πn)
yss [n] = |H(ejπ )| cos(πn + ∠H(ejπ ))
|H(ejπ )| = 1/2, ∠H(ejπ ) = 0
yss [n] = 0.5(−1)n

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.27

10.24 (a) From the block diagram

Y (z) = X(z) + 0.5z −1 Y (z) + 0.25z −2 Y (z)

so that
Y (z) 1
H(z) = =
X(z) 1 − 0.5z −1 − 0.25z −2
(b) For w[n] = x[n] then R(z)H(z) = 1 so that

R(z) = 1 − 0.5z −1 − 0.25z −2

(c) Y (z) = 1 + z −1 , and

X(z) = Y (z)R(z)
= 1 + 0.5z −1 − 0.75z −2 − 0.25z −3

so that

x[n] = δ[n] + 0.5δ[n − 1] − 0.75δ[n − 2] − 0.25δ[n − 3]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.28

10.25 (a) The equation H(z)A(z) = B(z) using convolution and that a0 = 1
N
X −1
h[m] + ak h[m − k] = bm
k=1

where h[m] = 0 for m < 0 and bm = 0 for m < 0 and m > M − 1 or


N −1
(
X bm m = 0, 1, · · · , M − 1
h[m] + ak h[m − k] =
k=1
0 m = M, · · · , M + N − 2

Solving first for the denominator coefficients (the bottom equations above), we get a matrix equation
     
h[M ] h[M − 1] ··· h[M − N + 1] 1 0
     
 h[M + 1] h[M ] ··· h[M − N + 2]   a1   0 
 .. .. .. ..   .. = .. 
     
 . . . .   .   . 
h[M + N − 2] h[M + N − 3] · · · h[M − 1] aN −1 0

To solve these equations we move the first column of the matrix on the left to replace the zero vector on
the right, using the fact that a0 = 1 is known.
Once the denominator coefficients are found, the following set of equations are solved for the numerator
coefficients:
     
h[0] 0 ··· 0 1 b0
     
 h[1] h[0] ··· 0   a1   b1 
 .. .. .. ..   .. = .. 
     
 . . . .   .   . 
h[M − 1] h[M − 2] · · · h[M − N ] aN −1 bM −1

(b) We let a0 = 1 and then the equation for a1 is (M = 1, N = 2)

h[0]a1 = −h[1]

so that a1 = −h[1]/h[0] = −0.5/1 = −0.5. Then the b0 is obtained h[0] = b0 , so b0 = 1. The so


called “Pade approximant” is then

b0 1
Ĥ(z) = −1
=
1 + a1 z 1 − 0.5z −1

with impulse response ĥ[n] = 0.5n u[n] which approximates very well the given impulse response.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.29

10.26 Pre–multiplying by matrix T it is equivalent to exchanging the rows of the premultiplied matrix. Also
this matrix is such that T−1 = T, and when post–multiplying by T the columns are exchanged. Thus
the new matrices for the new state

w1 [n] = v2 [n]
w2 [n] = v1 [n]

and output equations are


" #
−1 1 −1/3
à = TAT =
1 0
" #
1/3
b̃ = Tb =
0
h i
c̃T = cT T−1 = 1 −1/3

and d remains the same. The block diagram is exactly the same as the one in example 23, it is the
definition of the state variables that is different.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.30

10.27 (a) The z-transform of the state variables (zero initial conditions) and output equations are

" #" # " #


z + a1 a2 V1 (z) 1
= X(z)
−1 z V2 (z) 0
Y (z) = b2 V2 (z)

Using Cramer’s rule

X(z)
Y (z) = b2
z 2 + a1 z + a2

so

b2 b2 z −2
H(z) = =
z 2 + a1 z + a2 1 + a1 z −1 + a2 z −2

(b) We obtain a minimal realization if we let

X(z)
W (z) =
1 + a1 z −1 + a2 z −2

and Y (z) = b2 z −2 W (z) which can be written

x[n] = w[n] + a1 w[n − 1] + a2 w[n − 2]


y[n] = b2 w[n − 2] with state variables
v1 [n] = w[n − 1], v2 [n] = w[n − 2]

we get the following state and output equations

v1 [n + 1] = −a1 v1 [n] − a2 v2 [n] + x[n]


v2 [n + 1] = v1 [n]
y[n] = b2 v2 [n]

The block diagram is shown in Fig. 10.2. The equations for the state and the output coincide with
the given ones.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.31

x[n] w[n] v1 [n] v2 [n] y[n]


+ z −1
z −1
b2

−a1

−a2

Figure 10.1: Problem 27: Block diagram.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.32

10.28 Considering vi [n], i = 1, 2, the state variables in the controller form for zero initial conditions the
z-transform of the state variable equations and the output are
" #" # " #
z + a1 a2 V1 (z) 1
= Xc (z)
−1 z V2 (z) 0
Yc (z) = b1 V1 (z) + b2 V2 (z)

Using Cramer’s rule to solve for Vi (z) we have

zXc (z) Xc (z) b1 z + b2


Yc (z) = b1 + b2 = 2 Xc (z
∆(z) ∆(z) z + a1 z + a2

after replacing ∆(z) = z 2 + a1 z + a2 .


For the second form, letting wi [n] be the state variables the z-transform for the state (zero initial condi-
tions) and the output are
" #" # " #
z + a1 −1 W1 (z) b1
= Xo (z)
a2 z W2 (z) b2
Yo (z) = W1 (z)

We find using Cramer’s:


b1 z + b2
Y0 (z) = W1 (z) = Xo (z)
z 2 + a1 z + a2
So that both forms have the same transfer function.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.33

10.29 We have " # " #" #


b1 t1 t2 1
=
b2 t3 t4 0
| {z } | {z }
bo bc

so that t1 = b1 and t3 = b2 . Then


" #
h i b1 t2 h i
1 0 = b1 b2
| {z } b2 t4 | {z }
cT
o cT
c

so that t2 = b2 . Finally,
" #" # " #" #
−a1 1 b1 b2 b1 b2 −a1 −a2
=
−a2 0 b2 t4 b2 t4 1 0
| {z } | {z }
Ao Ac

which after multiplying gives that t4 = −a2 b1 + a1 b2 . Thus


" #
b1 b2
T=
b2 −a2 b1 + a1 b2
det(T) = −a2 b21 + a1 b1 b2 − b22 6= 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.34

10.30 Using an additional variable w[n] we have

Y (z) = (0.8 − 0.2z −1 )W (z)


X(z) = (1 − z −1 + 0.5z −2 )W (z)

and defining state variables v1 [n] = w[n − 1] and v2 [n] = w[n − 2] we obtain the following matrices
" # " #
1 −0.5 1 h i
A= , b= , cT = 0.6 −0.4 , d = 0.8
1 0 0

Figure 10.2: Problem 30: Block diagram.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.35

10.2 Problems using MATLAB


10.31 (a) Using the difference equation and the given initial conditions we get the values of the Fibonacci
series:

f [0] = f [−1] + f [−2] = 0,


f [1] = f [0] + f [−1] = 1,
f [2] = f [1] + f [0] = 1
..
.

or the sequence {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, · · · } for n ≥ 0. The Z-transform of f [n] is then

F (z) = f [0] + f [1]z −1 + f [2]z −2 + f [3]z −3 + · · ·


= 0 + 1z −1 + 1z −2 + 2z −3 + · · ·

which is not in a closed-form. To get that, we use the Z-transform shift property in the given difference
equation:

F (z) = (z −1 F (z) + f [−1]) + (z −2 F (z) + f [−1]z −1 + f [−2])


= [z −1 + z −2 ]F (z) + z −1

after replacing the initial conditions. We then have that


z −1
F (z) =
1 − z −1 − z −2
We have obtained the Z-transform of the Fibonacci sequence even though we know that the sequence
blows up, and that the region of convergence for this sequence is not obvious from the development.
The zero of F (z) is at zero, and the poles are

1± 1+4
φ1,2 =
2
= 1.6183, −0.6183

The value φ1 = 1.6183 is the golden ratio which in ancient Greece was considered the most pleasing
ratio for many designs. The letter φ has been used in honor of the Greek sculptor Phidias who is said to
have used it in his work.
(b) Notice that φ1 + φ2 = 1. The partial fraction expansion is
A B
F (z) = +
1 − φ1 z −1 1 − φ2 z −1
The coefficients are found
1 1
A = F (z)(1 − φ1 z −1 )|z−1 =1/φ1 = =√
φ1 − φ2 5
1 1
B = F (z)(1 − φ2 z −1 )|z−1 =1/φ2 = = −√
φ2 − φ1 5

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.36

so for ROC: |z| > φ1 = 1.6183, the inverse is


1
f [n] = √ (φn1 − φn2 )u[n]
5
This formula was first presented by Leonhard Euler in 1765 as a formula to obtain the Fibonacci
numbes. Let us verify that this equation gives the Fibonacci numbers, f [0] = 0, f [1] = √1 (φ1 − φ2 ) =
5
1, and so on. For the region of convergence |z| > φ1 = 1.6183, the system represented by the Fibonacci
difference equation is not BIBO stable as one of its poles is outside the unit circle.
Using the poles φi we compute the Fibonacci sequence. The obtained values do not coincide exactly
with the sequence, only if we find integers that smaller using floor we obtain it.

% Pr 10_31
clear all; clf
phi1=1.6183; phi2=-0.6183;
n=0:100;
f=(phi1.ˆn-phi2.ˆn)/sqrt(5);
figure(1)
stem(n(1:10),f(1:10));grid;title(’Fibonacci sequence’);xlabel(’n’)
floor(f(1:10))

0 1 1 2 3 5 8 13 21 34

Fibonacci sequence
35

30

25

20

15

10

0
0 1 2 3 4 5 6 7 8 9
n

Figure 10.3: Problem 31: Approximate computation of Fibonacci sequence .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.37

10.32 (a) The signal x[n] = δ[n] + δ[n − 1] + δ[n − 2] has a Z-transform

X(z) = 1 + z −1 + z −2

(b) Then
Y (z) = X 2 (z) = (1 + z −1 + z −2 )2 = 1 + 2z −1 + 3z −2 + 2z −3 + z −4

The convolution of the coefficients of X(z), or x[n], with themselves gives the sequence

y[n] = δ[n] + 2δ[n − 1] + 3δ[n − 2] + 2δ[n − 3] + δ[n − 4]

The length of y[n] is twice that of x[n] minus one, or 2 × 3 − 1 = 5 so that Y (z) is a fourth -degree
polynomial. The above result is verified using MATLAB

%% Pr 10_32
x=[1 1 1];
y=conv(x,x); N=length(y);
x1=[x zeros(1,N-3)]
n=0:N-1;
figure(1)
subplot(211)
stem(n,x1),ylabel(’x[n]’);grid
subplot(212)
stem(n,y);ylabel(’y[n]’); grid
1

0.8

0.6
x[n]

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4

2.5

2
y[n]

1.5

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5 4

Figure 10.4: Problem 32: Convolution sum result.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.38

10.33 Writing X(z) using terms found in tables, its partial fraction expansion is

2 − z −1
X(z) =
2(1 + 0.25z −1 )(1 + 0.5z −1 )
A B
= +
1 + 0.25z −1 1 + 0.5z −1
corresponding to the poles at −0.25 and −0.5. The coefficients of the expansion are

2 − z −1
A = | −1 = −3
2(1 + 0.5z −1 ) z =−4
2 − z −1
B = | −1 =4
2(1 + 0.25z −1 ) z =−2

so that
−3 4
X(z) = −1
+
1 + 0.25z 1 + 0.5z −1
and the inverse is
x[n] = [−3(−0.25)n + 4(−0.5)n ]u[n]
and in the steady–state it is zero.

% Pr 10_33
syms n z
x=iztrans(2*(z-0.5)*z/(2*(z+0.25)*(z+0.5)))

x =4*((-1/2))ˆn - 3*((-1/4))ˆn

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.39

10.34 (a) The transfer function is

Y (z) 1
H(z) = =
X(z) 1 − 2r cos(ω0 )z −1 + r2 z −2

(b) The transfer function can be written

z2
H(z) =
(z − rejω0 )(z − re−jω0 )

so that the poles of the system are at re±jω0 . For the system to be stable the poles should be inside the
unit circle, thus r < 1 and 0 ≤ ω0 ≤ 2π. If r = 0.5 and ω0 = π/2 the following script plots the poles
and zeros of H(z):

%% Pr 10_34
clear all; clf
r=0.5;w0=pi/2;
a=[1 -2*r*cos(w0) rˆ2]
b=1;
zplane(b,a)

0.8

0.6

0.4

0.2
Imaginary Part

0 2

−0.2

−0.4

−0.6

−0.8

−1

−1 −0.5 0 0.5 1
Real Part

Figure 10.5: Problem 34: Poles/zeros of H(s) when r = 0.5 and ω0 = π/2.

(c) If ω0 = π/2, then cos(π/2) = 0 and the transfer function becomes


1
H(z) =
1 + r2 z −2
and then
h[n] = rn cos(πn/2)u[n]

If ω0 = 3π/2 we will get the same transfer function and impulse response as cos(3π/2) = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.40

10.35 (a) Thinking of the given Z-transform as a transfer function with x[n] as the input and y[n] as the output
we have that
AX(z)(1 − cos(ω0 )z −1 ) = Y (z)(1 − 2 cos(ω0 )z −1 + z −2 )
which gives the following difference equation

y[n] − 2 cos(ω0 )y[n − 1] + y[n − 2] = Ax[n] − A cos(ω0 )x[n − 1] n≥0

with zero initial conditions and input x[n] = δ[n] that will generate the cosine function.
(b) We have that ω0 = π/2 so that cos(ω0 ) = 0 giving the difference equation

y[n] + y[n − 2] = 2δ[n] n≥0

with zero initial conditions. Recursively this equation gives

y[0] = 2
y[1] = 0
y[2] = −2
y[3] = 0
..
.

or y[n] = 2 cos(πn/2)u[n].
(c) The signal to be generated y1 [n] = 2 sin(πn/2) gives for n ≥ 0

y1 [0] = 0
y1 [1] = 2
y1 [2] = 0
y1 [3] = −2
..
.

i.e., y1 [n] = y[n − 1], so that the above difference equation shifted by 1 gives

y[n − 1] + y[n − 3] = 2δ[n − 1] n−1≥0


y1 [m] + y1 [m − 2] = 2δ[m] m≥0

which gives

y1 [0] = −y[−2] + 2 = 0
y1 [1] = −y[−1] + 0 = 2
y1 [2] = y1 [0] = 0
y1 [3] = −y[1] = 2
..
.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.41

so that the initial conditions are y[−2] = 2 and y[−1] = −2.


Another way to obtain the initial conditions to generate 2 sin(πn/2) with the same difference equation
as before is in the z-domain

2X(z) − y[−1]z −1 − y[−2]


Y (z) =
1 + z −2

If we let X(z) = 1 (i.e. x[n] = δ[n]) and initial conditions y[−2] = 2 and y[−1] = −2 we get

2z −1
Y (z) =
1 + z −2

which is the Z-transform of the desired signal.

The following script computes and plots the two sinusoids. To generate the sine, we compute the first
two values using the initial conditions and the input, and then use the difference equation to obtain the
rest using a for loop.

%% Pr 10_35
clear all; clf
% generation of 2cos(pi n/2)
b=2;
a=[1 0 1];
x=[1 zeros(1,100)];
y=filter(b,a,x);
n=0:length(y)-1;
figure(1)
subplot(211)
stem(n,y); axis([0 100 -2.2 2.2]); grid; ylabel(’y[n]’)
hold on; plot(n,y,’:r’); hold off
% generation of 2sin(pi n/2)
y1(1)=0;y1(2)=2;
for m=3:101,
y1(m)=-y1(m-2);
end
subplot(212)
stem(n,y1); axis([0 100 -2.2 2.2]);grid; ylabel(’y_1[n]’);xlabel(’n’)
hold on; plot(n,y1,’:r’); hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.42

y[n]
0

−1

−2
0 10 20 30 40 50 60 70 80 90 100

y1[n]
0

−1

−2
0 10 20 30 40 50 60 70 80 90 100
n

Figure 10.6: Problem 35: Generation of 2 cos(πn/2) (top) and 2 sin(πn/2) (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.43

10.36 (a) To find the unit–step response, the input is x[n] = u[n] and the initial conditions are zero. We then
have
1
Y (z)[1 − z −1 + 0.5z −2 ] = (1 + z −1 )
1 − z −1
1 + z −1
Y (z) =
(1 − z −1 )(1 − 0.5(1 + j)z −1 )(1 − 0.5(1 − j)z −1 )
(b) The partial fraction expansion is
A B B∗
Y (z) = + +
1 − z −1 1 − 0.5(1 + j)z −1 1 − 0.5(1 − j)z −1
A = Y (z)(1 − z −1 )|z−1 =1 = 4
o
B = Y (z)(1 − 0.5(1 + j)z −1 )|z−1 =0.5(1+j) = 1.58e−j161.5

(c) The inverse Z-transform is then


" √!n √ !n #
2 jπ/4 ∗ 2 −jπ/4
y[n] = A+B e +B e u[n]
2 2
√ !n
2
= [A + |B| [ej(πn/4+∠B) + e−j(πn/4−∠B) ]]u[n]
2
√ !n
2
= [A + 2|B| cos(πn/4 + ∠B)]u[n]
2
= [4 + 3.16(0.707)n cos(πn/4 − 161.5o )]u[n]

The following script is used to verify the above result using MATLAB

%% Pr 10_36
clear all; clf
N=[1 1 0 0];
D=conv([1 -1],[1 -1 0.5])
[r,p,k]=residuez(N,D)
abs(r(2))
angle(r(2))*180/pi
n=0:49;
y=r(1)*(p(1).ˆn)+r(2)*(p(2).ˆn)+r(3)*(p(3).ˆn);
figure(1)
subplot(311)
zplane(N,D)
subplot(312)
stem(n,y); ylabel(’y[n]’)
% verification
y1=4+3.16*(0.707).ˆn.*cos(pi.*n/4-161.5*pi/180);
subplot(313)
stem(n,y1); ylabel(’y_1[n]’); xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.44

Imaginary Part
0 2

−1
−5 −4 −3 −2 −1 0 1 2 3 4 5
Real Part
6

y[n]
2

0
0 5 10 15 20 25 30 35 40 45 50

4
y1[n] 2

0
0 5 10 15 20 25 30 35 40 45 50
n

Figure 10.7: Problem 36: Verification of unit-step response using residues and analytic solution. Poles and
zeros of Y (z); unit–step response found using the partial fraction expansion with MATLAB (middle) and
analytically (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.45

10.37 (a) The following script obtains the Prony rational approximation of the first 100 value of h[n] =
0.9n u[n].

% Pr. 10_37
clear all; clf
n=[0:100];
h=0.9.ˆn;
[b,a]=prony(h,1,1); % rational approximation of order (1,1) of h
delta=[1 zeros(1,100)];
hd=filter(b,a,delta); % approximate sequence
figure(1)
subplot(211)
plot(n,h,’o’,n,hd,’+’)
xlabel(’n’)
ylabel(’h[n],hd[n]’)
grid
p=roots(a) % poles
z=roots(b) % zeros
subplot(223)
stem(n,hd-h); ylabel(’error’)
subplot(224)
zplane(b,a)

0.8
h[n],hd[n]

0.6

0.4

0.2

0
0 10 20 30 40 50 60 70 80 90 100
n
−15
x 10
2.5 1

2
0.5
Imaginary Part

1.5
error

0
1
−0.5
0.5

−1
0
0 20 40 60 80 100 −1 −0.5 0 0.5 1
Real Part

Figure 10.8: Problem 37: Prony approximation, of order (1, 1), of finite segment of h[n] = 0.9n u[n] .

The poles and zeros corresponding to the actual and the approximate are very close.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.46

(b) The convolution of h1 [n] = 0.9n u[n] and h2 [n] = 0.8n u[n] is done using the MATLAB func-
tion conv. The Prony approximation of h1 [n] ∗ h2 [n] gives an approximation to H1 (z)H2 (z) for the
correct orders. Using prony of order (2, 2) (in general this has to be guessed, but here we have the
advantage of knowing the sequences, a big advantage!).

clear all; clf


n=[0:99];
h1=(0.9).ˆn;
h2=(0.8).ˆn;
h=conv(h1,h2);
[b,a]=prony(h,2,2) % rational approximation of order (2,2) of h
delta=[1 zeros(1,100)];
hd=filter(b,a,delta); % approximate sequence
subplot(211)
plot(n,h(1:100),’o’,n,hd(1:100),’+’)
xlabel(’n’)
ylabel(’h(n),hd[n-’)
grid
p=roots(a) % poles
z=roots(b) % zeros
subplot(212)
zplane(b,a)

The following are the results obtained. Notice that the poles/zeros are those of H1 (z) and H2 (z) or the
product H(z) = H1 (z)H2 (z).

b = 1.0000 -0.0000 -0.0000


a = 1.0000 -1.7000 0.7200
p =0.9000
0.8000
z =1.0e-004 *
0.2674
-0.2674

(c) When the chosen order is higher than the actual one, it is possible to have a pole-zero cancelations.
For the h[n] = [h1 ∗ h2 ][n] when using prony instead of a second-order approximation we choose a
third-order, the results has a pole/zero cancellation.

[b1,a1]=prony(h,3,3)
p=roots(a1)
z=roots(b1)
subplot(211)
zplane(z,p)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.47

2.5

h[n],hd[n]
1.5

0.5

0
0 10 20 30 40 50 60 70 80 90 100
n

0.5
Imaginary Part

−0.5

−1
−3 −2 −1 0 1 2 3
Real Part

Figure 10.9: Problem 37: Prony approximation of convolution h1 [n] and h2 [n].

delta=[1 zeros(1,120)];
hd=filter(b1,a1,delta);
M=length(h);
n=[0:ceil(M/2)-1];
subplot(212)
plot(n,h(1:ceil(M/2)),’o’,n,hd(1:ceil(M/2)),’+’)

The results in this case are

b1 =
1.0000 0.0000 -0.0000 -0.0000
a1 =
1.0000 -1.7000 0.7200 0.0000

p =
0.9000
0.8000
-0.0000
z =
1.0e-03 *
0.9266
-0.4633 + 0.8017i
-0.4633 - 0.8017i

showing the same poles as before, which means a third one has been cancelled.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.48

10.38 (a) In the case of MATLAB, the expansion is given by

A (B + C) − 2Bz −1
X(z) = +
1 − z −1 (1 − 2z −1 )2

and in our case, we get


D E − (2E − F )z −1
X(z) = −1
+
1−z (1 − 2z −1 )2
so that the numerator corresponding to the double pole is a first degree polynomial in z −1 . This
is also encouraging as the term for the second order pole is proper for MATLAB and for our
expansion.
For MATLAB’s expansion, the coefficients are found to be:

A = X(z)(1 − z −1 )|z−1 =1 = 2
C = X(z)(1 − 2z −1 )2 |z−1 =1/2 = 2

To find B we choose z −1 = 0 to get

0=A+B+C

so that B = −A − C = −4.
For our expansion, the coefficients are

D = X(z)(1 − z −1 )|z−1 =1 = 2
X(z)(1 − 2z −1 )2
F = |z−1 =1/2 = 4
z −1
To find E we choose again z −1 = 0 to get

0=D+E

so that E = −D = −2. Thus we have

2 −2 + 8z −1
MATLAB X(z) = +
1 − z −1 (1 − 2z −1 )2
2 −2 + 8z −1
Ours X(z) = +
1 − z −1 (1 − 2z −1 )2

(b) Consider the following pair

αz −1
g[n] = nαn u[n] ⇔ G(z) =
(1 − αz −1 )2

which we will use to find the inverse of the last term in our expansion. The signal corresponding
to G(z)z = 1/(1 − αz −1 )2 would be g[n + 1] = (n + 1)αn+1 u[n + 1], or g[n] = nαn u[n]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.49

advanced by one sample. The signal g[n + 1] is zero for n < 0 (g[−1] = 0), thus causal, so we
can write it
g[n + 1] = (n + 1)αn+1 u[n].

So the inverse of the last term in MATLAB’s expansion is 0.5C [n + 1] 2[n+1] u[n].
The inverse of the MATLAB expression
2 4 2
X(z) = −1
− −1
+
1−z 1 − 2z (1 − 2z −1 )2

is given by

x[n] = [2 − 4 (2n ) + (n + 1)2n+1 ]u[n] = [2 − 4 (2n ) + 2n2n + 2 2n ]u[n]


= 2 [1 − 2n + n 2n ]u[n]

while the inverse of our expansion

2 2 4z −1
X(z) = − +
1 − z −1 1 − 2z −1 (1 − 2z −1 )2

is
x[n] = 2[1 − 2n + 2n n]u[n]

showing the two solutions are equal, as expected.

% Pr 10_38
% inverse
syms n z
x=iztrans(2*zˆ2/(2*(z+0.25)*(z+0.5)))
% x = 2*2ˆn*(n - 1) +2

% residues
a1=[1 -1]; a2=[1 -2]; a=conv(conv(a2,a2),a1)
b=[0 2]
[r,p,k]=residuez(b,a)
% r = -4.0000
% 2.0000
% 2.0000
% p = 2.0000
% 2.0000
% 1.0000

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.50

10.39 (a) The transfer function of the overall system is


1 1
H(z) = H1 (z) + H2 (z) = =
(1 + 0.5z −1 )(1 − z −1 + 0.5z −2 ) 1 − 0.5z −1 − 0.25z −3

The denominator coefficients can be obtained using conv function to multiply the two terms in the denominator.
(b) (c) The following script is used to find the state variable representations for Hi (z), i = 1, 2 and then for H(z).
The representations are not equal.

% Pr 10_39
% H(z) state variable model
d1=[1 0.5]; d2=[1 -1 0.5];
den=conv(d1,d2)
num=[1 0 0 0]
[A,B,C,D]=tf2ss(num,den)
[num1,den1]=ss2tf(A,B,C,D,1)
% H1(z) state variable model
num1=[1 0]; den1=[1 0.5];
[A1,B1,C1,D1]=tf2ss(num1,den1)
% H2(z) state variable model
num2=[0.8 -0.2 0]; den2=[1 -1 0.5];
[A2,B2,C2,D2]=tf2ss(num2,den2)
% verification
[nu,de]=ss2tf(A1,B1,C1,D1,1)
[nu1,de1]=ss2tf(A2,B2,C2,D2,1)

den = 1.0000 -0.5000 0 0.2500


num = 1 0 0 0
A = 0.5000 0 -0.2500
1.0000 0 0
0 1.0000 0
B =1
0
0
C = 0.5000 0 -0.2500
D = 1

A1 = -0.5000
B1 = 1
C1 = -0.5000
D1 = 1

A2 = 1.0000 -0.5000
1.0000 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.51

B2 =1
0

C2 =0.6000 -0.4000

D2 = 0.8000

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 10.52

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 11

Fourier Analysis of Discrete–time


Signals and Systems

11.1 Basic Problems


11.1 The DTFT of x[n] = 0.5|n| is
3/4
X(ejω ) =
5/4 − cos(ω)
(a) If we let ω = 0 then
3/4 X
X(1) = =3= x[n]
5/4 − 1 n

(b) The inverse DTFT is Z π


1
x[n] = X(ejω )ejωn dω
2π −π

if we let n = 0 we get that Z π


1
X(ejω )dω = x[0]
2π −π

and so the given integral is 2πx[0] = 2π.


(c) From the DTFT, X(ejω ) is real and since the denominator, i.e., 5/4 − cos(ω), is positive for [−π, π)
the phase ∠X(ejω ) = 0.
(d) If we let ω = π in the DTFT we obtain
X 3/4 1
x[n](−1)n = X(ejπn ) = =
n
9/4 3

1
Chaparro — Signals and Systems using MATLAB 11.2

11.2 (a) We have


i. DTFT
2
X
X(ejω ) = e−jωn = 1 + 2 cos(ω) + 2 cos(2ω)
n=−2

ii. Z-transform

X(z) = z 2 + z + 1 + z −1 + z −2 ROC |z| > 0



X(e ) = X(z)|z=ejω ROC includes UC

which coincides with the previous result.


P2
iii. X(ej0 ) = n=−2 1 = 5
(b) Problem 2(b)
We have
0
X ∞
X 1
X(z) = αn z −n = α−m z m = , ROC: |z| < α
n=−∞ m=0
1 − z/α

so ROC must include the unit circle (UC) and as such α > 1.

(c) Problem 2(c)

i. Z-transforms
∞  n
X 1 1 z
X1 (z) = z −n = −1
= |z| > 0.5
n=0
2 1 − 0.5z z − 0.5
−1  n
X X∞
1 z
X2 (z) = − z −n = − 2m z m + 1 = |z| < 0.5
n=−∞
2 m=0
z − 0.5

ii. Since the ROC X1 (z) includes the UC then X1 (ejω ) = X1 (z)|z=ejω .

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.3

11.3 Writing
2
X 2
X
t[n] = (3 − |k|)δ[n − k] = 3δ[n] + (3 − k)(δ[n + k] + δ[n − k])
k=−2 k=1

Ak = 3 − |k|, for −2 ≤ k ≤ 2, 0 otherwise.


The Z-transform of t[n] is
2
X
T (z) = 3 + (3 − k)(z k + z −k )
k=1

so that the DTFT is


2
X

T (e ) = 3+ (3 − k)[ejωk + e−jωk ]
k=1
2
X
= |{z}
3 + 2(3 − k) cos(kω)
| {z }
B0 k=1
Bk

for k > 2, Bk = 0.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.4

11.4 (a) Impulse response


Z π/2 
1 jωn 0.5 n=0
h[n] = e dω =
2π −π/2 6 0
sin(πn/2)/(πn) n =

h[n] is non-causal as h[n] 6= 0 for n < 0.


(b) Y (ejω ) = X(ejω )H(ejω ) = H(ejω ) so y[n] = h[n]
(c) Yes, H(ejω ) = H(ejω )H(ejω ) so h[n] = (h ∗ h)[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.5

11.5 (a) The DTFT of x[n] = ejθ δ[n + τ ] + e−jθ δ[n − τ ] is

X(ejω ) = ejθ ejωτ + e−jθ e−jωτ = 2 cos(ωτ + θ)

by duality (ω → n, τ → ω0 )
 
cos(nω0 + θ) ↔ π ejθ δ(ω + ω0 ) + e−jθ δ(ω − ω0 )

For θ = 0

cos(nω0 ) ↔ π [δ(ω + ω0 ) + δ(ω − ω0 )]

For θ = π/2

cos(nω0 + π/2) = sin(nω0 ) ↔ π [jδ(ω + ω0 ) − jδ(ω − ω0 )]

(b) Replacing DTFT of cosine terms


5
X

X1 (e ) = 2πδ(ω) + Ak π[ejθk δ(ω + kω0 ) + e−jθk δ(ω − kω0 )]
k=1

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.6

11.6 (a) We have



2h[n] n even
h1 [n] = h[n](1 + ejπn ) = h[n] + h[n]ejπn =
0 otherwise
so
H1 (ejω ) = H(ejω ) + H(ej(ω+π) )
thus since H(ejω ) corresponds to a LPF then H1 (ejω ) is a band-eliminating filter. Sketch its
frequency response to verify it.
(b) i. Using DTFT

X 0.75
H(ej0 ) = h[n] = =3
n=−∞
1.25 − 1

ii. Using IDTFT


Z π Z π
1 1
h[−n] = H(ejω )e−jωn dω = H(e−jω )e−jωn dω
2π −π 2π −π
Z π
1 0 0
= H(ejω )ejω n dω 0 = h[n]
2π −π

where ω 0 = −ω.
iii. The denominator 1.25 − cos(ω) of H(ejω ) is positive for (−π, π], so H(ejω ) is real and
positive, with zero phase.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.7

11.7 (a) (a) (b) DTFT


X(ejω ) = 1 − e−j2ω = 2je−jω sin(ω)
Yes, X(ejω ) is periodic of period 2π since ω + 2kπ = ω. |X(ejω )| = 2| sin(ω)| is periodic of

|X(ejω )|

ω
−π π

∠X(ejω )

ω
−π π

Figure 11.1: Problem 7: Magnitude and phase of X(ejω )

period π, but also periodic of period 2π.


(b) Phase

−ω + π/2 if sin(ω) > 0
∠X(ejω ) =
−ω + 3π/2 = −ω − π/2 if sin(ω) ≤ 0

and because of the odd symmetry of the phase it is zero at ω = 0. See Fig. 11.1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.8

11.8 (a) DTFT

X(ejω ) = X(z)|z=ejω = (z 2 + z + 1 + z −1 + z −2 )|z=ejω


= 1 + 2 cos(ω) + 2 cos(2ω)

Magnitude values

ω |X(ejω )|
0 5
±π/2 1
±π 1

(b) Down-sampled signal



1 −1 ≤ n ≤ 1
x1 [n] = x[2n] =
0 otherwise
X1 (ejω ) = 1 + 2 cos(ω)

Magnitude values

ω |X1 (ejω )|
0 3
±π/2 1
±π 1

Aliasing occurs since

0.5X(ejω/2 ) = 0.5[1 + 2 cos(ω/2) + 2 cos(ω)] 6= 1 + 2 cos(ω) = X1 (ejω )

Passing x[n] through an ideal LPF of bandwidth π/2 we can decimate it without aliasing, although
losing the higher frequency components.
(c) Up-sampled signal

x[n/2] n even
x2 [n] =
0 otherwise

X2 (ejω ) = X2 (z)|z=ejω = z 4 + z 2 + 1 + z −2 + z −4 |z=ejω


= 1 + 2 cos(2ω) + 2 cos(4ω)

here X2 (ejω ) = X(ej2ω ).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.9

11.9 (a) If Ĥ(ejω ) = A[u(ω + ω0 ) − u(ω − ω0 )] with zero phase. To determine A and ω0 find the impulse
response
Z
A ω0 jωn A
ĥ[n] = e dω = sin(ωo n)
2π −ω0 πn

so ω0 = π/3 and A = 1 and since h[n] = ĥ[n − 10] we have

H(ejω ) = e−j10ω Ĥ(ejω ) = e−j10ω [u(ω + π/3) − u(ω − π/3)]

so the magnitude and phase responses are



jω 1 −π/3 ≤ ω ≤ π/3
|H(e )| =
0 otherwise in − π < ω ≤ π
∠H(ejω ) = −10ω −π <ω ≤π

(b) X(ejω ) = e−jω + πδ(ω + π/5) + πδ(ω − π/5) then

Y (ejω ) = X(ejω )H(ejω )


= H(ejω )e−jω + πH(e−jπ/5 )δ(ω + π/5) + πH(ejπ/5 )δ(ω − π/5)
= H(ejω )e−jω + πej10π/5 δ(ω + π/5) + πe−j10π/5 δ(ω − π/5)
= H(ejω )e−jω + πδ(ω + π/5) + πδ(ω − π/5)

and

y[n] = h[n − 1] + cos(πn/5) −∞<n<∞

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.10

11.10 (a) The Z-transform


1
X(z) = |z| > |β|
1 − βz −1
So when β ≥ 1 the region of convergence does not include the unit circle so the DTFT X(ejω )
cannot be found. If β < 1, the ROC includes the UC and

X(ejω ) = X(z)|z=ejω

(b) We have
i. The inverse is Z π
1 1
x[n] = δ(ω)ejωn dω =
2π −π 2π
ii. The inverse is Z π
1 (−1)n
x1 [n] = δ(ω − π)ejωn dω =
2π −π 2π
iii. δ(ω) = δ(−ω) so x2 [n] = 2x[n] = 1/π.
(c) Yes, cross-multiplying

(1 + e−jω + · · · + e−jω(N −1) )(1 − e−jω ) = 1 − e−jωN

when N = 1 we get an identity, 1 = (1 − e−jω )/(1 − e−jω ).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.11

11.11 (a) Frequency response

e−jω
H(ejω ) = (1 + 2 cos(ω))
3
1 + 2 cos(ω)

|H(e )| =
3

−ω 1 + 2 cos(ω) ≥ 0
∠H(ejω ) =
−ω + π 1 + 2 cos(ω) < 0

(b) Poles and zeros

z2 + z + 1 (z + 0.5)2 + 3/4
H(z) = =
3z 2 3z 2 √
Poles: z = 0 double, zeros: z1,2 = −0.5 ± j 3/2

the poles are at the origin and the zeros on the unit circle (|z1,2 | = 1. The ROC is the whole
Z–plane except for z = 0.
(c) If 1 + 2 cos(ω0 ) = 0, then the magnitude is zero and this happens at ω0 = cos−1 (−0.5)
(d) Because the zeros are on the unit circle the difference between discontinuities in the wrapped
phase is not 2π, so unwrapping would not change the phase.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.12

11.12 (a) Frequency response

H(ejω ) = e−j2ω (1.2 + cos(ω))


∠H(ejω ) = −2ω linear, as 1.2 + cos(ω) > 0 ω ∈ (−π, π]

(b) Impulse response

0.5 z −1 + |{z}
H(z) = |{z} 1.2 z −2 + |{z}
0.5 z −3
h[1] h[2] h[3]

h[n] is symmetric with respect to n = 2, so the phase is linear.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.13

11.13 (a) Summation:


1
1 X −j2πnk/5 1
X1 [k] = e = (1 + 2 cos(2πk/5))
5 n=−1 5

Z–transform:
1 1
X1 [k] = [z + 1 + z −1 ]z=ej2πk/5 = (1 + 2 cos(2πk/5)) 0≤k≤4
5 5
The {X1 [k]} are real since the signal is even.
(b) Z-transform
1 1
X2 [k] = [2z + 1 + 0.5z −1 ]z=ej2πk/5 = [2ej2πk/5 + 1 + 0.5e−j2πk/5 ] 0≤k≤4
5 5
Since the signal is neither even nor odd, the coefficients are complex.
(c) Z-transform
1 1
X3 [k] = [0.5z + 1 + 2z −2 ]z=ej2πk/5 = [0.5ej2πk/5 + 1 + 2e−j2πk/5 ] 0≤k≤4
5 5
Since the signal is neither even nor odd, the coefficients are complex.
(d) Z-transform
1 1
X4 [k] = [−z + z −2 ]z=ej2πk/5 = [−ej2πk/5 + e−j2πk/5 ]
5 5
2j
= − sin(2πk/5), 0 ≤ k ≤ 4
5
The signal is odd so the coefficients are imaginary.
(e) If the period is considered from n = 0 to 4

 1 n = 0, 1
x1 [n] = 0 n = 2, 3

1 n=4
1 1
X1 [k] = [1 + z −1 + z −4 ]z=ej2πk/5 = [1 + e−j2πk/5 + e|−j8πk/5
{z }]
5 5
ej2πk/5

where in the last term we used e−j8πk/5 = e−j10πk/5 ej2πk/5 = 1 × ej2πk/5 . Same as before.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.14

11.14 (a) Each of these signals are periodic and represented by their trigonometric Fourier series, we need
to convert them into their complex exponential form. Only the non-zero coefficients are shown.

1 + (−0.5) ej2πn/3 + (−0.5) e−j2πn/3 , ω0 = 2π/3


x1 [n] = |{z}
| {z } | {z }
X1 [0] X1 [−1] X1 [1]

x2 [n] = 2 + cos(2πn(3 + 1)/3) = 2 + cos(2πn/3)


= |{z}
2 + |{z} 0.5 e−j2πn/3 , ω0 = 2π/3
0.5 ej2πn/3 + |{z}
X2 [0] X2 [−1] X2 [1]

x3 [n] = x1 [n] + x2 [n], X3 [0] = 3, X3 [1] = X3 [−1] = 0, ω0 = 2π/3

x4 [n] = x2 [n] + 1 − x1 [n], X4 [0] = X2 [0] + 1 − X1 [0] = 2,


X4 [1] = X4 [−1] = 1, ω0 = 2π/3

x5 [n] = cos(2πn/6) + cos((2π/6)3n),


N0 = 6, ω0 = π/3
0.5 e−j2πn/6 + |{z}
0.5 ej2πn/6 + |{z}
x5 [n] = |{z} 0.5 e−j(2π/6)3n
0.5 ej(2π/6)3n + |{z}
X5 [1] X5 [−1] X5 [3] X5 [−3]

(b)
1 1
Y [k] = [1 + 0.5z −1 + 0.25z −2 ]z=ej2πk/3 = [1 + 0.5e−j2πk/3 + 0.25e−j4πk/3 ]
3 3
1
V [k] = [0.25z 2 + 0.5z + 1 + 0.5z −1 + 0.25z −2 ]z=ej2πk/5
5
1
= [1 + cos(2πk/5) + 0.5 cos(4πk/5)]
5
1
W [k] = [2 + 1.5z −1 + 1.25z −2 + 1.125z −3 ]z=ej2πk/4
4
1
= [2 + 1.5e−jπk/2 + 1.25e−jπk + 1.125e−j3πk/2 ]
4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.15

11.15 (a) The period of x(t) is T0 = 2 (Ω0 = π). The Fourier series coefficients of x(t) are
Z 1
1 e−jπk/2
Xk = e−jπkt dt = sin(πk/2), k 6= 0
2 0 πk

and X0 = 1/2. x(t) is not band-limited as Xk does not go to zero for finite frequencies.
(b) Assuming Ωmax = 5π corresponding to |X5 | = | sin(5π/2)|/(5π) ≈ 1/16 with a power contri-
bution of 1/(16)2 which is much smaller than the dc contribution of 0.25, so it is a good value.
Then Ωs ≥ 10π so that Ts ≤ 2π/(10π) = 0.2.
(c) Let Ts = 0.1, the discretized x(0.1n) has a fundamental period N0 = 21. The discrete Fourier
series coefficients are
10
1 X −j2πnk/21 1 1 − e−jπ22k/21
X[k] = e =
21 n=0 21 1 − e−j2πk/21
e−jπ11k/22 sin(π11k/21)
=
21e−jπk/21 sin(πk/21)
11
X[0] = ≈ X0 = 0.5
21
e−j11π/22 sin((11/21)π) e−jπ/2 sin(π/2)
X[1] = ≈ = X1
21e−jπ/21 sin(π/21) 21e−jπ/21 π/21

where we let 11/21 ≈ 1/2 and sin(π/21) ≈ π/21.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.16

11.16 (a) If x[n] is periodic of fundamental period N0 its DTFT is

0 −1
NX
X(ejω ) = 2πX[k]δ(ω − kω0 ), ω0 = 2π/N0
k=0

then the DTFT of the output would be


0 −1
NX
Y (ejω ) = 2π X[k]H(ejkω0 ) δ(ω − kω0 )
| {z }
k=0
Y [k]

From the given y[n] the frequency is ω0 = 0.2π = 2π/N0 so N0 = 10.


(b) We have
4
X
y[n] = X[k]H(ejkω0 )ej2πkn/10
k=−5
4
X −1
X
= X[0]H(ej0 ) + X[k]H(ejkω0 )ej2πkn/10 + X[k]H(ejkω0 )ej2πkn/10
k=1 k=−5

which compared with the given

y[n] = 1+2 cos(2πn/N0 )+1 cos(4πn/N0 ) = 1+ej2πn/N0 +e−j2πn/N0 +0.5ej4πn/N0 +0.5e−j4πn/N0

gives that

k=0 X[0]H(ej0 ) = 1
k = ±1 X[1]H(ejω0 ) = X[−1]H(e−jω0 ) = 1
k = ±2 X[2]H(ej2ω0 ) = X[−2]H(e−j2ω0 ) = 1/2

and others are zero. There are many possible answers, one is when we let the filter have H(ej0 ) =
H(ejω0 ) = H(e−jω0 ) = 1 and H(ej2ω0 ) = H(e−j2ω0 ) = 1/2 then X[0] = X[1] = X ∗ [−1] =
X[2] = X ∗ [−2] = 1 and the rest are zero. This gives a signal

x[n] = 1 + 2 cos(2πn/10) + 2 cos(4πn/10)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.17

11.17 (a) The impulse response is h[n] = (1/3)[δ[n] + δ[n − 1] + δ[n − 2] so that y[n] = (1/3)(x[n] +
x[n − 1] + x[n − 2]) for n ≥ 0, so

y[0] = (1/3)(x[0] + x[−1] + x[−2]) = 0


y[1] = (1/3)(x[1] + x[0] + x[−1]) = 0
y[2] = (1/3)(x[2] + x[1] + x[0]) = 0

(b) Convolution sum:


Impulse response h[n] = (1/3)(δ[n] + δ[n − 1] + δ[n − 2])
n
X n
1 X
y[n] = x[k]h[n − k] = x[k](δ[n − k] + δ[n − k − 1] + δ[n − k − 2]
3
k=−∞ k=−∞
1
= (x[n] + x[n − 1] + x[n − 2])
3
which is the average of three consecutive values of x[n] or 0. The steady state is y[n] = 0 which
is attained at n = 0.
(c) The Fourier series coefficients of x[n] are
1
X[k] = (1 − 2z −1 + z −2 )|z=ej2πk/3
3
e−j2πk/3 j2πk/3 −2e−j2πk/3
= (e − 2 + e−j2πk/3 ) = [1 − cos(2πk/3)]
3 3
giving X[0] = 0 and X[1] = X ∗ [−1] = −(2/3)e−j2π/3 (1 − cos(2π/3)) = e−j2π/3 , and
ω0 = 2π/3. So that
1
X 1
X
X(ejω ) = F[ X[k]ejkω0 n ] = 2πX[k]δ(ω − kω0 )
k=−1 k=−1
= 2πX[−1]δ(ω + ω0 ) + 2πX[1]δ(ω − ω0 )

The filter frequency response is

e−jω jω e−jω
H(ejω ) = (e + 1 + e−jω ) = (1 + 2 cos(ω))
3 3
giving H(ej0 ) = 1, H(ej2π/3 ) = 0. Thus the output is

Y (ejω ) = X(ejω )H(ejω ) = 2πX[−1]H(ej2π/3 ) + 2πX[1]H(e−j2π/3 ) = 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.18

11.18 See Fig. 11.2. Going in the clockwise direction for each shifted signal starting at the east location, at
n = 0, gives the values of the signal.

x[n] x[n − 2]
3 1

2 0
0 2

1 3

x[n + 2] 1 x[−n] 1

0 2 2 0

3 3

x[−n + 1] 2

3
1

Figure 11.2: Problem 18: Circular representation of periodic signals.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.19

11.19 (a) x[n]y[n] = 1 + ejω0 n + ej2ω0 n + ej3ω0 n for ω0 = 2π/N .


(b) The periodic convolution of length N = 3, Z[k] = Xk ~N Yk , gives Z[0] = 2, Z[1] = 1, Z[2] = 1
(See Fig. 11.3) so that
z[n] = 2 + ejω0 n + ej2ω0 n

0, 1, 1
N =3

0
1 1, 0, 1

1, 1, 0

Figure 11.3: Problem 19 — inside circle: X[k] clockwise; outside circle: Y [−k] anti–clockwise. Outside
circle shifts clockwise giving Z[0] = 2, Z[1] = 1, Z[2] = 1.

If N = 3, ω0 = 2π/3 and

x[n]y[n] = 1 + ej2πn/3 + ej4πn/3 + e|j6πn/3


{z } = z[n]
1

With N = 3 it is possible to make x[n] and y[n] of the same length.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.20

11.20 See Fig. 11.4.


(a) N0 = 4, v[n] = (x ∗ x)[n] gives v[0] = 1, v[1] = 2, v[2] = 1, v[3] = 0
(b) N0 = 4, z[n] = x[n] ∗ x[−n] gives z[0] = 2, z[1] = 1, z[2] = 0, z[3] = 1

N =4 1001

0
0011 0
v[n]
1 1100
1

0110

1001

1
0011 1
z[n]
0 1100
0

0110

Figure 11.4: Problem 20— Top: periodic convolution of x[n] with itself (x[n] in inside circle and x[−n]
in outside circle); bottom: periodic convolution of x[n] wiht x[−n](x[−n] in inside circle, x[−n] in outside
circle). Values of v[n] and z[n] obtained shifting outside circle clockwise and multiplying corresponding
spokes and adding them.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.21

11.21 (i) DFT of length L = 4 of x[n]


L−1
X 3
X
X[k] = x[n]e−j2πnk/L = x[n]e−j2πnk/4
n=0 n=0
2
X 
3 k=0
= e−j2πnk/4 = −j2π3k/4 −j2πk/4
(1 − e )/(1 − e ) k = 1, 2, 3
n=0

(ii) DFT of length L = 4 of x1 [n] = x[n − 3] can be done in two different ways
Method 1– using the shift property

X1 [k] = X[k]e−j2π3k/4 = (1 + e−j(2π/4)k + e−j(2π/4)2k )e−j(2π/4)3k


= e−j(2π/4)3k + e−j(2π/4)4k + e−j(2π/4)(4+1)k
= e−j2π3k/4 + 1 + e−j2πk/4 = e−j(8−2)πk/4 + 1 + e−j2πk/4
= 1 + 2 cos(πk/2)

Method 2 – using circular shift: a period of the periodic extension of period L = 4 is

x̃1 [n] = δ[n] + δ[n − 1] + δ[n + 1]

which gives
X1 [k] = 1 + e−j2πk/4 + ej2πk/4
(iii) Using the circular shift
x̃2 [n] = δ[n] + δ[n − 2] + δ[n − 3]
so
X2 [k] = 1 + e−j4πk/4 + e−j(8−2)πk/4 = 1 + e−jπk + ejπk/2
Another way is using the property that the DFT of x[−n] is X[−k] if X[k] is DFT of x[n]

X2 [k] = X[−k] = 1 + ej2πk/4 + ej4πk/4 = 1 + ejπk/2 + ejπk

(iv) Using circular shift x̃3 [n] = δ[n − 1] + δ[n − 2] + δ[n + 1] so

X3 [k] = e−j2πk/4 + e−j2π2k/4 + ej2πk/4 = e−j2πk/4 + e−jπk + ej2πk/4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.22

11.22 (a) N = 3, z[n] = (x ∗ y)[n] (See top of Fig. 11.5)


      
z[0] 1 4 2 1 3.5
 z[1]  =  2 1 4   0.5  =  3.5 
z[2] 4 2 1 0.25 5.25

(b) N = 4, w[n] = (x ∗ y)[n] (See bottom of Fig. 11.5)


      
w[0] 1 0 4 2 1 2
 w[1]   2 1 0 4   0.5   2.5 
      
 w[2]  =  4 2 1 0   0.25  =  5.25 
w[3] 0 4 2 1 0 2.5

N =3 241

0.25 1
124
0.5
412

N =4 2401

0
4012 1
0.25 1240
0.5

0124

Figure 11.5: Problem 22: y[n] in the inside circle and x[−n] in outside circle shifting clockwise.

(c) N = 5, v[n] = (x ~ y)[n]


      
v[0] 1 0 0 4 2 1 1
 v[1]   2 1 0 0 4  0.5   2.5 
      
 v[2]  =  4 2 1 0 0  0.25 = 5.25 
      
 v[3]   0 4 2 1 0  0   2.5 
v[4] 0 0 4 2 1 0 1

(d) The linear convolution would be of length 3 + 3 − 1 = 5 which is the length of the third cir-
cular convolution so the results of that convolution will coincide with the results of the linear
convolution.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.23

11.23 (a) M = N = 1, then x[n] = δ[n], so X(ejω ) = 1 and the DFT

X[k] = X(ejω )|ω=2πk/1 = 1, k = 0

Plotting X(ejω ) we get a constant 1 for −π ≤ ω < π and repeats periodically with period 2π.
X[k] will only appear at 0 and multiples of 2π.
(b) If M = 1 but now N = 10 we have

X[k] = X(ejω )|ω=2πk/10 = 1, 0 ≤ k ≤ 9

which appears more dense than before, as 10 values of 1 appear between 0 and 2π. The frequency
resolution has been increased.
If M = 1 and N = 1024, we now have a closer approximation to X(ejω ) as 1024 values appear
between 0 and 2π.
X[k] = X(ejω )|ω=2πk/1024 = 1, 0 ≤ k ≤ 1023
(c) For M = 10, x[n] = u[n] − u[n − 10] has a larger time support than before. We have
9
X 1 − e−j10ω sin(5ω)
X(ejω ) = e−jωn = −jω
= e−j4.5ω , ω 6= 0, X(ej0 ) = 10
n=0
1−e sin(ω/2)

the N-DFT is

10, k = 0
X[k] =
e−j9πk/N sin(10πk/N )/ sin(πk/N ), k = 1, ..., N − 1

For N = 10, we get



10 k=0
X[k] = −j9πk/10
e sin(πk)/ sin(πk/10) = 0 k = 1, · · · , 9

corresponding to the minimum length L = N , and displaying a DFT as if it were a constant,


i.e., it is a discrete delta function, close to time aliasing. If N >> 10 the sinc function will start
appearing. If N < 10 there is time aliasing.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.24

11.24 (a) Matrix equation


    
X[0] 1 1 1
=
X[1] 1 −1 1

which gives X[0] = 2 and X[1] = 0. Since det(F) = −2 6= 0 the matrix is invertible with inverse
0.5FT = 0.5F and
   
−1 X[0] x[0]
F =
X[1] x[1]

(b) We have
FT
F=I
|det(F)|
| {z }
F−1

so α = 2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.25

11.25 (a) The convolution sum


n
X
y[n] = h[n − k]x[k]
k=0

can be written
    
y[0] h[0] 0 0 0 0 x[0]
 y[1]   h[1] h[0] 0 0 0  x[1] 
    
 y[2] = h[2] h[1] h[0] 0 0  0 
    
 y[3]   0 h[2] h[1] h[0] 0  0 
y[4] 0 0 h[2] h[1] h[0] 0

or defining the appropriate vectors and matrix as

y = Hx

When replacing the values of the impulse response and the input gives the output.
    
2/3 1 0 0 0 0 2
 1   1 1 0 0 0  1 
    
 1  = 1  1 1 1 0 0  0 
  3  
 1/3   0 1 1 1 0  0 
0 0 0 1 1 1 0

(b) In matrix equations

Y = Fy
= FHx
1
= FH(F∗ )T X
det F

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.26

11.26 (a) Letting M = 3 be the minimum length of x[n] and L = 3 the length of h[n], then the output
y[n] = (x ∗ h)[n] would be of length M + L − 1 = 5.
(b) Convolution sum

y[0] = 1/3
y[1] = 1/3 + 1/6 = 1/2
y[2] = 1/3 + 1/6 + 1/12 = 7/12
y[3] = 1/6 + 1/12 = 1/4
y[4] = 1/12
y[n] = 0 n ≥ 5

(c) Z-transform

Y (z) = X(z)H(z) = (1/3) + (1/2)z −1 + (7/12)z −2


+(1/4)z −3 + (1/12)z −4 (11.1)

where y[n] is the multiplier of z −n , for 0 ≤ n ≤ 4.


(d) DTFT: Let z = ejω in equation (11.1).
(e) DFT of length M + L − 1 = 5: Let z = ej2πk/5 in equation equation (11.1).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.27

11.27 (a) The DFTs of length 7 are


2
X
H[k] = e−j2πnk/7
n=0
3
X
X[k] = e−j2πnk/7
n=0

Y [k] = X[k]H[k] = 1 + 2e−j2πk/7 + 3e−j4πk/7


+3e−j6πk/7 + 2e−j8πk/7 + e−j10πk/7

(b) Yes, the circular convolution coincides with the linear convolution if the DFTs are of length 7,
which is larger than the length of the linear convolution (4 + 3 − 1 = 6). If N < 6 the two
convolutions will not coincide.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.28

11.2 Problems using MATLAB

11.28 We have

h[n] = α2 δ[n + 2] + αδ[n + 1] + 1 + αδ[n − 1] + α2 δ[n − 2]


H(ejω ) = α2 [ej2ω + e−j2ω ] + α[ejω + e−jω ] + 1
= 1 + 2α2 cos(2ω) + 2α cos(ω)

If H(ejω ) ≥ 0 for all values of ω, its phase is zero. To find α consider the following

H(ejω ) = 1 + 2α2 (2 cos2 (ω) − 1) + 2α cos(ω)


= 1 + 4α2 cos2 (ω) − 2α2 + 2α cos(ω)
= 1 − 2α2 + [4α2 cos2 (ω) + 2α cos(ω) + 1/4 − 1/4]
= (3/4) − 2α2 + (2α cos(ω) + (1/2))2

To get that H(ejω ) ≥ 0 we then need that

(3/4) − 2α2 ≥ 0 or that α ≤ 0.612

The range is then 0 ≤ α ≤ 0.612.

% Pr 11_28
clear all; clf
w=-pi:2*pi/1000:pi; w0=w/pi;
for i=1:800,
alpha=0.001*i
H=1+2*alpha*cos(w)+2*(alpha)ˆ2*cos(2*w);
if min(H)<0.000001,
alpha_min=alpha
break
else
plot(w0,H); axis([min(w0) max(w0) -0.1 4]);grid
hold on
end
end

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.29
4

3.5

2.5

|H(ejω)|
2

1.5

0.5

0
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
ω/π

Figure 11.6: Problem 28

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.30

11.29 (a) According to the eigenfunction property of LTI systems when x[n] = ejωn , y[n] = H(ejω )ejωn so
replacing these in the difference equation

H(ejω )ejωn [1 − 0.5e−jω ] = ejωn [1 − 2e−jω ]

canceling ejωn we get

1 − 2e−jω
H(ejω ) =
1 − 0.5e−jω

(b) At ω = 0 we have that



1−2
j0
|H(e )| = =2
1 − 0.5

at ω = π

1+2
|H(ejπ )| = =2
1 + 0.5

Finally at ω = π/2 we have


1 + 2j
|H(ejπ/2 )| = = p 5 =2
1 + 0.5j 5/4

In general,

1 − 2e−jω 1 − 2ejω 1 − 2e−jω 2ejω (0.5e−jω − 1)


|H(ejω )|2 = = =4
1 − 0.5e−jω 1 − 0.5ejω 1 − 0.5e−jω 0.5ejω (2e−jω − 1)

so that |H(ejω )| = 2.
(c) The following script computes and plots the magnitude and phase responses

%%% Pr 11_29
clear all; clf
b=[1 -2];
a=[1 -0.5];
[H,w]=freqz(b,a);
figure(1)
subplot(211)
plot(w/pi,abs(H));ylabel(’|H|’)
subplot(212)
plot(w/pi, unwrap(phase(H))); ylabel(’<H’); xlabel(’\omega/\pi’)

(d) H(z) = (1 − 2z −1 )/(1 − 0.5z −1 ) = (z − 2)/(z − 0.5), pole z = 0.5 and zero z = 2 which are the

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.31
2

1.5

|H|
1

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

<H
2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ω/π

Figure 11.7: Problem 29: Magnitude and phase of all-pass filter H(ejω ).

inverse of each other.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.32

11.30 (a) Using the eigenfunction property when x[n] = ejω0 n the output is ejω0 n H(ejω0 ) so that for the two
filter we get
1 + e−jω0
H1 (ejω0 ) =
1 − 0.5e−jω0
1 − e−jω0
H2 (ejω0 ) =
1 + 0.5e−jω0
When ω0 = 0 then
1+1
H1 (ej0 ) = =4
1 − 0.5
1−1
H2 (ej0 ) = =0
1 + 0.5
and when ω0 = π/2 then
1 + e−jπ/2 1−j
H1 (ejπ/2 ) = −jπ/2
= = 0.4 − j1.2 = 1.26e−j1.25
1 − 0.5e 1 + 0.5j
1 − e−jπ/2 1+j
H2 (ejπ/2 ) = −jπ/2
= = 0.4 + j1.2 = 1.26ej1.25
1 + 0.5e 1 − 0.5j
and finally for ω0 = π
1 + e−jπ 1−1
H1 (ejπ ) = = =0
1 − 0.5e−jπ 1 + 0.5
1 − e−jπ 1+1
H2 (ejω0 ) = −jπ
= =4
1 + 0.5e 1 − 0.5
For frequencies between 0 and π the magnitude of these filters is computed and plotted by the following
script showing H1 (z) is a low-pass and H2 (z) a high–pass.

%%% Pr 11_30
clear all; clf
b1=[1 1];
a1=[1 -0.5];
[H1,w]=freqz(b1,a1); % low-pass
b2=[1 -1];
a2=[1 0.5];
[H2,w]=freqz(b2,a2); % high-pass
figure(1)
subplot(211)
plot(w/pi,abs(H1));ylabel(’|H_1|’)
subplot(212)
plot(w/pi,abs(H2));ylabel(’|H_2|’);xlabel(’\omega/\pi’)

(b) Letting z = ejω


1 − z −1
H2 (z) = = H1 (−z).
1 + 0.5z −1
If we write
X X X
H2 (z) = h2 [n]z −n = H1 (−z) = h1 [n](−z)−n = h1 [n](−1)n z −n
n n n

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.33

then h2 [n] = (−1)n h1 [n].


(c) For H1 (z) = (1 + z −1 )/(1 − 0.5z −1 ) the zero is at −1 and the pole at 0.5, while for H2 (z) =
H1 (−z) the zero is at 1 and the pole at z = −0.5. The transformation is changing z by −z or ejω to
−ejω = ej(ω−π) .

figure(2)
subplot(211)
zplane(b1,a1)
subplot(212)
zplane(b2,a2)

The transformation shifts poles and zeros to their opposite side of the Z–plane.
4
1
3

Imaginary Part
0.5
|H1|

2
0

1 −0.5

0 −1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 −3 −2 −1 0 1 2 3
Real Part

4 1

Imaginary Part
3 0.5

0
|H2|

2
−0.5
1
−1
−3 −2 −1 0 1 2 3
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Real Part
ω/π

Figure 11.8: Problem 30: Magnitude responses of H1 (z) (top) and H2 (z) (left) and corresponding poles and
zeros.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.34

11.31 (a) The Z-transform of h[n] is


1
H(z) = (1 + z −1 + z −2 )
3
with ROC the whole Z–plane, except the origin, so we can let z = ejω to get
1 −jω jω 1
H(ejω ) = e (e + 1 + e−jω ) = e−jω (1 + 2 cos(ω))
3 3
(b)
X 1 −j(ω−π)
H1 (ejω ) = h[n]e−j(ω−π)n = H(ej(ω−π) ) = e (1 + 2 cos(ω − π))
n
3
1 −jω
= e (2 cos(ω) − 1)
3
(c) The frequency response of the two filters is computed and plotted using the following script

%% Pr 11_31
clear all;clf
b1=(1/3)*[1 1 1];
b2=(1/3)*[1 -1 1];
[H1,w]=freqz(b1,1);
[H2,w]=freqz(b2,1);
figure(1)
subplot(221)
plot(w/pi,abs(H1));ylabel(’|H_1|’)
subplot(222)
plot(w/pi,angle(H1));ylabel(’<H_1’)
subplot(223)
plot(w/pi,abs(H2));ylabel(’|H_2|’);xlabel(’\omega/\pi’)
subplot(224)
plot(w/pi,angle(H2));ylabel(’<H_2’);xlabel(’\omega/\pi’)
1 2

0.8 1

0.6 0
|H1|

<H1

0.4 −1

0.2 −2

0 −3
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1

1 3

0.8 2

0.6 1
|H2|

<H2

0.4 0

0.2 −1

0 −2
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
ω/π ω/π

Figure 11.9: Problem 31: Magnitude and phase of low–pass H1 (z) (top) and high–pass H2 (z) filters

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.35

11.32 The instantaneous frequency is


IF (n) = 2θn = πn/L
which is a line of slope π/L. Thus it starts at frequency of zero and when n = L the frequency is π.
This is called a linear chirp since its IF is a line.
The script is

%% Pr 11_32
clear all; clf
L=256; n=0:L-1;
theta=pi/(2*L);
x=cos(theta.*n.ˆ2);
X=fftshift(fft(x));
w=[0:L-1]*2*pi/L;w=w-pi;
figure(1)
subplot(211)
stem(n,x);axis([0 L-1 -1.2 1.2]);ylabel(’x[n]’);xlabel(’n’)
subplot(212)
plot(w,abs(X));axis([min(w) max(w) 0 16])
ylabel(’X(eˆ{j\omega})’);xlabel(’\omega’)

The chirp will jam all possible frequencies.


1

0.5
x[n]

−0.5

−1
0 50 100 150 200 250
n

15

10
X(ejω)

0
−3 −2 −1 0 1 2 3
ω

Figure 11.10: Problem 32: Linear chirp (top) and its magnitude spectrum.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.36

11.33 (a) The desired impulse response is

Z π/2
1 1
h[n] = 1e−jωN ejωn dω = sin(π(n − N )/2)
2π −π/2 π(n − N )

for n 6= N , when n = N we get that

Z π/2
1 π
h[N ] = dω = = 0.5
2π −π/2 2π

So h[n] is symmetric with respect to n = N .


(b) The following script computes and plots the impulse response and computes its DTFT which dis-
plays the linear phase.

%% Pr 11_33
N=50;
for n=0:99,
if n==N
h(51)=0.5;
else
h(n+1)=sin(pi*(n-N)/2)/(pi*(n-N));
end
end
M=524;
H=fft(h,M);
n1=0:99;
w=[0:M-1]*2*pi/M;w=(w-pi)/pi;
figure(1)
subplot(211)
stem(n1,h);ylabel(’h[n]’);xlabel(’n’)
subplot(223)
plot(w,fftshift(abs(H)));ylabel(’|H|’);xlabel(’\omega/pi’)
subplot(224)
plot(w,fftshift(unwrap(angle(H))));grid;ylabel(’<H’);xlabel(’\omega/pi’)

(c) Using the modulation theorem hbp [n] = 2h[n] cos(πn/2) which gives Hbp (ejω ) = H(ej(ω−π/2) ) +
H(ej(ω+π/2) ), i.e., the low-pass filter shifted to the center frequencies ±π/2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.37

0.6

0.4

h[n]
0.2

−0.2
0 10 20 30 40 50 60 70 80 90 100
n

1.5 0

−50
1
|H|

<H
−100

0.5
−150

0 −200
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
ω/π ω/π

Figure 11.11: Problem 33: Impulse response (top) and frequency response.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.38

11.34 (a) x[n] = x2 [n] = x1 [2n], so x[n] is x1 [n] down-sampled with a rate of M = 2.
(b) The DTFTs of x[n] and x1 [n] are

1 − e−j10ω
X(ejω ) =
1 − e−jω
1 − e−j20ω
X1 (ejω ) =
1 − e−jω

The spectrum when we downsample x1 [n] by M = 2 is

1 1 − e−j10ω
X1 (ejω/2 ) = 6= X(ejω )
2 2(1 − e−jω/2 )

so frequency aliasing occurs in the decimation. The reason is that the spectrum of x1 [n] is not bandlim-
ited to π/2. The following script computes and plots the spectra

%% Pr 11_34
clear all; clf
M=256;n=0:M-1;
x1=[ones(1,20) zeros(1, M-20)];
x2=[ones(1,10) zeros(1,M-10)];
x=x2;
figure(1)
subplot(311)
stem(n(1:25),x1(1:25));title(’x_1[n]’);grid
subplot(312)
stem(n(1:25),x2(1:25));title(’x_2[n]’);grid
subplot(313)
stem(n(1:25),x(1:25));title(’x[n]’); xlabel(’n’);grid

X=fft(x,M);
w=[0:M-1]*2*pi/M;w=(w-pi)/pi;
X1d=0.5*(1-exp(-j*10.*w))./(1-exp(-j.*w/2));
figure(2)
plot(w,fftshift(abs(X)))
hold on
plot(w,abs(X1d),’o’);grid;legend(’|X|’,’|X_{1d}|’)
hold off; xlabel(’\omega/\pi’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.39
x1[n] 10
|X|
1 |X1d|
9

0.5
8

0
0 5 10 15 20 7
x2[n]
6
1

0.5 5

0
4
0 5 10 15 20

3
x[n]
1
2
0.5

0 1
0 5 10 15 20
n 0
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
ω/π

Figure 11.12: Problem 34: x1 [n], x2 [n] and x[n] (left) and magnitude spectra of x[n] and its decimated by 2
signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.40

11.35 (a) Cascading an interpolator (up–sampler and low–pass filter) and a decimator (low–pass filter and
down–sampler) (see top figure in Fig. 11.13) with the same rate M , the low-pass filters have the same
bandwidth, but the amplitude of the first is M and the second 1. These cascaded filters can be substituted
by the first one of them giving an equivalent system shown at the bottom of Fig. 11.13. (b) If the

x[n] y[n]
M↑ M Hlp (ejω ) Hlp (ejω ) M↓

Interpolator Decimator

x[n] y[n]
M↑ MHlp (ejω ) M↓

Figure 11.13: Problem 35: Equivalent cascading of interpolator and decimator with same rate M

interpolator and decimator have different rates, an equivalent low-pass filter has the smaller bandwidth
of the filters associated with the interpolator and the decimator. When L = 3 for the interpolator the
bandwidth of the low–pass filter is π/3, while the one for the decimator with M = 2 is π/2, so the
low-pass filter has a bandwidth of π/3. The amplitude is the product of the amplitude of the filter in the
interpolator (L) and the amplitude of the filter in the decimator (1) or L = 3,

x[n] y[n]
3↑ Hlp (ejω ) 2↓

Figure 11.14: Problem 35: Equivalent cascading of interpolator and decimator with rates L = 3 and M = 2,
the low–pass filter has a gain of L = 3 and bandwidth of π/3.

(c) Interpolating with L = 3 the input signal with a 100 samples the output is a signal of length 300
samples. Decimating the output of the interpolator with a rate M = 2 the output signal is a signal with
150 samples.

%% Pr 11_35
clear all; clf
load handel
x=y(1:100)’;n=0:99;
figure(1)
subplot(211)
stem(n,x);ylabel(’x[n]’)
y=interp(x,3);
x1=decimate(y,2);N=length(x1);n1=0:N-1;
subplot(212)
stem(n1,x1);ylabel(’x1[n]’);xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.41
0.2

0.1

x[n]
0

−0.1

−0.2
0 10 20 30 40 50 60 70 80 90 100

0.2

0.1

x1[n]
0

−0.1

−0.2
0 50 100 150
n

Figure 11.15: Problem 35: Interpolation (L = 3) and decimation (M = 2) of top signal x[n]. Notice the
length of the signals, i.e., equivalent to interpolation with L/M = 1.5 factor.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.42

11.36 (a) For the given DTFT we have

|X(ejω )| = 2
∠X(ejω ) = −4ω for − π ≤ ω ≤ π

The phase is a line through the origin of the complex plane, with a slope of −4.
(b) The wrapped phase, computed using the range [−π, π) does not appear linear, it shows discontinu-
ities of 2π. The unwrapped phase appears linear given that the discontinuities of the wrapped phase are
patched. The following script computes and plots the wrapped and the unwrapped phases:

%% Pr 11_36
clear all; clf
% linear phase
b=[0 0 0 0 1];
[X,w]=freqz(b,1);
figure(1)
subplot(211)
plot(w/pi,angle(X)/pi);ylabel(’ wrapped <X in multiples of \pi’)
subplot(212)
plot(w/pi,unwrap(angle(X))/pi); ylabel(’unwrapped <X in multiples of \pi’)
xlabel(’\omega/\pi’)

The wrapped and the unwrapped phase are shown in Fig. 11.16.
wrapped <X in multiples of π

0.5

−0.5

−1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
unwrapped <X in multiples of π

−1

−2

−3

−4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ω/π

Figure 11.16: Problem 36: Wrapped (top) and unwrapped phases.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.43

11.37 (a) Using



X
X(ejω ) = x[n]e−jnω
n=−∞

we have

X
X(ej0 ) = x[n] = 1 + 2 + 3 + 2 + 1 = 9
n=−∞


X
X(ejπ ) = (−1)n x[n] = 1 − 2 + 3 − 2 + 1 = 1
n=−∞

(b) By Parseval’s result


Z π X
1
|X(ejω )|2 dω = |x[n]|2
2π −π n

we get that
Z π
|X(ejω )|2 dω = 2π(1 + 4 + 9 + 4 + 1) = 38π
−π

(c) The Z–transform of x[n] is

X(z) = 1 + 2z −1 + 3z −2 + 2z −3 + z −4 = z −2 [z 2 + 2z 1 + 3 + 2z −1 + z −2 ]

and the DTFT is


 
 
X(ejω ) = e−j2ω 3 + 2 cos(ω) + 4 cos(2ω)
| {z }
real-valued

so that the phase is −2ω when above term is positive and −2ω ± π when negative.
Some of the above results are verified using the following script.

%% Pr 11_37
clear all;clf
x=[1 2 3 2 1];
N=256; X=fft(x,N);
w=[0:N-1]*2*pi/N;
figure(1)
subplot(211)
plot(w,abs(X));axis([min(w) max(w) -0.1 10]);grid
ylabel(’|X|’)
subplot(212)
plot(w,unwrap(angle(X)));axis([min(w) max(w) -15 1]);grid
ylabel(’<X’);xlabel(’\omega’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.44
10

|X|
4

0
0 1 2 3 4 5 6

−5

<X
−10

−15
0 1 2 3 4 5 6
ω

Figure 11.17: Problem 37: Magnitude and phase responses for x[n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.45

11.38 (a) The DTFT of x[n] = sin(0.1πn) = (ej0.1πn − e−j0.1πn )/2j is

1
X(ejω ) = [δ(ω − 0.1π) − δ(ω + 0.1π)]
2j

The period of x[n] is 20 since the frequency is 2π/20. The signal y[n] can be written

ej0.1πn − e−j0.1πn
y[n] = sin(0.1πn) (u[n] − u[n − 20]) = w[n] sin(0.1πn) = w[n]
| {z } 2j
w[n]

so that by the frequency shifting property


1  
Y (ejω ) = W(ej(ω−0.1π) ) − W(ej(ω+0.1π) )
4j
i.e., the spectrum of the rectangular pulse shifted to ±0.1π. If instead of 20 we use a very large value,
Y (ejω ) would look similar to the DFT of x[n].
The following script computes and plots the DTFTs of y[n]. If you increase the value of q in N = 20×q
to a large value, e.g., 2000, the Y (ejω ) looks like X(ejω ) as many more values are used, i.e., the
frequency resolution is larger.

%% Pr 11_38
q=1;
N=20*q; w=ones(1,N);
n=0:N-1;x=sin(0.1*pi*n);
y=w.*x;
M=524;
Y=fft(y,M);
omega=[0:M-1]*2*pi/M-pi;
figure(1)
subplot(211)
plot(omega,fftshift(abs(Y)));axis([min(omega) max(omega) 0 15])
ylabel(’|Y|’)
subplot(212)
plot(omega,fftshift(unwrap(angle(Y))));axis([min(omega) max(omega) -30 20])
ylabel(’<Y’);xlabel(’\omega’)

(b) The following script is used to compute and plot the window and the spectrum of the windowed
signal. The results are shown in Fig. 11.18.

clear all
N=11;n=-5:5;
w1=1+cos(2*pi*n/N);
x=sin(0.1*pi*n);
z=w1.*x;
M=524;
Z=fft(z,M);
omega=[0:M-1]*2*pi/M-pi;
figure(2)
subplot(311)
stem(n,w1); axis([-5 5 0 1.1*max(w1)]);ylabel(’w_1[n]’);xlabel(’n’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.46

subplot(312)
plot(omega,fftshift(abs(Z)));axis([min(omega) max(omega) 0 5])
ylabel(’|Z|’)
subplot(313)
plot(omega,fftshift(unwrap(angle(Z))));axis([min(omega) max(omega) -30 10])
ylabel(’<Z’);xlabel(’\omega’)
15 2

w1[n]
1
10
|Y|

0
−5 −4 −3 −2 −1 0 1 2 3 4 5
5
n

0 4
−3 −2 −1 0 1 2 3

|Z|
2

20
0
−3 −2 −1 0 1 2 3
10

0 10
<Y

0
−10

<Z
−10
−20 −20

−30 −30
−3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3
ω ω

Figure 11.18: Problem 38: Magnitude and phase spectra of y[n] using a rectangular window (left). Raised
cosine window and magnitude and phase spectra of y1 [n].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.47

11.39 (a) The FS coefficients of x[n] are computed as

N −1
1 X
Xk = x[n]e−j2πnk/N
N n=0

which can be written in terms of the Z–transform of a period as

1
Xk = Z(x1 [n]) |z=ej2πk/N
N

The Z-transform
9
X 1 − 0.510 z −10
X1 (z) = 0.5n z −n =
n=0
1 − 0.5z −1

so that for N = 10 we have z = ej0.2πk and

1 − 0.510 e−j2πk 0.1(1 − 0.510 )(1 − 0.5ej0.2πk )


Xk = == 0≤k≤9
10(1 − 0.5e−j0.2πk ) 1.25 − cos(.2πk)

%% Pr 11_39
% --- FFT results
N=10;n=0:N-1;x1=0.5.ˆn;
Xk=fft(x1);
k=n;wk=2*pi*k/N-pi;
figure(1)
subplot(311)
stem([x1 x1 x1]);ylabel(’x[n]’);xlabel(’n’)
subplot(312)
stem(wk,abs(Xk))
% --- analytic results
A=0.1*(1-0.5ˆ(10));
Xk1=A*(1-0.5*exp(j*0.2*pi*k))./(1.25-cos(0.2*pi*k))*N;
hold on
stem(wk,abs(Xk1),’r’);axis([-pi pi 0 2.1]); grid
ylabel(’X_k’);xlabel(’w_k’)
hold off
subplot(313)
stem(wk,angle(Xk))
hold on
stem(wk,angle(Xk1),’r’);axis([-pi pi -1 1]); grid
ylabel(’<X_k’);xlabel(’w_k’)
hold off

The results using the FFT and the analytic results coincide. See Fig. 11.19.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.48
1

x[n]
0.5

0
0 5 10 15 20 25 30
n

Xk
1

0
−3 −2 −1 0 1 2 3
wk

<Xk
0

−1
−3 −2 −1 0 1 2 3
wk

Figure 11.19: Problem 39: Periodic signal and its magnitude and phase line spectra.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.49

11.40 (a) Equation (ii) can be written in matrix form as

X = Sx

where X = [X0 X1 · · · XN −1 ]T is an N vector containing the FS coefficients, x = [x[0]/N x[1]/N · · · x[N −


1]/N ]T are the signal values divided by N , and the N × N matrix S contains the complex exponentials.
Then
x = S−1 X
Calling Ŝ = S−1 we would then have
x = ŜX
and then
X = Ŝ−1 x
where ŜS = I, where I is the N × N unit matrix, i.e., Ŝ and S are orthonormal matrices.
(b) The following script computes the Fourier series coefficients from the first period of the periodic
signal, and computes the first period using the Fourier series. Notice the way the matrix S is generated.

%% Pr 11_40
clear all; clf
x1=[0 1 2 0];
N=4;n=0:N-1;k=n;
S=exp(-j*2*pi.*(n’*k)/N)
Xk=(1/N)*S*x1’
x=inv(S)*N*Xk
S =1.0000 1.0000 1.0000 1.0000
1.0000 0.0000 - 1.0000i -1.0000 - 0.0000i -0.0000 + 1.0000i
1.0000 -1.0000 - 0.0000i 1.0000 + 0.0000i -1.0000 - 0.0000i
1.0000 -0.0000 + 1.0000i -1.0000 - 0.0000i 0.0000 - 1.0000i
Xk = 0.7500
-0.5000 - 0.2500i
0.2500 + 0.0000i
-0.5000 + 0.2500i
x = -0.0000 + 0.0000i
1.0000 + 0.0000i
2.0000 - 0.0000i
-0.0000

(c) For N = 4 we can write the Fourier series coefficients multiplied by 4 as

4Xk = x[0] + x[1]e−j2πk/4 + x[2]e−j2π2k/4 + x[3]e−j2π3k/4


n o n o
= x[0] + x[2]e−j2πk/2 + e−j2πk/4 x[1] + x[3]e−j2πk/2

where we have simplified some of the exponentials. Using that e−j2πk/2 = (−1)k and e−j2πk/4 =
(−j)k we finally obtain
 
Xk = 0.25 x[0] + x[2](−1)k + (−j)k x[1] + x[3](−1)k 0≤k≤3

We thus have using the above results


1  T 1  T
X= S x[0] x[1] x[2] x[3] = SP x[0] x[2] x[1] x[3]
4 4

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.50

where 14 SP = S1 and P is a permutation matrix


   
1 0 0 0 1 1 1 1
1  0 0 1 0  1 1 −1 −j −j 
S1 = S  =  
4  0 1 0 0  4 1 1 −1 −1 
0 0 0 1 1 −1 j −j
| {z }
P

so that
   
X0 x[0]
 X1   x[2] 
   
 X2  = S1  x[1] 
X3 x[3]

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.51

11.41 (a) For any value of N0 ,


N
X −1 N
X −1
x1 [n] = x[n − N0 ] = Xk ej2π(n−N0 )k/N = [Xk e−j2πN0 k/N ]0 ej2πnk/N
k=0 k=0

is periodic of period N and FS coefficients Xk e−j2πN0 k/N .


(b) Both x[n] and x[n − 1] are periodic of the same period N , and
N
X −1
x2 [n] = x[n] − x[n − 1] = [Xk (1 − e−j2πk/N )]ej2πnk/N
k=0

so x2 [n] is also periodic of period N and with FS coefficients Xk (1 − e−j2πk/N )


(c) x3 [n + N ] = x[n + N ](−1)n+N = x[n](−1)n (−1)N , so for it to be periodic of period N , the value
of N should be even so that (−1)N = 1. Thus, if x[n] is periodic of period an even integer N , then
N
X −1
x3 [n] = x[n](−1)n = Xk ej2πn(k−N/2)/N
k=0
N/2−1
X
= Xm+N/2 ej2πnm/N
m=−N/2

where we obtained the last equation by letting m = k − N/2 which are integers because N is even.
(d)(e) The signal x[n] is


 1 n=0

1 n=1
x[n] = sgn[cos(0.5πn)] =

 −1 n=2

−1 n = 3

Its Fourier series coefficients are given by


1
Xk = (1 + z −1 − z −2 − z −3 )|z=ejπk/2
4
1 1
= [(1 + (−j)k − (−j)2k − (−j)3k ] = [(1 + (−j)k − (−1)k − (j)k ]
4 4
1 (1 − (−1)k )
= [(1 − (−1)k ) − (1 − (−1)k )j k ] = (1 − j k )
4
 4
0 k even
=
0.5(1 − j k ) k odd

giving X0 = X2 = 0 and X1 = 0.5(1 − j), X3 = 0.5(1 + j).

%% Pr 11_41
clear all; clf
N=4;n=0:N-1;k=n;
x=sign(cos(2*pi.*n/N));
N0=3; x1=[x(2) x(3) x(4) x(1)];
x2=x-[x(4) x(1) x(2) x(3)]
x3=x.*(-1).ˆn;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.52

n1=0:4*N-1;
figure(1)
subplot(221)
stem(n1,[x x x x]);ylabel(’x[n]’)
subplot(222)
stem(n1,[x1 x1 x1 x1]);ylabel(’x_1[n]’)
subplot(223)
stem(n1,[x2 x2 x2 x2]);ylabel(’x_2[n]’);xlabel(’n’)
subplot(224)
stem(n1,[x3 x3 x3 x3]);ylabel(’x_3[n]’);xlabel(’n’)
subplot(223)
figure(2)
subplot(221)
stem(k,abs(fft(x)/N));ylabel(’|X|’)
subplot(222)
stem(k,abs(fft(x1)/N));ylabel(’|X_1|’)
subplot(223)
stem(k,abs(fft(x2)/N));ylabel(’|X_2|’);xlabel(’k’)
subplot(224)
stem(k,abs(fft(x3)/N));ylabel(’|X_3|’);xlabel(’k’)
1 1 0.8 0.8

0.5 0.5 0.6 0.6


x1[n]
x[n]

|X1|
|X|

0 0 0.4 0.4

−0.5 −0.5 0.2 0.2

−1 −1 0 0
0 5 10 15 0 5 10 15 0 1 2 3 0 1 2 3

2 1 1 0.8

0.8
1 0.5 0.6
0.6
x2[n]

x3[n]

|X2|

|X3|

0 0 0.4
0.4
−1 −0.5 0.2
0.2

−2 −1 0 0
0 5 10 15 0 5 10 15 0 1 2 3 0 1 2 3
n n k k

Figure 11.20: Problem 41: Periodic signals and their magnitude line spectra.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.53

11.42 (a) The Fourier series coefficients are given as


N −1
1 X
Xk = x[n]ej2πnk/N
N n=0
N −1 N −1
1 X j X
= x[n] cos(2πnk/N ) + x[n] sin(2πnk/N )
N n=0 N n=0

If x[n] is even of period an even integer N , then


N
X −1 N
X −1
x[n] sin(2πnk/N ) = x[0] × (0) + x[n] sin(2πnk/N )
n=0 n=1
= (x[1] sin(2πk/N ) + x[N − 1] sin(2πk(N − 1)/N ))
+(x[2] sin(2π2k/N ) + x[N − 2] sin(2πk(N − 2)/N ))
+ · · · + x[N/2] sin(2π(N/2)k/N )

For 1 ≤ n ≤ N − 1 we have that

sin(2πk(N − n)/N ) = sin(2πk − 2πkn/N ) = sin(−2πkn/N ) = − sin(2πkn/N )

and by periodicity
x[n] = x[−n] = x[−n + N ]
i.e., x[1] = x[N − 1], x[2] = x[N − 2], and so on. Thus
N
X −1
x[n] sin(2πnk/N ) = x[1](sin(2πk/N ) − sin(2πk/N )) + x[2](sin(2π2k/N ) − sin(2π2k)/N )) + · · ·
n=0
+x[N/2] sin(πk) = 0

so that when x[n] is even, Xk is real. When the period N is odd, instead of the term x[N/2] we have
xbN/2c and xdN/2e, where bN/2c is the integer smaller than N/2 and dN/2e is the integer larger than
N/2, which are equal by the evenness of x[n]. This term is multiplied by the difference of sine terms
which are equal to zero.
When x[n] is odd, we have that
N
X −1
x[n] cos(2πnk/N ) = x[0] + (x[1] + x[N − 1]) cos(2πk/N ) + (x[2] + x[N − 2]) cos(4πk/N )
n=0
+ · · · + (xbN/2c + xdN/2e) cos(2πbN/2ck/N )

where we used
cos(2πk(N − n)/N ) = cos(2πkn/N ) 1≤n≤N −1
and by the oddness and periodicity of x[n] we have that x[0] = 0, and x[n] = −x[−n] = −x[−n + N ],
so each of the terms of the above summation is zero, and
N −1
j X
Xk = x[n] sin(2πnk/N )
N n=0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.54

i.e., is imaginary.
(b) Independent of the period

0.5 e−j2πn/N
0.5 ej2πn/N + |{z}
x1 [n] = cos(2πn/N ) = |{z}
X1 X−1

x2 [n] = sin(2πn/N ) = −0.5j e j2πn/N


+ 0.5j e−j2πn/N
| {z } |{z}
X1 X−1

where the Fourier coefficients are real for even x1 [n] and imaginary for odd x2 [n].
(c) The following script computes and plots the signals and the real and imaginary parts of their Fourier
coefficients for N = 3 (similarly for N = 4).

%% Pr 11_42
clear all; clf
N=3;M=10*N;n=0:M-1;k=n;
x1=cos(2*pi.*n/N);X1k=fft(x1,M)/M;
x2=sin(2*pi.*n/N);X2k=fft(x2,M)/M;
X1kr=real(X1k);X1ki=imag(X1k);
X2kr=real(X2k);X2ki=imag(X2k);
figure(1)
subplot(211)
stem(n,x1)
subplot(223)
stem(k,X1kr);axis([0 M-1 1.1*min(X1kr) 1.1*max(X1kr)])
ylabel(’Re[X_{1k}]’);xlabel(’k’)
subplot(224)
stem(k,X1ki);axis([0 M-1 1.1*min(X1ki) 1.1*max(X1ki)])
ylabel(’Im[X_{1k}]’);xlabel(’k’)
figure(2)
subplot(211)
stem(n,x2)
subplot(223)
stem(k,X2kr);axis([0 M-1 1.1*min(X2kr) 1.1*max(X2kr)])
ylabel(’Re[X_{2k}]’);xlabel(’k’)
subplot(224)
stem(k,X2ki);axis([0 M-1 1.1*min(X2ki) 1.1*max(X2ki)])
ylabel(’Im[X_{2k}]’);xlabel(’k’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.55
1 1

0.5 0.5

x1[n]

x2[n]
0 0

−0.5 −0.5

−1 −1
0 5 10 15 20 25 30 0 5 10 15 20 25 30
n n
−16 −16
x 10 x 10
6 0.5
0.5 2
4
0.4 0
2
Re[X1k]

Re[X2k]
Im[X1k]

Im[X2k]
0.3 −2
0 0
0.2 −2 −4
0.1 −4
−6
−6 −0.5
0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25
k k k k

Figure 11.21: Problem 42: Even and odd signals (top) and their corresponding real and imaginary parts of
their line spectra. Notice the imaginary component for even x1 [n] is practically zero. Likewise for the real
part of x2 [n], which is odd.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.56

11.43 (a)–(c) To recover x[n] we need to demodulate y[n] by multiplying it by(−1)n , which gives a low-pass
signal which is then obtained using a low-pass filter. The bandwidth of the low-pass filter is chosen
wide to recover the original signal. It can be reduced when the noise is present.

%% Pr 11_43
clear all; clf
N=100;
% n=0:N-1; x=sign(cos(2*pi.*n/20)); % part (a)(b)
load handel; x=y(1:100)’; x=[x x ]; N=2*N; % part (c)
n=0:N-1;
A=0.01;
y=(-1).ˆn.*x+A*rand(1,N); n=0:N-1;
figure(1)
subplot(221)
plot(n,x);title(’ Desired signal’); axis([ 0 N-1 -0.2 0.2])
subplot(222)
plot(n,y); title(’Noisy signal’); axis([ 0 N-1 -0.2 0.2])
X=fft(x);Y=fft(y);
w=2*pi*[0:N-1]/N-pi;
subplot(223)
plot(w,fftshift(abs(X))); title (’Spectrum |X|’); axis([-pi pi 0 7])
subplot(224)
plot(w,fftshift(abs(Y))); title (’Spectrum |Y|’); axis([-pi pi 0 7])
% low-pass filtering
b=fir1(40,0.95);
y1=y.*(-1).ˆn;
z=filter(b,1,y1);

figure(2)
subplot(211)
plot(n,z); title(’Denoised signal’); axis([ 0 N-1 -0.2 0.2])
subplot(212)
plot(n,z-[zeros(1,40/2) x(1:N-40/2)]); title(’error’); axis([ 0 N-1 -0.2 0.2])

Desired signal Noisy signal Denoised signal


0.2 0.2 0.2

0.1 0.1 0.1

0 0 0

−0.1 −0.1 −0.1

−0.2 −0.2 −0.2


0 50 100 150 0 50 100 150 0 20 40 60 80 100 120 140 160 180

Spectrum |X| Spectrum |Y| error


7 7 0.2
6 6
5 5 0.1
4 4
0
3 3
2 2 −0.1
1 1
0 0 −0.2
−2 0 2 −2 0 2 0 20 40 60 80 100 120 140 160 180

Figure 11.22: Problem 43 Desired, noisy and denoised signals (top); magnitude spectra |X(ejω )| and
|Y (ejω )|

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.57

11.44 (a) The length of x[n] is 40, so that if 2γ ≥ 40 then γ ≥ log2 (40) = 5.32 and so we choose γ =
d5.32e = 6. The following script shows how to do the computations and the plotting when N = 26 and
N = 210 . The results are shown in Fig. 11.25. For the larger N the frequency responses are denser but
of equal shape.

%% Pr 11_44
clear all; clf
n=0:39;x=0.5*n.*(0.8).ˆn;
gamma=6; N=2ˆ(gamma);
X=fft(x,N);w=[0:N-1]*2*pi/N;w=w/pi;
figure(1)
subplot(211)
stem(n,x);axis([0 34 -0.1 1.1]);title(’x[n]’)
subplot(223)
stem(w,abs(X));axis([min(w) max(w) 0 10])
title(’|X|, N=2ˆ6’);xlabel(’\omega/\pi’)
subplot(224)
stem(w,unwrap(angle(X)));axis([min(w) max(w) -6 0.1])
title(’\angle{X}, N=2ˆ{6}’); xlabel(’\omega/\pi’)
%
gamma=10; N=2ˆ(gamma);
X1=fft(x,N);w=[0:N-1]*2*pi/N;
figure(2)
subplot(211)
stem(w,abs(X1));axis([min(w) max(w) 0 10])
title(’|X|, N=2ˆ{10}’);xlabel(’\omega/\pi’)
subplot(212)
stem(w,unwrap(angle(X1)));axis([min(w) max(w) -6 0.1])
title(’\angle{X}, N=2ˆ{10}’); xlabel(’\omega/\pi’)

x[n] |X|, N=210


10
1
8
0.8

0.6 6

0.4 4
0.2
2
0
0
0 5 10 15 20 25 30 0 1 2 3 4 5 6
ω/π
6 6
|X|, N=2 ∠X, N=2 ∠X, N=210
10 0 0

8 −1 −1

−2 −2
6
−3 −3
4
−4 −4
2 −5 −5

0 −6 −6
0 0.5 1 1.5 0 0.5 1 1.5 0 1 2 3 4 5 6
ω/π ω/π ω/π

Figure 11.23: Problem 44: aperiodic signal x[n] and its magnitude and phase computed with FFT of length
26 (left) and 21 0 (right).

(b) Creating a periodic signal with period x[n] and fundamental period 40 we can compute its DFT
using several periods and dividing the result by the number of periods. The following script show the
case of using 2 and 4 periods. The results are shown in Fig. 11.24

N=40;x2=[x x]; % 2 periods

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.58

M=length(x2);
X2=fft(x2,M)/(M/N);
n1=0:M-1;
w=[0:M-1]*2*pi/M;
figure(3)
subplot(211)
stem(n1,x2);;axis([0 M-1 -0.1 1.1]);title(’x periodic’);xlabel(’n’)
subplot(223)
stem(w,abs(X2));axis([min(w) max(w) 0 10])
title(’|X|, M=2N’);xlabel(’\omega/\pi’)
subplot(224)
stem(w,unwrap(angle(X2)));axis([min(w) max(w) -6 6])
title(’\angle{X},M=2N’); xlabel(’\omega/\pi’)

x3=[x x x x]; % 4 periods


M=length(x3);
X3=fft(x3,M)/(M/N);
n1=0:M-1;
w=[0:M-1]*2*pi/M;
figure(4)
subplot(211)
stem(n1,x3);;axis([0 M-1 -0.1 1.1]);title(’x, 4 periods’);xlabel(’n’)
subplot(223)
stem(w,abs(X3));axis([min(w) max(w) 0 10])
title(’|X|, M=4N’);xlabel(’\omega/\pi’)
subplot(224)
stem(w,unwrap(angle(X3)));axis([min(w) max(w) -6 6])
title(’\angle{X}, M=4N’); xlabel(’\omega/\pi’)

No padding with zeros the periodic signal as it would change the periodicity.

x periodic x, 4 periods

1 1

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0 0
0 10 20 30 40 50 60 70 0 50 100 150
n n

|X|, M=2N ∠X,M=2N |X|, M=4N ∠X, M=4N


10 6 10 6

8 4 8 4

2 2
6 6
0 0
4 4
−2 −2
2 −4 2 −4

0 −6 0 −6
0 2 4 6 0 2 4 6 0 2 4 6 0 2 4 6
ω/π ω/π ω/π ω/π

Figure 11.24: Problem 44: periodic signal with period x[n] and its magnitude and phase calculated consider-
ing 2 periods (left) and 4 periods (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.59

11.45 (a) When the signal is aperiodic, padding it with zeros increases the number of frequencies, i.e., in-
creases the frequency resolution while the original amplitude values remain the same.

%% Pr 11_45
clear all; clf
x=ones(1,10);
x1=[x zeros(1,10)]; M1=length(x1); X1=fft(x1);
x2=[x zeros(1,100)]; M2=length(x2);X2=fft(x2,M2);
w1=[0:M1-1]*2*pi/M1;n1=0:length(x1)-1;
w2=[0:M2-1]*2*pi/M2;n2=0:length(x2)-1;
figure(1)
subplot(221)
stem(n1,x1); axis([0 max(n1) 0 1.1]);ylabel(’x_1[n]’)
subplot(222)
stem(n2,x2); axis([0 max(n1) 0 1.1]);ylabel(’x_2[n]’)
subplot(223)
stem(w1,abs(X1));axis([0 2*pi 0 12]);ylabel(’|X_1|’)
subplot(224)
stem(w2,abs(X2)); axis([0 2*pi 0 12])

(b) When the signal is periodic, the fundamental frequencies do not change by considering several
periods, zeros appear in between them. The amplitudes at the fundamental frequencies increases as the
number of periods being considered increases. When padding zeros to a period, the signal is corrupted
and its spectrum changes. See plots on the right of Fig. 11.25. Notice that x3 [n] which is a period of
x1 [n] padded with 10 zeros does not satisfy the above properties of periodic signals.

% part (b)
clear all
N=5; M=N; n=0:M-1;
x1=cos(pi*n/5);
X1=fft(x1); w1=[0:M-1]*2*pi/M;
x2=[x1 x1 x1 x1 x1 x1 x1 x1 x1 x1];
M=10*N;w2=[0:M-1]*2*pi/M;
X2=fft(x2)
x3=[x1 zeros(1,10)];
X3=fft(x3);
M=length(x3);w3=[0:M-1]*2*pi/M;
figure(2)
subplot(311)
stem(w1,abs(X1));axis([0 2*pi 0 3.2]);ylabel(’|X_1|’)
subplot(312)
stem(w2,abs(X2));;axis([0 2*pi 0 32]);ylabel(’|X_2|’)
subplot(313)
stem(w3,abs(X3));axis([0 2*pi 0 3.2]);ylabel(’|X_3|’)
xlabel(’\omega (rad)’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.60
3
1 1

0.8 0.8 2

|X1|
1
x1[n]

x2[n]
0.6 0.6

0.4 0.4 0
0 1 2 3 4 5 6
0.2 0.2
30
0 0
0 5 10 15 0 5 10 15
20

|X2|
10
12 12
0
10 10 0 1 2 3 4 5 6
8 8
3
|X1|

|X2|
6 6
2

|X3|
4 4

2 2 1

0 0 0
0 2 4 6 0 2 4 6 0 1 2 3 4 5 6
ω (rad)

Figure 11.25: Problem 45: Improving the frequency resolution of an aperiodic signal (left) and of a periodic
signal.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.61

11.46 (a) The impulse response of the IIR filter appears to taper down around n = 30 so the approximation of
the impulse response seems good.

%% Pr 11_46
clear all;clf
x=ones(1,50);
b=[1 0.5 0]; a=[1 -1.755 0.81];
delta=[1 zeros(1,30)];
h=filter(b,a,delta);
N=128;
X=fft(x,N);H=fft(h,N);
Y=X.*H; y=real(ifft(Y));
figure(1)
subplot(311)
stem([x zeros(1,10)])
subplot(312)
stem([h zeros(1,10)])
subplot(313)
stem(y)

(b)(c) In this case we do not truncate the impulse response, and the results y1 [n] are better than before
y[n], (the control is the solution obtained using filter, yc [n]). See right figure in Fig. 11.26. The error
is clearly seen when compared to the first result, but there is no visible error when compared to the
second.

% part 2
X=fft(x,N);A=fft(a,N);B=fft(b,N);
Y1=X.*B./A;
y1=ifft(Y1);
yc=filter(b,a,x);
figure(2)
subplot(211)
plot(y)
hold on
plot(yc,’r’);grid
hold off
subplot(212)
plot(y1)
hold on
plot(yc, ’r’); grid
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.62

1 40

30
x[n]

0.5

y1[n], yc[n]
20

0 10
0 10 20 30 40 50 60
0
4
3 −10
0 20 40 60 80 100 120 140
2
h[n]

1
0 40

0 5 10 15 20 25 30 35 40 30

y1[n],yc[n]
20
30
20 10
y[n]

10
0
0
−10
0 20 40 60 80 100 120 0 20 40 60 80 100 120 140
n n

Figure 11.26: Problem 46: Input x[n], impulse response ĥ[n] and output y[n] (left); right: exact response
compared to solution when h[n] is truncated (top) and when it is not (bottom)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.63

11.47 (a)(b) Plotting x[m] and y[n − m] (y[m] reversed and shifted to the right n samples), multiplying them
and adding the overlapping values gives z[n] = (x ∗ y)[n], the linear convolution. See results of the
script below. The values are also obtained by multiplying the Z-transforms X(z) and Y (z) giving

Z(z) = X(z)Y (z) = z −1 + 3z −2 + 6z −3 + 5z −4 + 3z −5

which is the DTFT of z[n] when z = ejω (the coefficients of Z(z) coincide with the values from the
linear convolution.
(c) For N = 4 the circular convolution is graphically done as follows. The inner circle corresponds to
x[m] and the outer circle to y[n − m] (reversed and shifted clockwise), and at each shift the correspond-
ing values are multiplied and added. The results are z[0] = 5, z[1] = 4, z[2] = 3, and z[3] = 6, which

N =4
1, 1, 0, 1
z[0] = 5
3
z[1] = 4
1, 0, 1, 1 2 1, 1, 1, 0
0 z[2] = 3

1 z[3] = 6

0, 1, 1, 1

Figure 11.27: Problem 47: Circular convolution for N = 4.

do not coincide with the values from the linear convolution, this is because N = 4 < length[x[n]] +
length[y[n]] − 1 = 6.
For the other values of N , bigger than 6, a similar graphical procedure is used, but in these cases the
results of the circular and the linear convolutions coincide.
(d) If we let z = ej2πk/N we obtain from the result in (a) that

X(k)Y (k) = e−j1(2πk/N ) + 3e−j2(2πk/N ) + 6e−j3(2πk/N ) + 5e−j4(2πk/N ) + 3e−j5(2πk/N )

Now if N = 4, e−j4(2πk/4) = e−j0(2πk/4) and e−j5(2πk/4) = e−j1(2πk/4) so that the above can be
written as
X(k)Y (k) = 5 + (1 + 3)e−j1(2πk/N ) + 3e−j2(2πk/N ) + 6e−j3(2πk/N )
The coefficients of the DFT correspond to the values given by the circular convolution of length N = 4.
If N = 7 > 6 we have

X(k)Y (k) = e−j1(2πk/7) + 3e−j2(2πk/7) + 6e−j3(2πk/7) + 5e−j4(2πk/7) + 3e−j5(2πk/7)

and its coefficients correspond to the circular convolution results with N = 7 and also coincide with
the ones from the linear convolution. Likewise, for N = 10 > 6 we get

X(k)Y (k) = e−j1(2πk/10) + 3e−j2(2πk/10) + 6e−j3(2πk/10) + 5e−j4(2πk/10) + 3e−j5(2πk/10)


In the cases when N > 6 there is no simplification of the exponentials, as in the case for N < 6, and
as such the circular and the linear convolutions coincide. The implementation using the fft function is
shown below.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.64

%% Pr 11_47
clear all; clf
x=[0 1 2 3 ];
y=[1 1 1 ];
z=conv(x,y); % linear convolution

n=0:9;
figure(1)
subplot(311)
stem(n,[x zeros(1,6)]);title(’x[n]’);grid
subplot(312)
stem(n,[y zeros(1,7)]);title(’y[n]’);grid
subplot(313)
stem(n,[z zeros(1,4)]);title(’z[n]=(x*y)[n]’);grid

% circular convolutions
figure(2)
for i=1:3,
if i==1,
N=4;subplot(311)
elseif i==2,
N=7;subplot(312)
else
N=10;subplot(313)
end
X=fft(x,N);
Y=fft(y,N);
Z=X.*Y;
z=ifft(Z);M=length(z);
stem(n,[z zeros(1,10-M)])
if i==1,
title(’circular conv N=4’);grid
elseif i==2,
title(’circular conv N=7’);grid
else
title(’circular conv N=10 ’);grid
end
end

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.65

x[n] circular conv N=4


3 6

2 4

1 2

0 0
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
y[n] circular conv N=7
1 6

4
0.5
2

0 0
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
z[n]=(x*y)[n] circular conv N=10
6 6

4 4

2 2

0 0
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9

Figure 11.28: Problem 47: Linear convolution z[n] of x[n] and y[n] (left). Results of circular convolutions
of x[n] and y[n] for lengths N = 4 (right top), N = 7 and N = 10 (right bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 11.66

Copyright 2014, Elsevier, Inc. All rights reserved.


Chapter 12

Introduction to the Design of Discrete


Filters

12.1 Basic Problems


12.1 (a) The steady-state output is

y1 [n] = |H(ej0 )| + |H(ej0.3π )| cos(0.3πn + ∠H(ej0.3π )) + 23|H(ej0.7π )| sin(0.7πn + ∠H(ej0.3π ))


|H(ej0 )| = 1
|H(ej0.3π )| = 1, ∠H(ej0.3π ) = −3π = −π
|H(ej0.7π )| = 0

so that
y1 [n] = 1 + cos(0.3πn − π) = 1 − cos(0.3πn)
(b) If input is x2 [n] = δ[n] + 2δ[n − 4] the output is

y2 [n] = h[n] + 2h[n − 4]

where the impulse response h[n] corresponding to H(ejω ) is


Z π/2 
1 1/2 n = 10
h[n] = e−j10ω ejωn dω =
2π −π/2 sin(π(n − 10)/2)/(π(n − 10)) otherwise.

(c) The DTFT of the input is

X3 (ejω ) = H(ejω/2 ) = 1 e−j5ω −π ≤ω ≤π

so that

jω jω jω 1e−j15ω − π2 ≤ ω ≤ π2
Y3 (e ) = X3 (e )H(e ) =
0 else in − π ≤ ω ≤ π

1
Chaparro — Signals and Systems using MATLAB 12.2

and y3 [n]
Z π/2 
1 −j15ω jωn 1/2 n = 15
y3 [n] = e e dω =
2π −π/2 sin(π(n − 15)/2)/(π(n − 15)) otherwise

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.3

12.2 (a) Yes, H(ejω ) > 0 and real with zero phase.
(b) Impulse response
H(ejω ) = |{z} 0.5 e−j2ω
0.5 ej2ω + |{z}
1.5 + |{z}
h[0] h[−2] h[2]

It can also be found using the IDTFT


Z π
1
h[n] = (1.5 + cos(2ω))ejωn dω
2π −π
Z π Z π
1 1
= 1.5ejωn dω + cos(2ω)ejωn dω
2π −π 2π −π

which is different from zero for n = 0 and n = ±2, and h[0] = 1.5 and h[−2] = h[2] = 0.5.
Indeed, then

H(z) = 0.5z 2 + 1.5 + 0.5z −2


H(ejω ) = 1.5 + cos(2ω)

The filter is a non-causal FIR.


(c) Since H(ejω ) has zero phase, then H1 (ejω ) = e−jN ω H(ejω ) has linear phase for any N ≥ 1,
and h1 [n] = h[n − N ].

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.4

12.3 (a) H(z) = h[0](1 + z −3 ) + h[1](z −1 + z −2 ) and the frequency response is

H(ejω ) = h[0](1 + e−j3ω ) + h[1](e−jω + e−j2ω )



= e−j1.5ω h[0](ej1.5ω + e−j1.5ω ) + h[1](ej0.5ω + e−j0.5ω )
= e−j1.5ω (2h[0] cos(1.5ω) + 2h[1] cos(0.5ω))

(b) We have

H(z) = 1 + z −1 + z −2 + z −3 = (1 + z −3 ) + z −1 (1 + z −1 )

using
1 + z −3 = (1 + z −1 )(1 − z −1 + z −2 ) (∗)
we can write
(z + 1)(z 2 + 1)
H(z) = (1 + z −1 )(1 − z −1 + z −2 + z −1 ) = (1 + z −1 )(1 + z −2 ) =
z3
so that the zeros are z = −1 and z1,2 = ±j. Because zeros are on unit circle the phase is
non–linear.
(c) We have using the above identity (∗)

H(z) = h[0](1 + z −3 ) + h[1](z −1 + z −2 )


= h[0](1 + z −1 )(1 − z −1 + z −2 ) + h[1]z −1 (1 + z −1 )
= (1 + z −1 )(h[0] + (h[1] − h[0])z −1 + h[0]z −2 )

Letting α = h[0] and β = h[1] − h[0] and z = ejω we have

H(ejω ) = e−jω/2 2 cos(ω/2)e−jω (β + 2α cos(ω))


= 2e−j1.5ω cos(ω/2)(β + 2 cos(ω))

Since cos(ω/2) ≥ 0 for −π ≤ ω < π, if 2α cos(ω) + β ≥ 0 then the phase of the filter would
be −1.5ω which is linear. If β > 2α then the second condition is satisfied. That is, we have the
condition on the impulse response values

h[1] − h[0] > 2h[0] or h[1] > 3h[0]

to guarantee linear phase.


(d) Again letting α = h[0] and β = h[1] − h[0] we have

H(z) = (α + βz −1 + αz −2 )(1 + z −1 )

with zeros z1 = −1 and

β
z2 + z+1=0
α s 
p 2
−β/α ± (β/α)2 − 4 −β β
zeros z2,3 = = ± −1
2 2α 2α

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.5

to insure that z2,3 are not on the unit disc we require that (β/2α)2 − 1 ≥ 0 since when (β/2α)2 −
1 < 0 the roots are s  2
β β
z2,3 = − ±j 1−
2α 2α
having unit magnitude (i.e., on the unit circle).
The zeros shown above are connected in the following way

(z + 1)(α(z 2 + 1) + βz)
H(z) =
z3
zeros z = −1 and roots of α(z 2 + 1) + βz which satisfy (multiplying by z −1 )
β h[0] − h[1]
z + z −1 = − =
α h[0]

or that if z0 is a zero, 1/z0 is also a zero, and if impose the condition for linear phase they would
not be on the unit disc.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.6

12.4 (a) Poles z = 0 double; zeros z1,2 = e±jπ/2 = ±j.


(b) Vectors Z~1 (ω0 ) and Z~2 (ω0 ) go from the zeros to the frequency where we are finding the frequency
response. Likewise, vectors P~1 (ω0 ) and P~2 (ω0 ) go from the poles to the frequency for which we
are finding the frequency response.
(c) Analytically, |H(ej0 )| = (1 − j)(1 + j)/1 = 2. Graphically
√ √
j0 |Z~1 (0)||Z~2 (0)| 2 2
|H(e )| = = =2
~
(|P1 (0)| 2 1

and the phase would be

∠Z~1 (0) + ∠Z~2 (0) − 2∠P~1 (0) = (2π − φ) + φ + 0 = 2π

so H(ej0 ) = 2. Notice that when ω = 0 then H(ej0 ) = H(z)|z=1 .


(d) Magnitude response: analytically and graphically we have

H(ejπ/2 ) = 0
H(ejπ ) = 2ej0 = 2

The filter is a notch filter with notch frequency π/2.

2
×

Figure 12.1: Problem 4: Poles and zeros and vectors to ω = 0 to find H(ej0 ).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.7

12.5 (a) The frequency response is

H(ejω ) = e−jω [β + α(ejω + e−jω )]


= e−jω [β + 2α cos(ω)]

The dc gain gives


|H(ej0 )| = β + 2α = 1
For the phase ∠H(ejω ) = −ω, we need that β + 2α cos(ω) > 0 for −π ≤ ω ≤ π. Using that
−1 ≤ cos(ω) ≤ 1 and that α > 0, β > 0, then

β − 2α ≤ β + 2α cos(ω) ≤ β + 2α

If we let β − 2α ≥ 0, and use the dc gain condition β + 2α = 1, by adding these equations we get
2β ≥ 1 or β ≥ 1/2 and α = (1 − β)/2.
(b) For the smallest value of β, β = 1/2, then α = 1/4.

0.25(z + z −1 ) + 0.5
H(z) = 0.25 + 0.5z −1 + 0.25z −2 =
z
the zeros are the values of z satisfying

(z + z −1 ) = −2

Writing
H(z) = 0.25(z 2 + 2z + 1)/z 2 = 0.25(z + 1)2 /z 2
the zeros are at −1, double and poles at zero. Notice the zeros satisfy the condition given above.
In general, we have

α(z + z −1 ) + β
H(z) = α + βz −1 + αz −2 =
z
the zeros are the values of z satisfying

β
(z + z −1 ) = −
α
which can be written
β
z2 + z+1=0
α p
−β/α ± (β/α)2 − 4
zeros z1,2 =
2
Notice that the relation between the zeros indicates that if z0 is a zero 1/z0 is also a zero.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.8

12.6 (a) Transfer function can be written as

1 + (−2.5) z −1 + |{z}
H(z) = |{z} 1 z −2
| {z }
h[0] h[1] h[2]

thus the impulse response is

h[n] = δ[n] − 2.5δ[n − 1] + δ[n − 2]

(b) Frequency response

H(ejω ) = e−jω (ejω − 2.5 + e−jω )


= e−jω (2 cos(ω) − 2.5)
= ej(−ω±π) (−2 cos(ω) + 2.5)
| {z }
>0

so the phase is
∠H(ejω ) = −ω ± π
or linear. This corresponds to the impulse response being symmetric about n = 1 and having no
zeros on the unit circle.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.9

12.7 (a) Letting z = ejω we get

H(ejω ) = 0.05(e2jω + e−2jω ) + 0.5(ejω + e−jω ) + 1


= 1 + cos(ω) + 0.1 cos(2ω)

so that the magnitudes for then given frequencies

|H(ej0 )| = |1 + 1 + 0.1| = 2.1


|H(ejπ/2 )| = |1 + 0 − 0.1| = 0.9
|H(ejπ )| = |1 − 1 + 0.1| = 0.1

and the phase

∠H(ej0 ) = 0
∠H(ejπ/2 ) = 0
∠H(ejπ ) = 0

The filter is low-pass with zero phase.


(b) The impulse response is

h[n] = 0.05(δ[n + 2] + δ[n − 2]) + 0.5(δ[n + 1] + δ[n − 1]) + δ[n]

which is non-causal as values of h[n] 6= 0 for n < 0.


(c) To make the filter causal we delay h[n] two samples, which does not affect the magnitude but only
the phase

h1 [n] = h[n − 2] ⇒ H1 (ejω ) = e−j2ω H(ejω )


|H1 (ejω )| = |H(ejω )|
∠H1 (ejω ) = −2ω + ∠H(ejω ) = −2ω

The phase now is linear.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.10

12.8 (a) In negative powers of z

z −2 (z + 1) z −1 + z −2
H(z) = =
z −2 z(z − 0.5) 1 − 0.5z −1
z −1 z −2
= −1
+
1 − 0.5z 1 − 0.5z −1
so that the impulse response is

h[n] = 0.5n−1 u[n − 1] + 0.5n−2 u[n − 2]

(b) As an IIR filter it would not have linear phase, h[n] is not symmetric.
(c) Poles z = 0 and z = 0.5 and the zero is z = −1. The magnitude is found using the vectorial
representation

~
|Z(ω)|
|H(ejω )| =
1 × |P~ (ω)|

~
where Z(ω) is a vector from the zero at −1 to a frequency ω on the unit circle, while P~ (ω) is a
vector from the pole at 0.5 to the frequency ω on the unit circle ( the other pole contributes a unity
value for all frequencies). At three frequencies we have

ω |H(ejω )|
0 2/(1/2)
√ p =4 p
π/2 2/ 5/4 = 8/5
π 0/1.5 = 0

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.11

12.9 This filter is all-pass. Consider


z+2 z−2
H(z) = H1 (z)H2 (z) =
z + 0.5 z − 0.5
where the poles z = −0.5, 0.5 are the inverses of the zeros z = −2, 2. The magnitude is

(ejω + 2)(e−jω + 2) 2(1 + 0.5ejω )2(1 + 0.5e−jω )


|H1 (ejω )|2 = −jω
= jω =4

(e + 0.5)(e + 0.5) e (1 + 0.5e−jω )e−jω (1 + 0.5ejω )

and likewise for |H2 (ejω )|2 , so that |H(ejω )| = 4.


Magnitude response from vectorial form

~ 1 (ω)Z
Z ~ 2 (ω)
|H(ejω )| =
P2 (ω)P~2 (ω)
~

~ i (ω), i = 1, 2 are vectors from the zeros to the frequency on the unit circle we are computing
where Z
the magnitude. Likewise P~i (ω), i = 1, 2 are vectors from the poles to the frequency on the unit circle.
We thus have
ω |H(ejω )|
0 4
π/2 4
π 4
The filter is all-pass. The poles are the inverse of the zeros.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.12

12.10 (a) i. From αmin = 20 = −20 log10 (δ) then δ = 10−1 = 0.1 and it can be verified that αmax =
0.92 = −20 log10 (1 − δ) = −20 log10 0.9.
ii. ωp = 0.5π and ωst = 0.75π
(b) i. The dc loss α(ej0 ) = 10 dB, and subtracting it we get that

αmax = 0.1 dB
αmin = 50 dB.

ii. The maximum frequency 5 kHz≤ fs /2, so the sampling frequency is fs ≥ 10 kHz.
iii. Using ω = 2πf /fs and defining α̂(ejω ) = α(ejω ) − 10 we get

0 ≤ α̂(ejω ) ≤ 0.1 dBs 0 ≤ ω ≤ 0.4π


α̂(ejω ) ≥ 50 dBs 0.8π ≤ ω ≤ π

with dc loss of 0 dB.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.13

12.11 (a) The dc gain is |H(j0)| = 1 and the gain at Ω = 1 is


1
|H(j1)| = √ |H(j0)|
2
so that Ω = 1 is the half-power frequency.
(b) K matches the normalized half-power frequency Ωhp = 1 with the half-power frequency ωhp
according to
Ωhp
K= −1 ⇒ ωhp = 2 tan (1) = π/2
tan (0.5ωhp )
(c) Replacing s by the bilinear transformation we get

1 (1 + z −1 )2
√ |s=(1−z−1 )/(1+z−1 ) = √ √
s2 + 2s + 1 (2 + 2) + (2 − 2)z −2

(d) The analog H(s) has no zeros, and its poles are

s1,2 = 1e±j3π/4

or on the left-hand s-plane.


For the discrete filter,
(z + 1)2
H(z) = √ √
(2 + 2)z 2 + (2 − 2)
so zeros are z = −1, double, and poles
√ !1/2
2− 2
z1,2 = √ e±jπ/2
2+ 2

or inside the unit circle. Thus both filters are stable.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.14

12.12 (a), (b) In rational form



X 1 z
H(z) = 0.5n z −n = =
n=0
1 − 0.5z −1 z − 0.5

with a zero at z = 0 and a pole at z = 0.5. The filter is a low-pass filter.



X 1 z
H1 (z) = (−0.5)n z −n = =
n=0
1 + 0.5z −1 z + 0.5

with zero at z = 0 and pole at z = −0.5. The filter is a high-pass filter, as the frequency response of
h1 [n] = ejπn h[n] so that H1 (ejω ) = H(ej(ω−π) ) which is the low-pass filter shifted to π.
(c) Suppose X
H(Z) = h[n]Z −n
n

is the transfer function of a LPF, if we let Z = −z = (−1)z we obtain


X X
h[n][(−1)z]−n = (h[n](−1)n )z −n
n n

so that the resulting filter has h[n](−1)n as impulse response, therefore it is high-pass.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.15

12.13 (a) Differential equation


dy(t)
+ y(t) = x(t)
dt
(b) Replacing s = K(1 − z −1 )/(1 + z −1 ) in H(s) we obtain

1 1 1 + z −1
→ K(1−z −1 )
=
s+1 +1 K − Kz −1 + 1 + z −1
1+z −1
1 + z −1 Y (z)
= =
(1 + K) + (1 − K)z −1 X(z)
giving
(1 − K)y[n − 1] + (1 + K)y[n] = x[n] + x[n − 1]
(c) Using Laplace
1
X(s) = (1 − e−0.5s )
s  
X(s) 1 1
Y (s) = = − (1 − e−0.5s )
s+1 s s+1
y(t) = (1 − e−t )u(t) + (1 − e−(t−0.5) )u(t − 0.5)

(d) The sampled signal is



1 0 ≤ 2n/K ≤ 0.5 or 0 ≤ n ≤ 0.25K
x(nTs ) =
0 otherwise

If K = 1000 = 2/Ts = 103 , then x[n] = u[n] − u[n − 251] and

y[n] = −(999/1001)y[n − 1] + (1/1001)(x[n] + x[n − 1])


= −0.9980y[n − 1] + 0.000999(x[n] + x[n − 1])

Computing the input




 1 n=0

2 1 ≤ n ≤ 250
x[n] + x[n − 1] =

 1 n = 251

0 otherwise

we use it to find the first three values of y[n]

y[0] = 0.000999
y[1] = 0.0030
y[2] = 0.0050

while the exact values are

y(0) = 0
y(0.002) = 0.0020
y(0.004) = 0.0040

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.16

12.14 (a) From the realization

X(z)
E(z) = X(z) − E(z)(z −1 + Gz −2 ) ⇒ E(z) =
1 + z −1 + Gz −2
Y (z) 1 + z −1 + z −2
Y (z) = E(z)(1 + z −1 + z −2 ) ⇒ =
X(z) 1 + z −1 + Gz −2
or

Y (z)[1 + z −1 + Gz −2 ] = X(z)[1 + z −1 + z −2 ]

which gives the difference equation:

y[n] = −y[n − 1] − Gy[n − 2] + x[n] + x[n − 1] + x[n − 2]

(b) The transfer function of the filter is

1 + z −1 + z −2
H(z) =
1 + z −1 + Gz −2
with poles √
1 − 4G
p1,2 = −0.5 ±
2
for these to be complex conjugates we need that 1 − 4G < 0 or G > 1/4. The BIBO stability
requires that |p1,2 | < 1 (inside the unit circle), or
r
1 4G − 1
+ <1
4 4
or G < 1. Thus for the system to have complex conjugate poles and to be BIBO stable we need
that 1/4 < G < 1.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.17

12.15 (a) Let


2(1 − z −1 ) 1 + 2z −1 + z −2
H(z) =
1 + 0.5z −1 1 − 0.9z −1 + 0.81z −2
| {z } | {z }
H1 (z) H2 (z)

The cascade realization of H(z) is as shown in Fig. 12.2

2
x[n] + + + + y[n]

− + + +
−1
z z −1


0.5 −2 0.9 2

z −1

−0.81

Figure 12.2: Problem 15: Cascade realization of H(z).

(b) To obtain the parallel realization we do a partial fraction expansion of H(z). Notice that H(z)
is not proper rational and so we have to obtain a constant term before performing the partial fraction
expansion

2.16 4.78 − 1.6z −1


H(z) = −4.94 + +
1 + 0.5z −1 1 − 0.9z −1 + 0.81z −2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.18

−4.94

x[n] 2.16 y[n]


+ +

z −1

−0.5
4.78
+ +

z −1

0.9 −1.6
−1
z

−0.81
Figure 12.3: Problem 15: Parallel realization of H(z).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.19

12.16 Using the variables v[n] and w[n] we obtain the following expressions

g[n] = 2v[n] + 1.8v[n − 1] + 0.4v[n − 2]


v[n] = x[n] + 1.3v[n − 1] − 0.8v[n − 2]

with Z-transforms

G(z) = (2 + 1.8z −1 + 0.4z −2 )V (z)


X(z)
V (z) =
1 − 1.3z −1 + 0.8z −2
so that
G(z) 2 + 1.8z −1 + 0.4z −2
= .
X(z) 1 − 1.3z −1 + 0.8z −2
Thus, the difference equation relating g[n] to x[n] is

g[n] = 1.3g[n − 1] − 0.8g[n − 2] + 2x[n] + 1.8x[n − 1] + 0.4x[n − 2]

For the second cascade, we have

y[n] = 3w[n] + 4.5w[n − 1] ⇒ Y (z) = (3 + 4.5z −1 )W (z)


G(z)
w[n] = g[n] + 0.3w[n − 1] ⇒ W (z) =
1 − 0.3z −1
so that
Y (z) 3 + 4.5z −1
= ⇒ y[n] = 0.3y[n − 1] + 3g[n] + 4.5g[n − 1]
G(z) 1 − 0.3z −1
where the term on the right is the difference equation relating y[n] and g[n].
(b) The overall transfer function is

Y (z) Y (z) G(z) (3 + 4.5z −1 )(2 + 1.8z −1 + 0.4z −2 )


H(z) = = =
X(z) G(z) X(z) (1 − 0.3z −1 )(1 − 1.3z −1 + 0.8z −2 )

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.20

12.2 Problems using MATLAB


12.17 (a) The transfer function is
Y (z)
H(z) = = β(αz −1 + 1 + αz)
X(z)
letting z = ejω
H(ejω ) = β(αe−jω + 1 + αejω ) = β(1 + 2α cos(ω))
(b) The dc gain is
H(ej0 ) = β(1 + 2α) = 1
so that
1
β=
1 + 2α
For the phase to be zero H(ejω ) ≥ 0 and so we could let β > 0, and 1 + 2α cos(ω) ≥ 0. The last
equation requires that for all ω the amplitude of the cos(ω) be 2α ≤ 1 or α ≤ 1/2.
If we let α = 0.5 then β = 0.5 and
H(ejω ) = 0.5(1 + cos(ω)) −π ≤ω <π
having a unit dc and zero phase as H(ejω ) ≥ 0.
For α = β = 0.5, the transfer function is
(1 + z)2
H(z) = 0.5(0.5z −1 + 1 + 0.5z) = 0.25z −1 (1 + 2z + z 2 ) = 0.25
z
so pole z = 0 and double zero z = −1 .
(c) We have that v[n] = y[n − 1] = β(αx[n − 2] + x[n − 1] + αx[n]) so the new filter is causal. The
previous filter was non-causal. The transfer function
V (z) 0.25(z + 1)2
G(z) = = z −1 H(z) =
X(z) z2
with double poles at z = 0 and double zero at z = −1. Since H(z) is zero phase, G(z) has linear phase
∠G(ejω = −ω.
The following script computes and plots the frequency responses of the two filters.

%% Pr 12_17
clear all; clf
N=128; w=[0:N/2-1]*(2*pi/N);
H=0.5*(1+cos(w));
figure(1)
subplot(221)
plot(w, abs(H)); axis([0 pi 0 1]); ylabel(’|H|’)
subplot(222)
plot(w,angle(H));axis([0 pi -0.1 0.1]); ylabel(’<H’)
beta=0.5;alpha=0.5;
b=[0.25 0.5 0.25]
[G,w]=freqz(b,1);
subplot(223)
plot(w,abs(G)); axis([0 pi 0 1]); ylabel(’|G|’)
subplot(224)
plot(w,unwrap(angle(G))); axis([0 pi -pi 0]); ylabel(’<G’); xlabel(’\omega’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.21
1 0.1

0.8
0.05
0.6

|H|

<H
0
0.4
−0.05
0.2

0 −0.1
0 1 2 3 0 1 2 3

1 0

0.8 −0.5

−1
0.6
−1.5

<G
|G|
0.4 −2

0.2 −2.5

−3
0
0 1 2 3 0 1 2 3
ω ω

Figure 12.4: Problem 17: Frequency responses of H(ejω ) (top) and G(ejω ) (bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.22

12.18 (a) We have that


1
G(z) = (1 + z −1 )2
3
1 4e−jω
G(ejω ) = e−jω (2 cos(ω/2))2 = 0.5(1 + cos(ω))
3 3
4
H(ejω ) = G(ejω )G(e−jω ) = |G(ejω )|2 = (1 + cos(ω))2
9
where we used cos2 (ω/2) = 0.5(1 + cos(ω)). The phase of H(ejω ) should be zero. Indeed, H(ejω ) is
real and positive for all −π ≤ ω ≤ π.
(b) If we multiply the polynomials G(z) and G(z −1 ) we get
1 2
H(z) = (z + 4z + 6 + 4z −1 + z −2 )
9
The impulse response is
1
h[n] = (δ[n + 2] + 4δ[n + 1] + 6δ[n] + 4δ[n − 1] + δ[n − 2])
9
which is non-causal. It can be made causal by delaying it by 2 samples. Calling

z −2 2 1
H1 (z) = z −2 H(z) = (z + 4z + 6 + 4z −1 + z −2 ) = (1 + 4z −1 + 6z −2 + 4z −3 + z −4 )
9 9
its impulse response is
1
h1 [n] = h[n − 2] = (δ[n] + 4δ[n − 1] + 6δ[n − 2] + 4δ[n − 3] + δ[n − 4])
9
which is causal. The phase of this filter is −2ω or linear.
(c) The following script computes the phase of H(z). To compute the poles and zeros we consider the
causal filter H1 (z) with 4 poles at zero, and 4 zeros. Since H(z) = z 2 H1 (z) two of the poles of H1 (z)
are cancelled so that H(z) has two poles at zero and the zeros of H1 (z).

%% Pr 12_18
clear all; clf
N=128; w=[0:N/2-1]*(2*pi/N);
H=(4/9)*(1+cos(w)).ˆ2;
figure(1)
subplot(211)
plot(w,angle(H));axis([0 pi -0.1 0.1]);ylabel(’<H’)
b=[1 4 6 4 1];
roots(b)
subplot(212)
zplane(b,1); title(’poles and zeros of H_1(z)’)

(d) To find the coefficients of H(z) = G(z)G(z −1 ) we make it causal by multiplying by z −2 so that
1
z −2 H(z) = G(z)z −2 G(z −1 ) = (1 + 2z −1 + z −2 )2
9
then we use conv to find the coefficients of the product of G(z) with itself. The final result is then
advanced by 2 to get the coefficients of H(z). In MATLAB this is done by

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.23

0.1

0.05

<H
0

−0.05

−0.1
0 0.5 1 1.5 2 2.5 3

poles and zeros of H1(z)


1

0.5

Imaginary Part
0 4 4

−0.5

−1
−3 −2 −1 0 1 2 3
Real Part

Figure 12.5: Problem 18

% convolution sum
g=(1/3)*[1 2 1]; gg=conv(g,g)

which gives

gg = 0.1111 0.4444 0.6667 0.4444 0.1111

the coefficients of H(z) corresponding to z 2 , z, 1, z −1 and z −2 .


(e) The transfer function is
1
H(z) =
(1 − 0.5z −1 )(1 − 0.5z)
and
1
H(ejω ) =
1.25 − cos(ω)
which is real and positive, so its phase is zero. The poles are at z = 0.5 and z = 2 and the zero at z = 0.
If the filter is causal, then its ROC is bigger than 2 and as such it is not stable as the pole at 2 will make
the impulse response grow.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.24

12.19 (a) The impulse responses are


h1 [n] = 0.5δ[n] + 0.5δ[n − 1] + 2.2δ[n − 2] + 0.5δ[n − 3] + 0.5δ[n − 4]
h2 [n] = −0.5δ[n] − 0.5δ[n − 1] + 0.5δ[n − 3] + 0.5δ[n − 4]
h1 [n] is even with respect to the sample at n = 2, while h2 [n] is odd with respect to the sample at
n = 2.
(b) The transfer function
G(z) = z 2 H1 (z) = 0.5(z 2 + z −2 ) + 0.5(z + z −1 ) + 2.2
so that
G(ejω ) = cos(2ω) + cos(ω) + 2.2
which is positive or zero for ω = (−π, π], so it is zero phase. Then H1 (ejω ) = e−j2ω G(ejω ) and
∠H1 (ejω ) = −2ω + 0 = −2ω, i.e., linear.
(c) The transfer function
F (z) = z 2 H2 (z) = −0.5(z 2 − z −2 ) − 0.5(z − z −1 )
so that its frequency response is
F (ejω ) = ej2ω H2 (ejω ) = −0.5(ej2ω − e−j2ω ) − 0.5(ejω − e−jω )
= −j sin(2ω) − j sin(ω) = −j(sin(2ω) + sin(ω))
which is purely imaginary, so its phase is

−π/2 when sin(2ω) + sin(ω) ≥ 0
∠F (e ) =

−π/2 ± π when sin(2ω) + sin(ω) < 0
Thus the phase of H2 (z) is

−2ω − π/2 when sin(2ω) + sin(ω) ≥ 0
∠H2 (e ) =

−2ω − π/2 ± π when sin(2ω) + sin(ω) < 0
and the corresponding group delay is a constant, so the phase of H2 (ejω ) is linear.
The following script computes and plots the impulse responses and the phase responses of the filters.
%% Pr 12_19
clear all; clf
n=0:9;
b1=[0.5 0.5 2.2 0.5 0.5];h1=[b1 zeros(1,5)];
b2=[-0.5 -0.5 0 0.5 0.5];h2=[b2 zeros(1,5)];
[H1,w]=freqz(b1,1);
[H2,w]=freqz(b2,1);
figure(1)
subplot(221)
stem(n,h1);ylabel(’h_1[n]’);axis([0 9 1.1*min(h1) 1.1*max(h1)])
subplot(222)
plot(w, unwrap(angle(H1)));ylabel(’<H1’);axis([0 pi -2*pi 0])
subplot(223)
stem(n,h2);ylabel(’h_2[n]’);axis([0 9 1.1*min(h2) 1.1*max(h2)])
xlabel(’n’)
subplot(224)
plot(w, unwrap(angle(H2)));ylabel(’<H2’);axis([0 pi -2*pi 0])
xlabel(’\omega’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.25

(d) In the above cases the impulse response of the FIRs were symmetric with respect to some sample
value, and could be shifted to get a zero phase or constant phase and then show they have linear phase.
That might not be possible for IIR filters since they might not have the required symmetry or we might
have to shift by a very large value to obtain it.
0

2 −1

−2
1.5

h1[n]

<H1
−3
1
−4

0.5 −5

−6
0
0 2 4 6 8 0 0.5 1 1.5 2 2.5 3

0
0.5
−1

−2
h2[n]

<H2
0 −3

−4

−5

−0.5 −6
0 2 4 6 8 0 0.5 1 1.5 2 2.5 3
n ω

Figure 12.6: Problem 19: Notice h1 [n] is even with respect to sample at n = 2, and h2 [n] is odd with respect
to sample at n = 2. Linear phases of H1 (ejω ) and H2 (ejω ) (right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.26

12.20 (a) Clearly H1 (z) has unit magnitude. H2 (z) is all-pass filter: let H2 (z) = (F (z))10 ,

     
jω 2 1 − 2e−jω 1 − 2ejω 1 − 2e−jω −2ejω (1 − 0.5e−jω )
|F (e )| = 0.5 0.5 = 0.5 0.5 =1
1 − 0.5e−jω 1 − 0.5ejω 1 − 0.5e−jω −0.5ejω (1 − 2e−jω )

so |H2 (ejω )| = |F (ejω )|10 = 1. Since H2 (z) is the product of F (z) ten times, its coefficients can be
computed using the function conv to find the coefficients.
(b) The following script computes the coefficients of the filters and their frequency responses and then
processes handel.

%% Pr 12_20
clear all; clf
b1=[zeros(1,99) 1];
b=[0.5 -1];a=[1 -0.5];
b2=b;a2=a;
for k=2:10; % computing coefficients of H_2(z)
b2=conv(b,b2);
a2=conv(a,a2);
end
[H1,w]=freqz(b1,1);
[H2,w]=freqz(b2,a2);
figure(1)
subplot(221)
plot(w,abs(H1));ylabel(’|H1|’);axis([0 pi 0 1.2])
subplot(222)
plot(w,unwrap(angle(H1)));ylabel(’<H1’);axis([0 pi -320 0])
subplot(223)
plot(w,abs(H2));ylabel(’|H2|’);axis([0 pi 0 1.2])
subplot(224)
plot(w,unwrap(angle(H2)));ylabel(’<H1’);axis([0 pi -32 0])

load handel; x=y’;


y1=filter(b1,1,x);
y2=filter(b2,a2,x);
figure(2)
subplot(311)
plot(x(1:200));ylabel(’x[n]’);axis([0 199 -0.4 0.4])
subplot(312)
plot(y1(1:200));ylabel(’y_1[n]’);axis([0 199 -0.4 0.4])
subplot(313)
plot(y2(1:200));ylabel(’y_2[n]’);axis([0 199 -0.4 0.4])
xlabel(’n’)

The output of H1 (z) is the input signal delayed 100 samples, the output of H2 (z) is not due to its phase
not being exactly linear, although the filter is all-pass.
(c) If the phase is linear advancing the signal 100 samples gives the original signal, while that is not
possible for the non-linear phase.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.27

0 0.4

1 −50 0.2

x[n]
|H1|
0.8 −100 0
−150

<H1
0.6 −0.2
−200 −0.4
0.4 0 20 40 60 80 100 120 140 160 180
−250
0.2
0.4
−300
0 0.2
0 1 2 3 0 1 2 3

y1[n]
0

0 −0.2

1 −5 −0.4
0 20 40 60 80 100 120 140 160 180
0.8 −10
0.4
−15
|H2|

<H1
0.6 0.2
−20

y2[n]
0.4 0
−25
0.2 −0.2
−30
0 −0.4
0 1 2 3 0 1 2 3 0 20 40 60 80 100 120 140 160 180
n

Figure 12.7: Problem 20: Magnitude and phase of filters (left). Part of handel signal (top right) and outputs
of linear–phase and non–linear phase filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.28

12.21 The minimum orders for the Chebyshev and the Butterworth are given by
 1/2
100.1αmin −1
cosh−1 100.1αmax −1
Nch ≥  
cosh−1 tan(ω st /2)
tan(ωp /2)
h 0.1αmin i
(10 −1)
log (100.1αmin −1)
Nb ≥  
tan(ωst /2)
2 log tan(ωp /2)

where for Fs = 1/Ts = 104 samp/sec, ωp = 2πfp /Fs = 0.2π (rad), ωst = 2πfst /Fs = 0.24π (rad).
Using these values and the loss specifications, we find Nb ≥ 9.97 or Nb = 10, and for the Chebyshev
we then have  0.1α 1/2
cosh−1 10 10 min −1
0.1αmax −1
9<   ≤ 10
cosh−1 tan(ω st /2)
tan(ωp /2)

which gives that


 1/2    1/2
1 10 − 1 tan(ωst /2) 1 10 − 1
cosh−1 > cosh−1 ≥ cosh−1
9 100.07 − 1 tan(ωp /2) 10 100.07 − 1
| {z } | {z }
0.295 0.266

which gives that


1.044 tan(ωp /2) > tan(ωst /2) ≥ 1.036 tan(ωp /2)
| {z } | {z }
0.339 0.336

Using ωst = 2πfst Ts we obtain that

tan−1 (0.399)/(πTs ) > fst ≥ tan−1 (0.366)/(πTs )


| {z } | {z }
1040.37 1033.1

So any value within this range will give a Chebyshev filter of the same order as the Butterworth. Notice
that the transition band shrinks from [1000 1200] for the Butterworth to [1000 1035] if we choose
fst = 1035 as illustrated by the following script we get Nb = Nc = 10.

%% Pr 12_21
clear all; clf
alphamax=0.7; alphamin=10;Fs=1/10ˆ(-4);
wp=2*pi*1000/Fs;ws=2*pi*1200/Fs;
[Nb,whp]=buttord(wp/pi,ws/pi,alphamax,alphamin)
ws=2*pi*1035/Fs;
[Nc,wn]=cheb1ord(wp/pi,ws/pi,alphamax,alphamin)

Nb =10
Nc =10

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.29

12.22 The second order low-pass filter (normalized in frequency) is

1
H(s) = √
s2 + 2s + 1

applying the bilinear transformation s = (1 − z −1 )/(1 + z −1 ) we obtain the following discrete filter

(1 + z −1 )2
H(z) = √
(1 − z −1 )2 + 2(1 − z −2 ) + (1 + z −1 )2
(1 + z −1 )2 (z + 1)2
= √ √ = √ √ √
(2 + 2) + (2 − 2)z −2 (2 + 2)(z 2 + (2 − 2)/(2 + 2))

q √ √
so we have a double zero at z = −1 and poles at z1,2 = ±j (2 − 2)/(2 + 2).

We have that Kb transforms the normalized half-power analog frequency Ωhp = 1 into the normalized
half-power frequency ωhp of the discrete filter, so that

1
Kb = 1 = ⇒ ωhp = π/2
tan(ωhp /2)

The following script verifies the analytic results

%% Pr 12_22
clear all;clf
n=1;d=[1 sqrt(2) 1];
[b,a]=bilinear(n,d,0.5)
[H,w]=freqz(b,a)
figure(1)
subplot(211)
zplane(b,a)
subplot(212)
plot(w/pi,abs(H));grid;ylabel(’|H(eˆ{j\omega})|’); xlabel(’\omega/\pi’)

The obtained coefficients are

b =0.2929 0.5858 0.2929


a =1.0000 0.0000 0.1716

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.30

0.5

Imaginary Part
0 2

−0.5

−1
−3 −2 −1 0 1 2 3
Real Part

0.8

|H(ejω)| 0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ω/π

Figure 12.8: Problem 22: Poles/zeros of H(z) with ωhp = π/2.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.31

12.23 (a)(b) The following script computes the analog filters and does the bilinear transformations.

%% Pr 12_23
clear all; clf
figure(1)
%% --- part (a)
[b,a]=butter(6,[10 20],’s’) % bandpass filter of order 12
%% --- part (b)
%[b,a]=butter(7,[10 20],’s’)
[G,w1]=freqs(b,a); % freq response of analog filter
subplot(221)
plot(w1,abs(G));grid;title(’mag of analog filter’)
hold on
plot(w1,0.707*ones(1,length(w1)),’r’)
hold off
subplot(222)
plot(w1,unwrap(angle(G)));title(’phase of analog filter’)
K=1;
[num,den]=bilinear(b,a,K/2); % bilinear transformation
[H,w]=freqz(num,den); % frequency response of discrete filter
subplot(223)
plot(w/pi, abs(H)); grid;title(’mag of discrete filter’);xlabel(’\omega/\pi’)
hold on
plot(w/pi,0.707*ones(1,length(w)),’r’);xlabel(’\omega/\pi’)
hold off
subplot(224)
plot(w/pi, unwrap(angle(H))); title(’phase of discrete filter’);xlabel(’\omega/\pi’)
% poles and zeros of filters
figure(2)
subplot(121)
zplane(b,a); title(’poles/zeros of analog filter’) % analog
subplot(122)
zplane(num,den); title(’poles/zeros of discrete filter’) %discrete

A slight increase in the order changes the performance of bilinear, as the warping makes all the poles
to be clustered around the ±π frequency. The second discrete filter cannot be accurately designed.

Poles and zeros for the two cases are shown below.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.32

mag of analog filter phase of analog filter mag of analog filter phase of analog filter
1.5 5 1 0

0 0.8 −5
1
−5 0.6 −10

−10 0.4 −15


0.5
−15 0.2 −20

0 −20 0 −25
0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100

mag of discrete filter phase of discrete filter mag of discrete filter phase of discrete filter
1.5 5 2 0

0
1.5
1 −5
−5
1
−10
0.5 −10
0.5
−15

0 −20 0 −15
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
ω/π ω/π ω/π ω/π

Figure 12.9: Problem 23: Warping effect of bilinear transformation filter of order 12 (left) and 14 (right).

poles/zeros of analog filter poles/zeros of discrete filter poles/zeros of analog filter poles/zeros of discrete filter

20 2 20
2

15 1.5 15
1.5

10 1 10
1

5 0.5 5 0.5
Imaginary Part
Imaginary Part

Imaginary Part

Imaginary Part
0 6 0 0 7 0

−5 −0.5 −5 −0.5

−1
−10 −1 −10

−1.5
−15 −1.5 −15

−2
−20 −2 −20

−10 −5 0 5 −1 −0.5 0 0.5 1 −10 −5 0 5 −1 −0.5 0 0.5 1


Real Part Real Part Real Part Real Part

Figure 12.10: Problem 23: Poles/zeros of discrete filter for bilinear transformation of order 12 (left) and 14
(right).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.33

12.24 (a)(b) The filter G(s) is an all-pass filter with linear phase θ(Ω) = −5Ω. The frequency range 0 ≤
Ω ≤ 20 (rad/sec) is transformed by the Ω = K tan(ω/2) = tan(ω/2) for K = 1, into 0 ≤ ω ≤
2 tan−1 (20) = 3.04 (rad). The phase is then transformed into −5 tan(ω/2), the phase of the discrete
filter. The Ω vs ω is computed and plotted in the following script.

% Pr. 12_24
clear all;clf
W=0:0.1:20;N=5;G=exp(-j* N*W); % discretization of linear phase of G(s)
w=2*atan(W); % discrete frequencies
figure(1)
plot(w,W); axis([0 max(w) 0 max(W)]);
grid;xlabel(’\omega (rad)’);ylabel(’\Omega (rad/sec)’)
H=exp(-j*N*tan(w/2))
figure(2)
subplot(211)
plot(W,unwrap(angle(G))); ylabel(’\angle{G(j\Omega)}’)
xlabel(’\Omega (rad/sec)’)
subplot(212)
plot(w,unwrap(angle(H))) ; ylabel(’\angle{H(eˆ{j\omega})}’);
xlabel(’\omega (rad/sec)’)

(c) Since the BT is a frequency transformation, H(z) is also an all-pass filter, indeed

H(ejω ) = 1e−j5 tan(ω)/2 .

Although the phase of G(s) is linear, the phase of H(z) is not.

0
20
−20

18 −40
∠G(jΩ)

−60
16
−80
14
−100
12 −120
Ω (rad/sec)

0 2 4 6 8 10 12 14 16 18 20
10 Ω (rad/sec)

8 0

−20
6
−40
∠H(ejω)

4
−60
2
−80
0
0 0.5 1 1.5 2 2.5 3
−100
ω (rad) 0 0.5 1 1.5 2 2.5 3 3.5
ω (rad/sec)

Figure 12.11: Problem 24: Effect of bilinear transformation on phase.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.34

12.25 We have that Ts = 1/Fs = 0.5 × 10−3 sec/sample, so Kb = cot(0.5ωhp ) = cot(2πfhp /(2Fs )) =
25.45. In this case, we use the loss function for the Butterworth to find the order
2N
α(ejωst ) = 10 log [1 + (Kb tan(2πfst /(2Fs )))] ≥ 38

The minimum order is


log(103.8 − 1)
N≥ = 6.298
2 log(0.078Kb )
so that N = 7.
The frequency normalized analog filter in factorized form is
G
H7 (s) = = GH1 (s)H2 (s)H3 (s)H4 (s)
(s + 1)(s2 + 1.8s + 1)(s2 + 1.25s + 1)(s2 + 0.45s + 1)
We have then
1 (1/(Kb − 1)(1 + z −1 )
H1 (z) = |s=Kb (1−z−1 )/(1+z−1 ) =
s+1 (Kb + 1)/(Kb − 1) − z −1
For the others which are second-order we have
1
Hi (z) = Hi (s)|s=Kb (1−z−1 )/(1+z−1 ) = |BT
s2 + (1/Qi )s + 1
(1 + z −1 )2
=
(Kb + Kb /Qi + 1) − 2(Kb2 − 1)z −1 + (Kb2 − Kb2 /Qi + 1)z −2
2

for i = 2, 3, 4 and Q2 = 1/1.8, Q3 = 1/1.25, and Q4 = 1/0.45. Replacing Kb and Qi we get

0.04(1 + z −1 )
H1 (z) =
1 − 0.92z −1
1.44 × 10−3 (1 + z −1 )2
H2 (z) =
1 − 1.86z −1 + 0.87z −2
1.47 × 10−3 (1 + z −1 )2
H3 (z) =
1 − 1.9z −1 + 0.91z −2
1.51 × 10−3 (1 + z −1 )2
H4 (z) =
1 − 1.96z −1 + 0.91z −2
To get H7 (ej0 ) = 1 so that the dc loss is 0 db,

GH1 (1)H2 (1)H3 (1)H4 (1) = 1

which gives G = 1.

%% Pr 12_25
N = 7; fhp = 25; Fs = 2000;
whp = 2*pi*fhp/Fs;
[b, a] = butter(N, whp/pi);
% analytic results
% coefficients of H1
b1 = [0.04, 0.04]; a1 = [1, -0.92];
% coefficients of H2

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.35

b2 = 1.44e-3*[1, 2, 1]; a2 = [1, -1.86, 0.87];


% coefficients of H3
b3 = 1.47e-3*[1, 2, 1]; a3 = [1, -1.9, 0.91];
% coefficients of H4
b4 = 1.51e-3*[1, 2, 1]; a4 = [1, -1.96, 0.91];
% comparison of analytic and MATLAB results
analyticalB = conv(conv(conv(b1, b2), b3), b4)
matlabB = b
analyticalA = conv(conv(conv(a1, a2), a3), a4)
matlabA = a

The comparison of analytic and computational results gives

analyticalB =1.0e-08 *
0.0128 0.0895 0.2685 0.4475 0.4475 0.2685 0.0895 0.0128
matlabB =1.0e-08 *
0.0121 0.0848 0.2544 0.4240 0.4240 0.2544 0.0848 0.0121

analyticalA = 1.0000 -6.6400 18.8560 -29.6888 27.9928 -15.8063 4.9490


-0.6628
matlabA = 1.0000 -6.6471 18.9442 -30.0084 28.5329 -16.2848 5.1656
-0.7025

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.36

12.26 According to the results of the following script, we have:


(a) The given filter is all–pass.
(b) Using K = 1.4 we get the desired response. The discrete filter is also all-pass given given the location of its
poles and zeros
(c) The output differs from a shifted input, but it is a good approximation, so the phase is approximately linear.

%% Pr 12_26
clear all; clf
b=[1 -4 8 -8 4];a=[1 4 8 8 4];
[G,W]=freqs(b,a); % all-pass analog filter
figure(1)
subplot(221)
plot(W,abs(G))
subplot(222)
plot(W,unwrap(angle(G)))
subplot(223)
splane(b,a)

figure(2)
K=1.4; % bilinear transformation
[num,den]=bilinear(b,a,K/2);
[H,w]=freqz(num,den);
[H,w]=freqz(num/H(1),den); % unit-gain filter
subplot(311)
plot(w/pi, abs(H)); grid
hold on
plot(w/pi,0.707*ones(1,length(w)),’r’)
hold off
subplot(312)
plot(w/pi,unwrap(angle(H)))
subplot(313)
zplane(num,den)
n=0:100;
x=sin(0.2*pi*n);
y=filter(num,den,x); % output of H(z)
figure(4)
subplot(211)
plot(n,x)
subplot(212)
plot(n,y,’r’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.37

1 0 1

−2 1
1

|H|
−4
1

<G
|G|
1 −6
1
−8 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
−10
0
1 −12
0 2 4 6 8 10 0 2 4 6 8 10 −5
ω/π

<H
−10
2
−15
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1 ω/π
2
2

Imaginary Part
0
jΩ

1 2
0 2
−1
−1
−2 2
−2
−2 −1 0 1 2 3 −10 −5 0 5 10
σ Real Part

0.5
x[n]

−0.5

−1
0 10 20 30 40 50 60 70 80 90 100

1.5

0.5
y[n]

−0.5

−1
0 10 20 30 40 50 60 70 80 90 100
n

Figure 12.12: Problem 26: Magnitude and phase of G(s), H(z) (top, left and right). Input and output of
H(z).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.38

12.27 The desired filter is a low-pass, with fp = 1 kHz, αmax = 3 dB, so that fp = fhp ; fst = 2 kHz,
αmin = 10 dB, and dc gain of 10 after the design with dc of 0 dB. Since fmax = 5 kHz, then we can
choose Fs = 10 kHz. The coefficients of the resulting filter are shown below.

%% Pr 12_27
Fs=10000;fp=1000;fst=2000;
wp=2*pi*fp/Fs/pi; ws=2*pi*fst/Fs/pi;
alphamax=3; alphamin=10;
[N,wn]=buttord(wp,ws,alphamax,alphamin)
[b,a]=butter(N,wp); % to guarantee that wp is half-power frequency (wn\ne wp)
G=10*sum(b)/sum(a);
b=G*b;
[H,w]=freqz(b,a);
figure(1)
subplot(221)
zplane(b,a)
subplot(222)
plot(w/pi*Fs/2, abs(H));grid; axis([0 Fs/2 -0.1 11])
subplot(223)
plot(w/pi*Fs/2,unwrap(angle(H)));grid; axis([0 Fs/2 -4 0])

b = 0.6746 1.3491 0.6746

a = 1.0000 -1.1430 0.4128

1 10

0.5 8
Imaginary Part

2 6
0
4
−0.5
2
−1 0
−1 −0.5 0 0.5 1 0 1000 2000 3000 4000 5000
Real Part

−1

−2

−3

−4
0 1000 2000 3000 4000 5000

Figure 12.13: Problem 27: Poles/zeros and magnitude and phase responses.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.39

12.28 The following script designs the desired filters, computes and plots the output of the filtered signals and
different spectra:

%% Pr 12_28
clear all; clf
load train;y=y’; N=256;
noise=0.1*randn(1,N);
yc=y(1:N);
yn=yc+noise; % noisy signal
%[b,a]=butter(20,0.5); % butterworth
[b,a]=cheby2(20,60,0.5); % cheby2
%[b,a]=cheby1(20,0.01,0.5) % cheby1
figure(1)
[H,w]=freqz(b,a);
b=b/H(1);
[H,w]=freqz(b,a); % unit dc gain
subplot(311)
plot(w/pi, abs(H)); grid
hold on
plot(w/pi,0.707*ones(1,length(w)),’r’)
hold off
subplot(312)
plot(w/pi,unwrap(angle(H)))
subplot(313)
zplane(b,a)

k=0:N-1;w1=k*2*pi/N;w1=w1/pi-1;
Ns=fftshift(abs(fft(noise))); % noise spectrum
Yc=fftshift(abs(fft(yc))); % clean signal spectrum
Yn=fftshift(abs(fft(yn))); % noisy signal spectrum

figure(2)
subplot(311)
plot(w1,Yc); title(’clean signal spectrum’)
subplot(312)
plot(w1,Yn); title(’noisy signal spectrum’)
subplot(313)
plot(w1,Ns); title(’noise spectrum’)

yy=filter(b,a,yn);
n=0:N-1;
figure(3)
subplot(311)
plot(n,yn,’r’);title(’noisy/clean signal’)
hold on
plot(n,yc);legend(’noisy’,’clean’)
hold off
subplot(312)
plot(n,yy,’r’);legend(’clean signal’)
subplot(313)
plot(n,yc); legend(’filtered’,’clean’)
hold off

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.40

clean signal spectrum


1.5 15

1 10

0.5 5

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1

10 noisy signal spectrum


15

0 10

−10 5

−20 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
noise spectrum
1 4
Imaginary Part

0.5 3
0 2
−0.5 1
−1 0
−5 −4 −3 −2 −1 0 1 2 3 4 5 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
Real Part

noisy/clean signal
0.4
0.2 noisy
0 clean
−0.2
−0.4
−0.6

0 50 100 150 200 250

0.4
0.2 clean signal
0
−0.2
−0.4

0 50 100 150 200 250

0.4
filtered
0.2
0
−0.2
−0.4
0 50 100 150 200 250

Figure 12.14: Problem 28: Chebyshev 2 case: Filter frequency response and poles zeros (top left), spectra of
different signals, signals (bottom)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.41

12.29 (a)(b) Multiplying by −1 the gain specifications we obtain the loss specifications

0 ≤ α(ω) ≤ 0.1 0 ≤ ω ≤ 0.2π


α(ω) ≥ 60 0.3π ≤ ω ≤ π

so that the d.c. loss is 0 dB, αmax = 0.1 and αmin = 15 dBs. The frequencies are ωp = 0.2π,
ωst = 0.3π

%% Pr 12_29
clear all; clf
alphamax=0.1; alphamin=60; wp=0.2; ws=0.3;
[Nb,wn]=buttord(wp,ws,alphamax,alphamin)
[b1,a1]=butter(Nb,wn);
[Hb,w]=freqz(b1,a1);

[Nc,wn]=cheb1ord(wp,ws,alphamax,alphamin);
[b2,a2]=cheby1(Nc,alphamax,wn);
[Hc,w]=freqz(b2,a2);

[Ne,wn]=ellipord(wp,ws,alphamax,alphamin);
[b3,a3]=ellip(Ne,alphamax,alphamin,wn)
[He,w]=freqz(b3,a3);

figure(1)
subplot(221)
zplane(b1,a1)
subplot(222)
zplane(b2,a2)
subplot(223)
zplane(b3,a3)

figure(2)
plot(w/pi, abs(Hb))
hold on
plot(w/pi, abs(Hc),’r’)
hold on
plot(w/pi, abs(He),’g’);grid; axis([0 1 -0.1 1.1])
legend(’Butterworth’,’Chebyshev’, ’Elliptic’)

The minimum orders of the filters are

Nb =20 Butterworth
Nc =10 Chebyshev
Ne =6 Elliptic

The frequency responses are very similar.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.42

1 1

Butterworth
Imaginary Part 0.5 0.5

Imaginary Part
1 Chebyshev
Elliptic
0 0
0.8
−0.5 −0.5

−1 −1
0.6
−1.5 −1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
Real Part Real Part

0.4
1

0.5
Imaginary Part

0.2
0

−0.5 0

−1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1


−1 −0.5 0 0.5 1
Real Part

Figure 12.15: Problem 29: Poles/zeros (left, clockwise from top left) and magnitude responses of Butterworth,
Chebyshev and elliptic filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.43

12.30 (a) For the filter to be all-pass the zeros must be the inverse of the poles 0.5 and −0.5 or 2 and −2. Thus

(1 − 2z −1 )(1 + 2z −1 ) (1 − 4z −2 )
H(z) = K −1 −1
=K K>0
(1 − 0.5z )(1 + 0.5z ) (1 − 0.25z −2 )

As an all-pass H(z) has a constant magnitude (at any frequency) and in this case we want it to be unity.
For instance, for this filter to have unit gain at ω = π/2 we need that

1 − 4j 2
|H(ejπ/2 )| = K = K 5 = 1 ⇒ K = 1.25 = 0.25
1 − 0.25j 2 1.25 5

(b) The zeros of H(z) are α1 and −α2 which are real. For H(z) to be a notch filter |αi | = 1, and so we
let α1 = α2 = 1 for notches at ω = 0, π. Thus

(1 − z −1 )(1 + z −1 ) (1 − z −2 )
H(z) = K −1 −1
=K
(1 − 0.5z )(1 + 0.5z ) (1 − 0.25z −2 )

and for it to have unit gain at ω = π/2



1 − j2
|H(ejπ/2 )| = K = K 2 = 1 ⇒ K = 1.25 = 0.25
1 − 0.25j 2 1.25 2

(c) In general, the filter


(1 − α2 z −2 )
H(z) = K
(1 − 0.25z −2 )
for 1 ≤ α ≤ 2 is a family of notch filters with notches at ω = 0, π, including an all-pass filter when
α = 2. The gain K > 0 is

1 − α2 j 2 2
|H(ejπ/2 )| = K = K 1 + α = 1 ⇒ K = 1.25
1 − 0.25j 2 1.25 1 + α2

(d) If we let z −1 = jZ −1 the filter becomes

(1 − α2 j 2 Z −2 ) (1 + α2 Z −2 )
H(Z) = K −2
=K
2
(1 − 0.25j Z ) (1 + 0.25Z −2 )

with poles at ±0.5ejπ/2 and zeros at ±αejπ/2 , i.e., shifted 90o with respect to the ones before. For
values of 1 ≤ α ≤ 2, H(Z) is a family of notch filters at ω = π/2, including an all-pass filter when
α = 2.
When running the following script make the numerator and the denominator correspond to H(z) or to
H(Z) by deleting the comment symbol.

%% Pr 12_30
clear all;clf
%a=[1 0 -0.25]; %% denominator of H(z)
a=[1 0 0.25]; %% denominator of H(Z)
figure(1)
for alpha=2:-0.1:1;
alpha
K=1.25/(1+alphaˆ2)
%b=[K 0 -(alphaˆ2)*K]; %% numerator of H(z)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.44

b=[K 0 (alphaˆ2)*K]; %% numerator of H(Z)


[H,w]=freqz(b,a);
subplot(211)
zplane(b,a); axis([-2 2 -2.5 2.5])
hold on
subplot(212)
plot(w/pi,abs(H));axis([0 1 0 1.5])
hold on
pause(1)
end
hold off

Imaginary Part
1

−1

−2

−2 0 2
Real Part

1.5

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

2
Imaginary Part

−1

−2

−2 0 2
Real Part

1.5

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Figure 12.16: Problem 30: Loci of poles and zeros and magnitude responses of H(z) (top) and of H(Z)
(bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.45

12.31 (a)(b)The filter transfer function is


1 + z4
H(z) = K
1/16 + z 4
so that at ω = 0 we get
2 17
H(1) = K =1 ⇒ K=
17/16 32
The zeros and poles of H(z) are:

Zeros: z 4 + 1 = 0 ⇒ zk = ej(2k+1)π/4 , k = 0, · · · , 3
1 j(2k+1)π/4
Poles: z 4 + 1/16 = 0 ⇒ zk = e , k = 0, · · · , 3
2
The distribution of the zeros and poles makes the magnitude frequency response look like a comb.
The phase is plotted using MATLAB, it cannot be unwrapped because of the zeros on the unit circle
make the phase discontinuous.

%% Pr 12_31
clear all;clf
b=[1 0 0 0 1];
a=[1 0 0 0 1/16];
[H,w]=freqz(b,a);
figure(1)
[H,w]=freqz(b,a);
b=b/H(1);
[H,w]=freqz(b,a);
subplot(311)
plot(w/pi, abs(H)); grid
hold on
plot(w/pi,0.707*ones(1,length(w)),’r’)
hold off
subplot(312)
plot(w/pi,unwrap(angle(H)))
subplot(313)
zplane(b,a)

(c) The two filters are obtained as shown below. Notice the change in the coefficients of the numerators
to get unit gain in the bands outside the notches. Connecting the two filters in parallel gives a sharper
notch filter than the above one. The coefficients are computed using conv to implement multiplication
of polynomials.

% Butterworth implementation
[b1,a1]=butter(5,[0.245 0.255],’stop’)
[b2,a2]=butter(5,[0.745 0.755],’stop’)
[H1,w]=freqz(b1/2,a1);
[H2,w]=freqz(b2/2,a2);
H12=H1+H2; % parallel connection
% coefficients of H
a12=conv(a1,a2)
b12=conv(a1,b2)+conv(a2,b1)
figure(2)
subplot(311)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.46

plot(w/pi, abs(H12)); grid


subplot(312)
plot(w/pi,unwrap(angle(H12)))
subplot(313)
zplane(b12,a12)

1 1.5

1
0.5
0.5

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

2 2
1 1

0 0

−1 −1

−2 −2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1 1
Imaginary Part

Imaginary Part
0.5 0.5
0 0
−0.5 −0.5
−1 −1
−5 −4 −3 −2 −1 0 1 2 3 4 5 −5 −4 −3 −2 −1 0 1 2 3 4 5
Real Part Real Part

Figure 12.17: Problem 31: Magnitude and phase responses of comb filter (left) and of sharper notch filter.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.47

12.32 Designing a low-pass, a band-pass and a high-pass and connecting them in parallel we obtain the desired
bank of filters. The following script does the filtering design and the filtering of the speech signal.
%% Pr 12_32
clear all; clf
fs=10000;f1=fs/4;f2=3*fs/8;
w1=2*pi*f1/fs;w1=w1/pi
w2=2*pi*f2/fs;w2=w2/pi

[b1,a1]=butter(20,w1,’low’)
[b2,a2]=butter(10,[w1 w2])
[b3,a3]=butter(20,w2,’high’)

[H1,w]=freqz(b1,a1);
figure(1)
subplot(311)
plot(w/pi, abs(H1)); grid
subplot(312)
plot(w/pi,unwrap(angle(H1)))
subplot(313)
zplane(b1,a1)

[H2,w]=freqz(b2,a2);
figure(2)
subplot(311)
plot(w/pi, abs(H2)); grid
subplot(312)
plot(w/pi,unwrap(angle(H2)))
subplot(313)
zplane(b2,a2)

[H3,w]=freqz(b3,a3);
figure(3)
subplot(311)
plot(w/pi, abs(H3)); grid; xlabel(’\omega/\pi’)
subplot(312)
plot(w/pi,unwrap(angle(H3))); xlabel(’\omega/\pi’)
subplot(313)
zplane(b3,a3)

H=H1+H2+H3;
figure(4)
subplot(211)
plot(w/pi, abs(H1));grid;
hold on
plot(w/pi, abs(H2),’r’);
hold on
plot(w/pi, abs(H3),’g’); xlabel(’\omega/\pi’)
hold off
subplot(212)
plot(w/pi, abs(H)); grid
axis([0 1 0 1.1*max(abs(H))]); xlabel(’\omega/\pi’)
load handel; y=y(1:1001)’;

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.48

y1=filter(b1,a1,y);
y2=filter(b2,a2,y);
y3=filter(b3,a3,y);
n=0:1000;
figure(5)
subplot(411)
plot(n,y);axis([0 1000 -0.3 0.3])
subplot(412)
plot(y1);axis([0 1000 -0.3 0.3])
subplot(413)
plot(y2);axis([0 1000 -0.3 0.3])
subplot(414)
plot(y3);axis([0 1000 -0.3 0.3])
w=[0:1000]*2*pi/1000-pi;f =w*Fs
figure(6)
subplot(411)
plot(f,abs(fftshift(fft(y)))); axis([min(f) max(f) 0 20])
subplot(412)
plot(f,abs(fftshift(fft(y1)))); axis([min(f) max(f) 0 20])

subplot(413)
plot(f,abs(fftshift(fft(y2)))); axis([min(f) max(f) 0 3])

subplot(414)
plot(f,abs(fftshift(fft(y3)))); axis([min(f) max(f) 0 1])

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.49

1.5
0.2

0
1
−0.2
0 100 200 300 400 500 600 700 800 900 1000

0.5
0.2

0
0 −0.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ω/π 0 100 200 300 400 500 600 700 800 900 1000

0.2
1 0

0.8 −0.2
0 100 200 300 400 500 600 700 800 900 1000
0.6

0.4 0.2

0
0.2
−0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 100 200 300 400 500 600 700 800 900 1000
ω/π n
20

10

0
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
4
x 10
20

10

0
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
4
x 10
3
2
1
0
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
4
x 10
1

0.5

0
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
f (Hz) 4
x 10

Figure 12.18: Problem 32: Bank of filters (top left), handel signal and filtered signals, and their spectra
(bottom figure)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.50

12.33 For fs = 2000 Hz, the cutoff frequency of the FIR is

2πfc
ωc = = 0.25π
fs

so that the desired impulse response is


Z π/4 
1 jωn sin(πn/4)/(πn) n 6= 0
hd [n] = 1e dω =
2π −π/4 0.25 n=0

The designed filter has a transfer function


20
X
Ĥ(z) = hd [n − 10]w[n − 10]z −n
n=0

where w[n] is a window, centered at n = 0.


If w[n] is a rectangular window,
20
X sin(π(n − 10)/4) −n
Ĥ(z) = 0.25 + z
π(n − 10)
n=0,n6=10

With Barlett’s window


20
X  
sin(π(n − 10)/4) 2|n − 10| −n
Ĥ(z) = 0.25 + 1− z
π(n − 10) 20
n=0,n6=10

This script will compute the impulse responses and their corresponding frequency responses.

%% Pr 12_33
clear all; clf
for n=0:20,
if n==10,
h1(n+1)=0.25;h2(n+1)=0.25;
else
h1(n+1)=sin(pi*(n-10)/4)/(pi*(n-10)); % rectangular window
h2(n+1)=h1(n+1)*(1-abs(n-10)/10); % Barlett’s window
end
end
[H1,w]=freqz(h1,1);[H2,w]=freqz(h2,1);
figure(1)
subplot(221)
plot(w/pi,abs(H1));axis([0 1 0 1.1]);grid;ylabel(’|H1|’)
subplot(222)
plot(w/pi, unwrap(angle(H1)));axis([0 1 -10 0]);grid; ylabel(’<H1’)
subplot(223)
plot(w/pi,abs(H2));axis([0 1 0 1.1]);grid; ylabel(’|H2|’);xlabel(’\omega/\pi’)
subplot(224)
plot(w/pi, unwrap(angle(H2)));axis([0 1 -20 0]);grid;ylabel(’<H1’)
xlabel(’\omega/\pi’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.51
0
1
−2
0.8
−4
0.6

|H1|

<H1
0.4 −6

0.2 −8

0 −10
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1

0
1

0.8 −5

0.6
|H2|

<H1
−10
0.4
−15
0.2

0 −20
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
ω/π ω/π

Figure 12.19: Problem 33: Magnitude and phase responses of FIR using rectangular (top) and Barlett’s
window. Design with Barlett’s window is smoother but has wider bandwidth.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.52

12.34 The desired impulse response is


Z π/3 
1 jωn sin(πn/3)/(πn) n 6= 0
hd [n] = 1e dω =
2π −π/3 0.33 n=0

The designed filter has a transfer function

N
X −1
Ĥ(z) = hd [n − (N − 1)/2]w[n − (N − 1)/2]z −n
n=0

where w[n] is a window, centered at n = 0.


If w[n] is a rectangular window, N = 21 then

20
X sin(π(n − 10)/3) −n
Ĥ(z) = 0.33 + z
π(n − 10)
n=0,n6=10

Similarly for N = 81. The following script shows how to design the different filters (notice the com-
putation of the desired impulse response h[n]).

%% Pr 12_34
clear all;clf
N=81;% N=21
wk=kaiser(N,4.5)’;
wh=hamming(N)’;M=floor(N/2)
for n=0:N-1,
if n==floor(N/2),
h1(n+1)=0.33;
else
h1(n+1)=sin(pi*(n-M)/3)/(pi*(n-M));
end
end
h2=h1.*wk;
h3=h1.*wh;
[H1,w]=freqz(h1,1);[H2,w]=freqz(h2,1);[H3,w]=freqz(h3,1);
figure(1)
subplot(321)
stem(h1)
subplot(322)
plot(w/pi,abs(H1)); axis([0 1 0 1.1]);grid
subplot(323)
stem(h2)
subplot(324)
plot(w/pi,abs(H2)); axis([0 1 0 1.1]);grid
subplot(325)
stem(h3)
subplot(326)
plot(w/pi,abs(H3)); axis([0 1 0 1.1]);grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.53
1
0.4
0.3
0.2 0.5
0.1
0
0
0 20 40 60 80 0 0.2 0.4 0.6 0.8 1

1
0.4
0.3
0.2 0.5
0.1
0
0
0 20 40 60 80 0 0.2 0.4 0.6 0.8 1

1
0.4
0.3
0.2 0.5
0.1
0
0
0 20 40 60 80 0 0.2 0.4 0.6 0.8 1

Figure 12.20: Problem 34: Impulse and magnitude responses of FIR using rectangular (top), Kaiser and
Hamming (bottom) windows.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.54

12.35 (a) Modulating the impulse response h[n] of an IIR filter gives a new filter with transfer function

X
Ĥ(z) = 2h[n] cos(ω0 n)z −n
n=0
X∞ ∞
X
= h[n](ejω0 z −1 )n + h[n](e−jω0 z −1 )n
n=0 n=0
−jω0 jω0
= H(e z) + H(e z)
so that if H(z) = B(z)/A(z) then
B(ejω0 z) B(e−jω0 z)
Ĥ(z) = + .
A(ejω0 z) A(e−jω0 z)
(b) For the given transfer function
1
H(z) =
1 − az −1
for 0 < a < 1. The transformed filter is
Ĥ(z) = H(e−jω0 z) + H(ejω0 z)
1 1
= +
1 − aejωo z −1 1 − ae−jωo z −1
2 − 2a cos(ω0 )z −1
=
1 − 2a cos(ω0 )z −1 + a2 z −2

If a = 0.5 and ω0 = π/2, i.e., we want to convert the prototype low-pass filter into a band-pass filter,
we get
2 2z 2
Ĥ(z) = −2
= 2
1 + 0.25z z + 0.25
with two zeros at z = 0 and two poles at z = ±j0.5, so that the filter is a bandpass filter with center
frequency π/2.
(c) To get a high–pass filter we let ω0 = π. The following script computes and plots the different
frequency responses.
%% Pr 12_35
clear all; clf
b=1;a=[1 -0.5];
[H,w]=freqz(b,a);
alpha=0.5; w0=pi/2
b1=[2 -2*alpha*cos(w0)];a1=[1 -2*alpha*cos(w0) alphaˆ2];
w0=pi
b2=[2 -2*alpha*cos(w0)];a2=[1 -2*alpha*cos(w0) alphaˆ2];
[H1,w]=freqz(b1,a1);
[H2,w]=freqz(b2,a2);
figure(1)
lot(311)
plot(w/pi,abs(H));axis([0 1 0 2]);grid
subplot(312)
plot(w/pi,abs(H1));axis([0 1 0 3]);grid
subplot(313)
plot(w/pi,abs(H2));axis([0 1 0 4]);grid

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.55

2
1.5

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

4
3

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Figure 12.21: Problem 35: Magnitude responses of low–pass prototype (top) and band–pass and high–pass
filters (middle and bottom).

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.56

12.36 (a) The impulse response h[n] = 0.5n u[n], and so the downsampled impulse response is

g[n] = h[2n] = 0.52n u[2n] = 0.25n u[n]

since

1 2n ≥ 0 or n ≥ 0
u[2n] =
0 n<0

i.e., equal to u[n].


(b) The transfer function of the original filter is

X∞
1
H(z) = = 0.5n z −n
1 − 0.5z −1 n=0

while that of the downsampled filter is

X∞
1
G(z) = = 0.25n z −1
1 − 0.25z −1 n=0

If h[n] were bandlimited to π/2 we would expect that G(ejω ) = 0.5H(ejω/2 ). We have that

1
H(ejω/2 ) =
1 − 0.5e−jω/2
1
G(ejω ) =
1 − 0.25e−jω

which is not as expected since the maximum frequency in h[n] is higher than π/2.

%% Pr 12_36
clear all; clf
n=0:100;
h=0.5.ˆn;a=[1 -0.5];
g=0.25.ˆn;c=[1 -0.25];
[H,w]=freqz(1,a);
[G,w]=freqz(1,c);

figure(1)
subplot(221)
stem(n(1:10),h(1:10));ylabel(’h[n]’)
subplot(222)
plot(w/pi,abs(H));axis([0 1 0 2]);grid
ylabel(’|H|’)
subplot(223)
stem(n(1:10),g(1:10));ylabel(’g[n]’);xlabel(’n’)
subplot(224)
plot(w/pi,abs(G));axis([0 1 0 2]);grid
ylabel(’|G|’);xlabel(’\omega/\pi’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.57

1 2

0.8
1.5
0.6

h[n]

|H|
1
0.4
0.5
0.2

0 0
0 2 4 6 8 10 0 0.2 0.4 0.6 0.8 1

1 2

0.8
1.5
0.6

g[n]

|G|
1
0.4
0.5
0.2

0 0
0 2 4 6 8 10 0 0.2 0.4 0.6 0.8 1
n ω/π

Figure 12.22: Problem 36: Impulse and magnitude responses.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.58

12.37 (a) The impulse response h[n] corresponding to H(z) is

1
h[n] = (δ[n] + δ[n − 1] + δ[n − 2])
3

and the desired impulse response is

1
g[n] = cos(πn)h[n] = (−1)n (δ[n] + δ[n − 1] + δ[n − 2])
3
1
= (δ[n] − δ[n − 1] + δ[n − 2])
3

The frequency response of the high-pass filter is obtained from g[n] directly, or by using the modulation
property according to which the Fourier transform of g[n] = cos(πn)h[n] is

G(ejω ) = 0.5H(ej(ω−π) ) + 0.5H(ej(ω+π) ) = H(−ejω )


1
= (1 − e−jω + e−j2ω )
3
e−jω
= (2 cos(ω) − 1)
2

(b)

%% Pr 12_37
clear all;clf
n=0:10;
h=(1/3)*[1 1 1];
g=(1/3)*[1 -1 1];
[H,w]=freqz(h,1);
[G,w]=freqz(g,1);
figure(1)
subplot(221)
stem(n,[h zeros(1,8)]); ylabel(’h[n]’)
subplot(222)
plot(w/pi,abs(H));axis([0 1 0 1.1]);grid;ylabel(’|H|’)
subplot(223)
stem(n,[g zeros(1,8)]);ylabel(’h[n]’);xlabel(’n’)
subplot(224)
plot(w/pi,abs(G));axis([0 1 0 1.1]);grid;ylabel(’|H|’);xlabel(’\omega/pi’)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.59

0.4
1

0.3 0.8

0.6

h[n]

|H|
0.2
0.4
0.1
0.2

0 0
0 2 4 6 8 10 0 0.2 0.4 0.6 0.8 1

0.4
1

0.2 0.8

0.6

h[n]

|H|
0
0.4
−0.2
0.2

−0.4 0
0 2 4 6 8 10 0 0.2 0.4 0.6 0.8 1
n ω/pi

Figure 12.23: Problem 37: Impulse and magnitude responses of low– and high–pass filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.60

12.38 Let the transformation be of a general form

N (z)
Z −1 =
D(z)

Given the low-pass prototype filter found from MATLAB to be

b0 + b1 Z −1 + b2 Z −2
H(Z) =
a0 + a1 Z −1 + a2 Z −2

To get the desired filter we replace Z −1

b0 + b1 N (z)/D(z) + b2 N 2 (z)/D2 (z)


H(z) =
a0 + a1 N (z)/D(z) + a2 N 2 (z)/D2 (z)
b0 D2 (z) + b1 N (z)D(z) + b2 N 2 (z)
=
a0 D2 (z) + a1 N (z)D(z) + a2 N 2 (z)

To implement the multiplication of the polynomials we use the convolution sum property, i.e., the
coefficients of products of polynomials are obtained by their convolution. So,

D2 (z) ⇔ d∗d
2
N (z) ⇔ n∗n
N (z)D(z) ⇔ n∗d

where d = [d0 d1 d2 ], n = [n0 n1 n2 ] are vectors formed by the coefficients of D(z) and N (z) in
increasing powers of z −1 . The coefficients of the numerator and denominator of H(z) are thus

b̂ = b0 (d ∗ d) + b1 (n ∗ d) + b2 (n ∗ n)
â = a0 (d ∗ d) + a1 (n ∗ d) + a2 (n ∗ n)

(a)–(c) Using the above results, the following script is used to design the prototype low-pass, to deter-
mine the transformations and to obtain the desired filters.

%% Pr 12_38
clear all; clf
[b,a]=butter(2,0.5); % prototype lpf
[H,w]=freqz(b,a);

% transformation parameters
thetap=pi/2;wp=pi/3;
alpha1= -cos((thetap+wp)/2)/cos((thetap-wp)/2);
wp1=pi/2;wp2=3*pi/4;
alpha2=cos((wp2+wp1)/2)/cos((wp2-wp1)/2);
k=cot((wp2-wp1)/2)*tan(thetap/2);

%% high-pass
alp1=[1 -alpha1];alp2=[-alpha1 1];
bhp=b(1)*conv(alp1,alp1)-b(2)*conv(alp1,alp2)+b(3)*conv(alp2,alp2);
ahp=a(1)*conv(alp1,alp1)-a(2)*conv(alp1,alp2)+a(3)*conv(alp2,alp2);
[Hhp,w]=freqz(bhp,ahp);

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.61

%% band-pass
bb=2*alpha2/(k+1)
cc=(k-1)/(k+1)
alp1=[-1 bb -cc];alp2=[cc -bb 1];
bbp=b(1)*conv(alp1,alp1)+b(2)*conv(alp1,alp2)+b(3)*conv(alp2,alp2);
abp=a(1)*conv(alp1,alp1)+a(2)*conv(alp1,alp2)+a(3)*conv(alp2,alp2);
[Hbp,w]=freqz(bbp,abp);

figure(1)
subplot(311)
plot(w/pi,abs(H))
ylabel(’|H(eˆ{j\omega})|’)
subplot(312)
plot(w/pi,abs(Hhp))
ylabel(’|H_{hp}(eˆ{j\omega})|’)
subplot(313)
plot(w/pi,abs(Hbp))
ylabel(’|H_{bp}(eˆ{j\omega})|’)
xlabel(’\omega/\pi’)

1
|H(ejω)|

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1
|Hhp(ejω)|

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1
|Hbp(ejω)|

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ω/π

Figure 12.24: Problem 38: Magnitude responses of low–, high– and band–pass filters.

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.62

12.39 (a) The impulse response h1 [n] is the up-sampled version of h[n] and given as

h[n/2] n = 0, 2, 4, · · ·
h1 [n] =
0 otherwise

so that H1 (z) = H(z 2 ). If we let H(z) be a prototype low-pass filter, H1 (z) is a band-eliminating
filter.
(b) Using the modulation property we have

h1 [n] ⇔ H1 (z)
h2 [n] = 2h1 [n] cos(πn/2) ⇔ H2 (z) = H1 (ejπ/2 z) + H1 (e−jπ/2 z)

giving a band-pass filter centered around π/2. If z0 = r0 ejω0 is a pole/zero of H1 (z) then changing
z0 → ejπ/2 z0 gives that r0 ejω0 +π/2 is the location of a pole/zero of H2 (z), i.e., there is a rotation of
π/2. There is also a rotation of −π/2, to thus double the order of the filter.
(c) The parallel connection has a transfer function G(z) = H1 (z) + H2 (z). The numerator and denom-
inator coefficients of G(z) are found using the conv function.
Solution

%% Pr 12_39
clear all; clf
[b,a]=butter(2,0.5); % prototype lpf
[H,w]=freqz(b,a);
% upsampled filter
a1=[a(1) 0 a(2) 0 a(3)];b1=[b(1) 0 b(2) 0 b(3)];
[H1,w]=freqz(b1,a1);
% bandpass filter transformation
br=roots(b1);
cr1=br*exp(j*pi/2);
cr2=br*exp(-j*pi/2);
C=poly([cr1;cr2]);
ar=roots(a1);
dr1=ar*exp(j*pi/2);
dr2=ar*exp(-j*pi/2);
D=poly([dr1;dr2]);
[H2,w]=freqz(C,D); % bandpass
C=C/max(abs(H2));
[H2,w]=freqz(C,D); % unit gain in passband
% parallel connection
gnum=conv(C,a1)+conv(D,b1)
gden=conv(D,a1)
[G,w]=freqz(gnum,gden);
figure(1)
subplot(221)
zplane(b,a)
subplot(222)
zplane(b1,a1)
subplot(223)
zplane(C,D)
subplot(224)
zplane(gnum,gden)
figure(2)

Copyright 2014, Elsevier, Inc. All rights reserved.


Chaparro — Signals and Systems using MATLAB 12.63

subplot(221)
plot(w/pi,abs(H));axis([ 0 1 0 1.2]); ylabel(’|H|’)
subplot(222)
plot(w/pi,abs(H1));axis([ 0 1 0 1.2])
hold on
plot(w/pi,abs(H2),’r’);axis([ 0 1 0 1.2])
legend(’|H_1|’,’|H_2|’)
hold off
ylabel(’|H_1|, |H_2|’);xlabel(’\omega/\pi’)
subplot(223)
plot(w/pi,abs(G));axis([ 0 1 0 1.2]);; ylabel(’|G|’)
xlabel(’\omega/\pi’)

The numerator and denominator coefficients of H(z), H1 (z), the bandpass filter H2 (z) and G(z) are

b = 0.2929 0.5858 0.2929


a =1.0000 -0.0000 0.1716
a1 = 1.0000 0 -0.0000 0 0.1716
b1 = 0.2929 0 0.5858 0 0.2929
C = 0.0858 0 -0.3431 0 0.5147 0 -0.3431 0 0.0858
D = 1.0000 0 -0.0000 0 0.3431 0 -0.0000 0.0000 0.0294
gnum = 0.3787 0 0.2426 0 0.9228 0 -0.2010 0.0000
0.2832 0.0000 -0.0416 0.0000 0.0233
gden = 1.0000 0 -0.0000 0 0.5147 0 -0.0000 0.0000
0.0883 -0.0000 -0.0000 0.0000 0.0051

1 1 2
|H1|
1 1
0.5 0.5 |H2|
Imaginary Part

Imaginary Part

0.8 |H1|, |H2| 0.8


2
|H|

0 0 0.6 0.6

0.4 0.4
−0.5 −0.5
0.2 0.2
−1 −1 2
0 0
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Real Part Real Part ω/π

1 1
1
0.5 2 2 0.5 3 3
Imaginary Part

Imaginary Part

0.8
4 4
|G|

0 0 0.6

2 2 3 3 0.4
−0.5 −0.5
0.2
−1 −1
0
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1
Real Part Real Part ω/π

Figure 12.25: Problem 39: Left (clockwise from top left) Poles/zeros of lowpass, notch, bandpass and paral-
lel; right: corresponding magnitude responses.

Copyright 2014, Elsevier, Inc. All rights reserved.

You might also like