100% found this document useful (1 vote)
262 views

Signals and Systems Using MATLAB, Third Edition Solution Manuel

Uploaded by

Bunyamin Ustali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
262 views

Signals and Systems Using MATLAB, Third Edition Solution Manuel

Uploaded by

Bunyamin Ustali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

Solution Manual for

SIGNALS AND SYSTEMS


USING MATLAB

Luis F. Chaparro and Aydin Akan


Copyright 2018, Elsevier, Inc. All rights reserved.
Chaparro-Akan — Signals and Systems using MATLAB 0.2

Copyright 2018, Elsevier, Inc. All rights reserved.


Chapter 0

From the Ground Up

1
Chaparro-Akan — Signals and Systems using MATLAB 0.2

0.1 Basic Problems


0.1 Let z = 8 + j3 and v = 9 − j2,
(a) Find

(i) Re(z) + Im(v), (ii) |z + v|, (iii) |zv|, (iv) ∠z + ∠v, (v) |v/z|, (vi) ∠(v/z)

(b) Find the trigonometric and polar forms of

(i) z + v, (ii) zv, (iii) z ∗ (iv) zz ∗ , (v) z − v


√ √
Answers: (a) Re(z) + Im(v) = 6; |v/z| = 85/ 73; (b) zz ∗ = |z|2 = 73.
Solution
(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)

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.3

0.2 Use Euler’s identity to


(a) show that

(i) cos(θ − π/2) = sin(θ), (ii) − sin(θ − π/2) = cos(θ), (iii) cos(θ) = sin(θ + π/2).

(b) to find
Z 1 Z 1
(i) cos(2πt) sin(2πt)dt, (ii) cos2 (2πt)dt.
0 0

Answers: (b) 0 and 1/2.

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.4

0.3 Use Euler’s identity to


(a) show the identities

(i) cos(α + β) = cos(α) cos(β) − sin(α) sin(β)


(ii) sin(α + β) = sin(α) cos(β) + cos(α) sin(β),

(b) find an expression for cos(α) cos(β), and for sin(α) sin(β).
Answers: ejα ejβ = cos(α + β) + j sin(α + β) = [cos(α) cos(β) − sin(α) sin(β)] + j[sin(α) cos(β) +
cos(α) sin(β)].

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.5

0.4 Consider the calculation of roots of an equation z N = α where N ≥ 1 is an integer and α =


|α|ejφ a nonzero complex number.
(a) First verify that there are exactly N roots for this equation and that they are given by
zk = rejθk where r = |α|1/N and θk = (φ + 2πk)/N for k = 0, 1, · · · , N − 1.
(b) Use the above result to find the roots of the following equations

(i) z 2 = 1, (ii) z 2 = −1, (iii) z 3 = 1, (iv) z 3 = −1.

and plot them in a polar plane (i..e., indicating their magnitude and phase). Explain how
the roots are distributed in the polar plane.

Answers: Roots of z 3 = −1 = 1ejπ are zk = 1ej(π+2πk)/3 , k = 0, 1, 2, equally spaced around


circle of radius r.

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.6

0.5 Consider a function of z = 1 + j1, w = ez


(a) Find (i) log(w), (ii) Re(w), (iii) Im(w)
(b) What is w + w∗ , where w∗ is the complex conjugate of w?
(c) Determine |w|, ∠w and | log(w)|2 ?
(d) Express cos(1) in terms of w using Euler’s identity.
Answers: log(w) = z; w + w∗ = 2Re[w] = 2e cos(1).

Solution
(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
 
w w∗
cos(1) = 0.5(ej + e−j ) = 0.5 +
e e

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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.7

0.6 A phasor can be thought of as a vector, representing a complex number, rotating around the
polar plane at a certain frequency in radians/second. The projection of such a vector onto
the real axis gives a cosine with a certain amplitude and phase. This problem will show the
algebra of phasors which would help you with some of the trigonometric identities that are
hard to remember.
(a) When you plot y(t) = A sin(Ω0 t) you notice that it is a cosine x(t) = A cos(Ω0 t) shifted in
time, i.e.,
y(t) = A sin(Ω0 t) = A cos(Ω0 (t − ∆t )) = x(t − ∆t )
how much is this shift ∆t ? Better yet, what is ∆θ = Ω0 ∆t or the shift in phase? One
thus only need to consider cosine functions with different phase shifts instead of sines
and cosines.
(b) From above, the phasor that generates x(t) = A cos(Ω0 t) is Aej0 so that x(t) = Re[Aej0 ejΩ0 t ].
The phasor corresponding to the sine y(t) should then be Ae−jπ/2 . Obtain an expression
for y(t) similar to the one for x(t) in terms of this phasor.
(c) From the above results, give the phasors corresponding to −x(t) = −A cos(Ω0 t) and
−y(t) = − sin(Ω0 t). Plot the phasors that generate cos, sin, − cos and − sin for a given
frequency. Do you see now how these functions are connected? How many radians do
you need to shift in positive or negative direction to get a sine from a cosine, etc.
(d) Suppose then you have the sum of two sinusoids, for instance z(t) = x(t) + y(t) =
A cos(Ω0 t) + A sin(Ω0 t), adding the corresponding phasors for x(t) and y(t) at some time,
e.g., t = 0, which is just a sum of two vectors, you should get a vector and the correspond-
ing phasor. For x(t), y(t), obtain their corresponding phasors and then obtain from them
the phasor corresponding to z(t) = x(t) + y(t).
(e) Find the phasors corresponding to
(i) 4 cos(2t + π/3), (ii) − 4 sin(2t + π/3), (iii) 4 cos(2t + π/3) − 4 sin(2t + π/3)

Answers: sin(Ω0 t) = cos(Ω √ 0 (t−T0 /4)) = cos(Ω0 t−π/2) since Ω0 = 2π/T0 ; z(t) = 2A cos(Ω0 t−
π/4); (e) (i) 4ejπ/3 ; (iii) 4 2ej7π/12 .

Solution
(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 magni-
tude and angle of this cosine gives the magnitude and phase of the phasor that generates
the given sinusoid.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.8

(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 A sin(Ω0 t), which gives 2Ae−jπ/4 (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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.9

0.7 To get an idea of the number of bits generated and processed by a digital system consider the
following applications:
(a) A compact disc (CD) is capable of storing 75 minutes of “CD quality” stereo (left and right
channels are recorded) music. Calculate the number of bits that are stored in the CD as
raw data.
Hint: find out what ’CD quality’ means in the binary representation of each sample.
(b) Find out what the vocoder in your cell phone is used for. To attaining “telephone quality”
voice you use a sampling rate of 10, 000 samples/sec, and that each sample is represented
by 8 bits. Calculate the number of bits that your cell-phone has to process every second
that you talk. Why would you then need a vocoder?
(c) Find out whether text messaging is cheaper or more expensive than voice. Explain how
the text messaging works.
(d) Find out how an audio CD and an audio DVD compare. Find out why it is said that a vinyl
long-play record reproduces sounds much better. Are we going backwards with digital
technology in music recording? Explain.
(e) To understand why video streaming in the internet is many times of low quality, consider
the amount of data that needs to be processed by a video compressor every second. As-
sume the size of a video frame, in pixels, is 352 × 240, and that an acceptable quality for
the image is obtained by allocating 8 bits/pixel and to avoid jerking effects we use 60
frames/second.
• How many pixels need to be processed every second?
• How many bits would be available for transmission every second?
• The above is raw data, compression changes the whole picture (literally), find out
what some of the compression methods are.
Answers: (a) About 6.4 Gbs; vocoder (short for voice encoder) reduces number of transmitted
bits while keeping voice recognizable.

Solution
(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 sec-
onds/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 proce-
dures to reduce the number of bits that are transmitted while still keeping your voice recogniz-
able. 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.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.10

(d) For CD audio the sampling rate is 44.1 kHz with 16 bits/sample. For DVD audio the sam-
pling 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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.11

0.8 The geometric series


N
X −1
S= αn
n=0
will be used quite frequently in the next chapters so let us look at some of its properties:
(a) Suppose α = 1 what is S equal to?
(b) Suppose α 6= 1 show that
1 − αN
S=
1−α
N
Verify that (1 − α)S = (1 − α ). Why do you need the constraint that α =
6 1? Would this
sum exist if α > 1? Explain.
(c) Suppose now that N = ∞, under what conditions will S exist? if it does, what would S
be equal to? Explain.
(d) Suppose again that N = ∞ in the definition of S. The derivative of S with respect to α is

X
dS
S1 = = nαn−1
dα n=0

obtain a rational expression to find S1 .


Answers: S = N when α = 1, S = (1 − αN )/(1 − α) when α 6= 1.

Solution
(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−α

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.12

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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.13

0.2 Problems using MATLAB


0.9 Derivative and finite difference — Let y(t) = dx(t)/dt, where x(t) = 4 cos(2πt), −∞ < t < ∞.
Find y(t) analytically and determine a value of Ts for which ∆[x(nTs )]/Ts = y(nTs ) (consider
as possible values Ts = 0.01 and Ts = 0.1). Use the MATLAB function diff or create your own
to compute the finite difference. Plot the finite difference in the range [0, 1] and compare it with
the actual derivative y(t) in that range. Explain your results for the given values of Ts .
Answers: y(t) = −8π sin(2πt) has same sampling period as x(t), Ts ≤ 0.5; Ts = 0.01 gives
better results.

Solution
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.9
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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.14

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 1: Problem 9: Ts = 0.01 sec (top) and Ts = 0.1 sec (bottom)

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.15

0.10 Backward difference — Another definition for the finite difference is the backward difference:

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

(∆1 [x(nTs )]/Ts approximates the derivative of x(t)).

(a) Indicate how this new definition connects with the finite difference defined earlier in this Chapter.
(b) Solve Problem 9 with MATLAB using this new finite difference and compare your results with the
ones obtained there.
(c) For the value of Ts = 0.1, use the average of the two finite differences to approximate the derivative
of the analog signal x(t). Compare this result with the previous ones. Provide an expression for
calculating this new finite difference directly.

Answers: ∆1 [x(n + 1)] = x(n + 1) − x(n) = ∆[x(n)]; 0.5 {∆1 [x(n)] + ∆[x(n)]} = 0.5[x(n + 1) − x(n − 1)].

Solution
(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 fol-
lowing script is used to compute ∆1 and the average.

% Pro 0.10
% 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’)

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.16

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’)

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 2: Problem 10: Comparison of different finite differences.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.17

0.11 Sums and Gauss — Three laws in the computation of sums are
P P
Distributive: k cak = c k ak

P P P
Associative: k (ak + bk ) = k ak + k bk
P P
Commutative: k ak = p(k) ap(k)

for any permutation p(k) of the set of integers k in the summation.

(a) Explain why the above rules make sense when computing sums. To do that consider

X 2
X X 2
X
ak = ak , and bk = bk .
k k=0 k k=0

Let c be a constant, and choose any permutation of the values [0, 1, 2] for instance [2, 1, 0] or [1, 0, 2].
(b) The trick that Gauss played when he was a preschooler can be explained by using the above rules.
Suppose you want to find the sum of the integers from 0 to 10, 000 (Gauss did it for integers between
0 and 100 but he was then just a little boy, and we can do better!). That is, we want to find S where
10,000
X
S= k = 0 + 1 + 2 + · · · + 10000
k=0

to do so consider
10,000 0
X X
2S = k+ k
k=0 k=10,000

and apply the above rules to find then S. Come up with a MATLAB function of your own to do this
sum.
(c) Find the sum of an arithmetic progression
N
X
S1 = (α + βk)
k=0

for constants α and β, using the given three rules.


(d) Find out if MATLAB can do these sums symbolically, i.e., without having numerical values. Use the
found symbolic function to calculate the sum in the previous item when α = β = 1 and N = 100.

Answers: N = 10, 000, S = N (N + 1)/2; S1 = α(N + 1) + β(N (N + 1))/2.

Solution
(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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.18

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.

% Pro 0.11
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})

S = 5050

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

5151

The answers shown at the bottom.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.19

0.12 Integrals and sums — Suppose you wish to find the area under a signal x(t) using sums. You will need
the following result found above
N
X N (N + 1)
n=
n=0
2

(a) Consider first x(t) = t, 0 ≤ t ≤ 1, and zero otherwise. The area under this signal is 0.5. The integral
can be approximated from above and below as
N
X −1 Z 1 N
X
(nTs )Ts < tdt < (nTs )Ts
n=1 0 n=1

where N Ts = 1 (i.e., we divide the interval [0, 1] into N intervals of width Ts ). Graphically show for
N = 4 that the above equation makes sense by showing the right and left bounds as approximations
for the area under x(t).
(b) Let Ts = 0.001, use the symbolic function symsum to compute the left and right bounds for the above
integral. Find the average of these results and compare it with the actual value of the integral.
(c) Verify the symbolic results by finding the sums on the left and the right of the above inequality using
the summation given at the beginning of the problem. What happens when N → ∞.
(d) Write a MATLAB script to compute the area under the signal y(t) = t2 from 0 ≤ t ≤ 1. Let
Ts = 0.001. Compare the average of the lower and upper bounds to the value of the integral.

Answer: For Ts = 1/N


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

Solution
(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 3: Problem 12: 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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.20

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.12
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)
% 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)

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.21

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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.22

0.13 Exponentials — The exponential x(t) = eat for t ≥ 0 and zero otherwise is a very common continuous-
time signal. Likewise, y(n) = αn for integers n ≥ 0 and zero otherwise is a very common discrete-time
signal. Let us see how they are related. Do the following using MATLAB:

(a) Let a = −0.5, plot x(t)


(b) Let a = −1, plot the corresponding signal x(t). Does this signal go to zero faster than the exponential
for a = −0.5?
(c) Suppose we sample the signal x(t) using Ts = 1 what would be x(nTs ) and how can it be related to
y(n), i.e., what is the value of α that would make the two equal?
(d) Suppose that a current x(t) = e−0.5t for t ≥ 0 and zero otherwise is applied to a discharged capacitor
of capacitance C = 1 F at t = 0. What would be the voltage in the capacitor at t = 1 second?
(e) How would you obtain an approximate result to the above problem using a computer? Explain.

Answers: 0 < e−αt < e−βt for α > β ≥ 0; vc (1) = 0.79.

Solution
(a)(b) We have that
0 < e−αt < e−βt
for α > β ≥ 0.

% Pr. 0.13
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 4: Problem 13: 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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.23

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) = |0 = 2(1 − e−0.5t )
−0.5

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

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


N −1
X 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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.24

0.14 Algebra of complex numbers — Consider complex numbers z = 1 + j, w = −1 + j, v = −1 − j and


u = 1 − j. You may use MATLAB compass to plot vectors corresponding to complex numbers to verify
your analytic results.

(a) In the complex plane, indicate the point (x, y) that corresponds to z and then show a vector ~z that
joins the point (x, y) to the origin. What is the magnitude and the angle corresponding to z or ~z?
(b) Do the same for the complex numbers w, v and u. Plot the four complex numbers and find their
sum z + w + v + u analytically and graphically.
(c) Find the ratios z/w, w/v, and u/z. Determine the real and imaginary parts of each, as well as their
magnitudes and phases. Using the ratios find u/w.
(d) The phase of a complex number is only significant when the magnitude of the complex number is
significant. Consider z and y = 10−16 z, compare their magnitudes and phases. What would you
say about the phase of y?
√ √ √
Answers: |w| = 2, ∠w = 3π/4, |v| = 2, ∠v = 5π/4, |u| = 2, ∠u = −π/4.

Solution
(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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.25

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 5: Problem 14: Results of complex calculations in parts (a) z, w, v, u and (b)
z/w, w/v, u/z, z/w

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

The results are verified by the following script:

% Pro 0.14
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’)
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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 0.26

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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chapter 1

Continuous–time Signals

1
Chaparro-Akan — Signals and Systems using MATLAB 1.2

1.1 Basic Problems


1.1 Consider the following continuous-time signal

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

Carefully plot x(t) and then find and plot the following signals:
(a) x(t + 1), x(t − 1) and x(−t)
(b) 0.5[x(t) + x(−t)] and 0.5[x(t) − x(−t)]
(c) x(2t) and x(0.5t)
(d) y(t) = dx(t)/dt and Z t
z(t) = y(τ )/dτ
−∞

Answers: x(t + 1) is x(t) shifted left by 1; 0.5[x(t) + x(−t)] discontinuous at t = 0.

Solution
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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.3

1.2 The following problems relate to the symmetry of the signal:


(a) Consider a causal exponential x(t) = e−t u(t).
i. Plot x(t) and explain why it is called causal. Is x(t) an even or an odd signal?
ii. Is it true that 0.5e−|t| is the even component of x(t)? Explain
(b) Using Euler’s identity x(t) = ejt = cos(t) + j sin(t). Find the even xe (t) and the odd xo (t) compo-
nents of x(t).
(c) A signal x(t) is known to be even, and not exactly zero for all time, explain why
Z ∞
x(t) sin(Ω0 t)dt = 0.
−∞

(d) Is it true that Z ∞


[x(t) + x(−t)] sin(Ω0 t)dt
−∞

for any signal x(t) which is not exactly zero for all time?
Answer: (a) (ii) yes, it is true; (b) xe (t) = cos(t); (c) integrand is odd; (d) x(t) + x(−t) is even.

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.4

1.3 Do reflection and time-shifting commute? That is, do the two block diagrams in Fig. 1.2 provide identical
signals, i.e., is y(t) equal to z(t)? To provide an answer to this consider the signal x(t) shown in Fig. 1.2 is

x(t) v(t) y(t)


Reflection Delay by 2

x(t) w(t) z(t)


Delay by 2 Reflection

x(t)
1

t
1

Figure 1.2: Problem 3

the input to the two block diagrams. Find y(t) and z(t), plot them and compare these plots. What is your
conclusion? Explain.
Answers: Operations do not commute.

Solution
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.3.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.5

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.3: Problem 3: Reflection and delaying do not commute, y(t) 6= z(t).

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.6

1.4 The following problems relate to the periodicity of signals:


(a) Determine the frequency Ω0 in rad/sec, the corresponding frequency f0 in Hz, and the fundamental
period T0 sec of these signals defined in −∞ < t < ∞,

(i) cos(2πt), (ii) sin(t − π/4), (iii) tan(πt)

(b) Find the fundamental period T of z(t) = 1 + sin(t) + sin(3t), − ∞ < t < ∞.
(c) If x(t) is periodic of fundamental period T0 = 1, determine the fundamental period of the following
signals
(i) y(t) = 2 + x(t), (ii) w(t) = x(2t), (iii) v(t) = 1/x(t)
(d) What is the fundamental frequency f0 , in Hz, of

(i) x(t) = 2 cos(t), (ii) y(t) = 3 cos(2πt + π/4), (iii) c(t) = 1/ cos(t)

(e) If z(t) is periodic of fundamental period T0 , is ze (t) = 0.5[z(t)+z(−t)] also periodic? If so determine
its fundamental period T0 . What about zo (t) = 0.5[z(t) − z(−t)]?
Answers: (a) (iii) the frequency is f0 = 1/2 Hz; (b) T = 2π; (c) x(2t) has fundamental period 1/2; (d) c(t)
has f0 = 1/(2π) Hz; (e) ze (t) is periodic of fundamental period T0 .

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.7

1.5 In the following problems find the fundamental period of signals and determine periodicity.
(a) Find the fundamental period of the following signals, and verify it

(i) x(t) = cos(t + π/4), (ii) y(t) = 2 + sin(2πt), (iii) z(t) = 1 + (cos(t)/ sin(3t))

(b) The signal x1 (t) is periodic of fundamental period T0 , and the signal y1 (t) is also periodic of funda-
mental period 10T0 . Determine if the following signals are periodic, and if so give their fundamental
periods

(i) z1 (t) = x1 (t) + 2y1 (t) (ii) v1 (t) = x1 (t)/y1 (t) (iii) w1 (t) = x(t) + y1 (10t).

Answers: (a) Fundamental period of of y(t) is 1; (b) v1 (t) periodic of fundamental period 10T0 .

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.8

1.6 The following problems are about energy and power of signals.

(a) Plot the signal x(t) = e−t u(t) and determine its energy. What is the power of x(t)?
(b) How does the energy of z(t) = e−|t| , −∞ < t < ∞, compare to the energy of z1 (t) = e−t u(t)?
Carefully plot the two signals.
(c) Consider the signal

1 xi (t) ≥ 0
y(t) = sign[xi (t)] =
−1 xi (t) < 0

for −∞ < t < ∞, i = 1, 2. Find the energy an the power of y(t) when

(a) x1 (t) = cos(2πt) (b) x2 (t) = sin(2πt)

Plot y(t) in each case.


(d) Given v(t) = cos(t) + cos(2t).
i. Compute the power of v(t).
ii. Determine the power of each of the components of v(t), add them and compare the result to the
power of v(t).
(e) Find the power of s(t) = cos(2πt) and of f (t) = s(t)u(t). How do they compare?

Answer: (a) Ex = 0.5; (b) Ez = 2Ez1 ; (c) Py = 1; (d) Pv = 1.

Solution

(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 ∞
Ez = e−2|t| 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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.9

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

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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.10

1.7 Consider a circuit consisting of a sinusoidal source vs (t) = cos(t)u(t) volts. connected in series to a resistor
R and an inductor L and assume they have been connected for a very long time.
(a) Let R = 0, L = 1 H, compute the instantaneous and the average powers delivered to the inductor.
(b) Let R = 1 Ω and L = 1 H, compute the instantaneous and the average powers delivered to the
resistor and the inductor.
(c) Let R = 1 Ω and L = 0 H compute the instantaneous and the average powers delivered to the
resistor.
(d) The complex power supplied to the circuit is defined as P = 21 Vs I ∗ where Vs and I are the phasors
corresponding to the source and the current in the circuit, and I ∗ is the complex conjugate of I.
Consider the values of the resistor and the inductor given above, and compute the complex power
and relate it to the average power computed in each case.
Answers: (a) Pa = 0; (b) Pa = 0.25; (c) Pa = 0.5.

Solution
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.4: Problem 7: 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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.11

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
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 = 21 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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.12

1.8 Consider the periodic signal x(t) = cos(2Ω0 t) + 2 cos(Ω0 t), −∞ < t < ∞, and Ω0 = π. The frequencies of
the two sinusoids are said to be harmonically related.
(a) Determine the period T0 of x(t). Compute the power Px of x(t) and verify that the power Px is the
sum of the power P1 of x1 (t) = cos(2πt) and the power P2 of x2 (t) = 2 cos(πt).
(b) Suppose that y(t) = cos(t) + cos(πt), where the frequencies are not harmonically related. Find
out whether y(t) is periodic or not. Indicate how you would find the power Py of y(t). Would
Py = P1 + P2 where P1 is the power of cos(t) and P2 that of cos(πt)? Explain what is the difference
with respect to the case of harmonic frequencies.
Answers: (a) T0 = 2; Px = 2.5; (b) y(t) is not periodic, but Py = P1 + P2 .

Solution
(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
1 2 2
Z
1
Px = x2 (t)dt = [x1 (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
1 2 1 2
Z Z
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,
1 2 2
Z
Px = [x1 (t) + x22 (t)]dt
2 0
1 2 2
Z Z 1
1
= x1 (t)dt + 2 x22 (t)]dt
2 0 2 0
= Px1 + Px2
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,
1 2
Z Z 1
Px = cos2 (2πt)dt + 4 cos2 (πt)dt
2 0 0
1 2
Z Z 1
= [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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.13

1.9 A signal x(t) is defined as x(t) = r(t + 1) − r(t) − 2u(t) + u(t − 1).
(a) Plot x(t) and indicate where it has discontinuities. Compute y(t) = dx(t)/dt and plot it. How does
it indicate the discontinuities? Explain.
(b) Find the integral
Z t
y(τ )dτ
−∞

and give the values of the integral when t = −1, 0, 0.99, 1.01, 1.99 and 2.01. Is there any problem
with calculating the integral at exactly t = 1 and t = 2? Explain.
Answers: x(t) has discontinuities at t = 0 and at t = 1, indicated by delta functions in dx(t)/dt.

Solution

(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.5: Problem 9

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.14

1.10 One of the advantages of defining the δ(t) functions is that we are now able to find the derivative of
discontinuous signals. Consider a periodic sinusoid defined for all times

x(t) = cos(Ω0 t) −∞<t<∞

and a causal sinusoid defined as x1 (t) = cos(Ω0 t)u(t), where the unit-step function indicates that the
function has a discontinuity at zero, since for t = 0+ the function is close to 1 and for t = 0− the function
is zero.
(a) Find the derivative y(t) = dx(t)/dt and plot it.
(b) Find the derivative z(t) = dx1 (t)/dt (treat x1 (t) as the product of two functions cos(Ω0 t) and u(t))
and plot it. Express z(t) in terms of y(t).
Rt
(c) Verify that the integral −∞ z(τ )dτ gives back x1 (t).
Answers: (a) y(t) = −Ω0 sin(Ω0 t); (b) z(t) = y(t)u(t) + δ(t).

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.15

1.11 Let x(t) = t[u(t) − u(t − 1)], we would like to consider its expanded and compressed versions.
(a) Plot x(2t) and determine if it is a compressed or expanded version of x(t).
(b) Plot x(t/2) and determine if it is a compressed or expanded version of x(t).
(c) Suppose x(t) is an acoustic signal, e.g., a music signal recorded in a magnetic tape, what would be a
possible application of the expanding and compression operations? Explain.
Answers: (a) x(2t) = 2t[u(t) − u(t − 0.5)], compressed.

Solution
(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.6: Problem 11: 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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.16

1.12 Consider the signal x(t) in Fig. 1.7.

x(t)

t
0 1
Figure 1.7: Problem 12

(a) Plot the even-odd decomposition of x(t), i.e., find and plot the even xe (t) and the odd xo (t) compo-
nents of x(t).
(b) Show that the energy of the signal x(t) can be expressed as the sum of the energies of its even and
odd components, i.e. that
Z ∞ Z ∞ Z ∞
x2 (t)dt = x2e (t)dt + x2o (t)dt
−∞ −∞ −∞

(c) Verify that the energy of x(t) is equal to the sum of the energies of xe (t) and xo (t).
Answers: xo (t) = −0.5(1 + t)[u(t + 1) − u(t)] + 0.5(1 − t)[u(t) − u(t − 1)].

Solution
(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

(b) The energy of x(t) is


Z ∞ Z ∞
x2 (t)dt = [xe (t) + xo (t)]2 dt
−∞ −∞
Z ∞ Z ∞ Z ∞
= x2e (t)dt + x2o (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
∞ 1
t3
Z Z
1
x2 (t)dt = (1 − t)2 dt = t − t2 + 1
0 =
−∞ 0 3 3

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.17

xe (t) x0 (t)

0.5 0.5
−1

−1 1 t 1 t
−0.5

Figure 1.8: Problem 12: Even and odd decomposition of x(t).

The energy of the even component is


Z ∞ Z 0 Z 1 Z 1
x2e (t)dt = 0.25 (1 + t)2 dt + 0.25 (1 − t)2 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
x2o (t)dt = 0.25 (1 + t)2 dt + 0.25 (1 − t)2 dt = 0.5 (1 − t)2 dt
−∞ −1 0 0

so that
Ex = Exe + Exo

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.18

1.13 A periodic signal can be generated by repeating a period.

x(t)

1
··· ···
−1 0
1 1 2
t

−1

Figure 1.9: Problem 13

(a) Find the function g(t), defined in 0 ≤ t ≤ 2 only, in terms of basic signals and such that when
repeated using a period of 2 generates the periodic signal x(t) shown in Fig. 1.9.

(b) Obtain an expression for x(t) in terms of g(t) and shifted versions of it.

(c) Suppose we shift and multiply by a constant the periodic signal x(t) to get new signals y(t) =
2x(t − 2), z(t) = x(t + 2) and v(t) = 3x(t) are these signals periodic?

(d) Let then w(t) = dx(t)/dt, and plot it. Is w(t) periodic? If so, determine its period.

Answers: (a) g(t) = u(t) − 2u(t − 1) + u(t − 2); (c) Signals y(t), v(t) are periodic.

Solution
(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

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


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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.19

dx(t)
dt
2

··· ···
−1 1
t
2

−2

Figure 1.10: Problem 13: Derivative of x(t).

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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.20

1.14 For a complex exponential signal x(t) = 2ej2πt


(a) Suppose y(t) = ejπt , would the sum of these signals z(t) = x(t) + y(t) be also periodic? If so, what
is the fundamental period of z(t)?
(b) Suppose we then generate a signal v(t) = x(t)y(t), with the x(t) and y(t) signals given before, is v(t)
periodic? If so, what is its fundamental period?
Answers: (a) z(t) is periodic of period T1 = 2; (b) v(t) is periodic of period T3 = 2/3.

Solution
(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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.21

1.15 Consider the train of triangular pulses x(t) in Fig. 1.11.

x(t)

··· ···

−1 0 1 2
t

Figure 1.11: Problem 15

(a) Carefully plot the the derivative of x(t), y(t) = dx(t)/dt.


(b) Can you compute
Z ∞
z(t) = [x(t) − 0.5]dt?
−∞

If so, what is it equal to? If not, explain why not.


(c) Is x(t) a finite energy signal? how about y(t)?
P
Answers: (a) y(t) = k [u(t − k) − 2u(t − 0.5 − k) + u(t − 1 − k)]; (c) x(t), y(t) have infinite energy.

Solution
(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

dx(t) X 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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.22

1.2 Problems using MATLAB


1.16 Signal energy and RC circuit — The signal x(t) = e−|t| is defined for all values of t.
(a) Plot the signal x(t) and determine if this signal is finite energy.
(b) If you determine that x(t) is absolutely integrable, or that the following integral
Z ∞
|x(t)|dt
−∞

is finite, could you say that x(t) has finite energy? Explain why or why not. HINT: Plot |x(t)| and
|x(t)|2 as functions of time.
(c) From your results above, is it true the energy Ey of the signal

y(t) = e−t cos(2πt)u(t)

is less than half the energy of x(t)? Explain. To verify your result, use symbolic MATLAB to plot
y(t) and to compute its energy.
(d) To discharge a capacitor of 1 mF charged with a voltage of 1 volt we connect it, at time t = 0, with
a resistor of R Ω. When we measure the voltage in the resistor we find it to be vR (t) = e−t u(t).
Determine the resistance R. If the capacitor has a capacitance of 1 µF, what would be R? In general,
how are R and C related?
Answers: (a) Ex = 1; (c) Ey = Ex /2; (d) R = 1/C.

Solution
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 = x2 (t)dt = 2 e−2t dt = 2 |0 = 1
−∞ 0 −2

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


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

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 cos (2πt) ≤ 1 (the decaying sinusoid is bounded by the envelope e−2t u(t)).
2

% Pro 1.16
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);

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.23

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\pi t)|ˆ2’);xlabel(’t’)
figure(2)
ezplot((exp(-t)*cos(2*pi*t))ˆ2,[0,5]);grid
axis([0 5 0 1])
hold on
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
2 −t 2
integral of |x(t)| integral of |e cos(2πt)|
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 16: 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:

1 t
Z
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 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.24

1.17 Periodicity of sum of sinusoids —

(a) Consider the periodic signals x1 (t) = 4 cos(πt) and x2 (t) = − sin(3πt + π/2). Find the periods T1 of
x1 (t) and T2 of x2 (t) and determine if x(t) = x1 (t) + x2 (t) is periodic. If so, what is its period T0 ?

(b) Two periodic signals x1 (t) and x2 (t) have periods T1 and T2 such that their ratio T1 /T2 = 3/12 ,
determine the period of x(t) = x1 (t) + x2 (t).

(c) Determine whether x1 (t) + x2 (t), x3 (t) + x4 (t) are periodic when

• x1 (t) = 4 cos(2πt) and x2 (t) = − sin(3πt + π/2),


• x3 (t) = 4 cos(2t) and x4 (t) = − sin(3πt + π/2)

Use symbolic MATLAB to plot x1 (t) + x2 (t), x3 (t) + x4 (t) and confirm your analytic result about
their periodicity or lack of periodicity.

Answers: (b) T0 = 4T1 = T2 ; (c) x1 (t) + x2 (t) is periodic, x3 (t) + x4 (t) is non–periodic.

Solution
(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.

% Pro 1.17
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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.25

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 17: periodic x1 (t) + x2 (t) (top), non–periodic x3 (t) + x4 (t) (bottom).

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.26

1.18 Impulse signal generation — When defining the impulse or δ(t) signal the shape of the signal used to
do so is not important. Whether we use the rectangular pulse we considered in this Chapter or another
pulse, or even a signal that is not a pulse, in the limit we obtain the same impulse signal. Consider the
following cases:
(a) The triangular pulse  
1 t
Λ∆ (t) = 1− (u(t + ∆) − u(t − ∆))
∆ ∆
Carefully plot it, compute its area, and find its limit as ∆ → 0. What do you obtain in the limit?
Explain.
(b) Consider the signal
sin(πt/∆)
S∆ (t) =
πt
Use the properties of the sinc signal S(t) = sin(πt)/(πt) to express S∆ (t) in terms of S(t). Then find
its area, and the limit as ∆ → 0. Use symbolic MATLAB to show that for decreasing values of ∆ the
S∆ (t) becomes like the impulse signal.
Answers: S∆ (0) = 1/∆, S∆ (t) = 0 at t = ±k∆.

Solution
(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.18
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
−∞ −∞ π∆τ

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.27

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
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 18: approximation of δ(t) using triangular (left) or sinc (right) functions

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.28

1.19 Contraction and expansion and periodicity — Consider the periodic signal x(t) = cos(πt) of fundamen-
tal period T0 = 2 sec.
(a) Is the expanded signal x(t/2) periodic? if periodic indicate its period.
(b) Is the compressed signal x(2t) periodic? if periodic indicate its period.
(c) Use MATLAB to plot the above two signals and verify your analytic results.
Answers: (a) x(t/2) is periodic of fundamentsl period 4.

Solution
(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.19 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(1)
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.15: Problem 19: expanded and compressed sinusoids vs original sinusoid.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.29

1.20 Full-wave rectified signal — Consider the full-wave rectified signal

y(t) = | sin(πt)| − ∞ < t < ∞.

(a) As a periodic signal y(t) does not have finite energy, but it has a finite power Py . Find it.
(b) It is always useful to get a quick estimate of the power of a periodic signal by finding a bound for
the signal squared. Find a bound for |y(t)|2 and show that Py < 1.
(c) Use symbolic MATLAB to check if the full-wave rectified signal has finite power and if that value
coincides with the Py you found above. Plot the signal and provide the script for the computation
of the power. How does it coincide with the analytical result?
Answers: (a) Py = 0.5

Solution
(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
h i
= 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
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.16: Problem 20: magnitude squared signal used to compute power.

% Pro 1.20, part (c)


clear all;clf
syms x t

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.30

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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.31

1.21 Shifting and scaling a discretized analog signal— The discretized approximation of a pulse is given by

 1 −N/4 ≤ n ≤ −1
w(nT s) = −1 1 ≤ n ≤ (N/4) + 1
0 otherwise

where N = 10000 and Ts = 0.001 seconds.


(a) Obtain this signal and let the plotted signal using plot be the analog signal. Determine the duration
of the analog signal.
(b) There are two possible ways to visualize the shifting of an analog signal. Since when advancing or
delaying a signal the values of the signal remain the same, it is only the time values that change we
could visualize a shift by changing the time scale to be a shifted version of the original scale. Using
this approach plot the shifted signal w(t − 2).
(c) The other way to visualize the time shifting is to obtain the values of the shifted signal and plot it
against the original time support. This way we could continue processing the signal while with the
previous approach we can only visualize it. Using this approach obtain w(t − 2) and then plot it.
(d) Obtain the scaled and shifted approximations to w(1.5t) and w(1.5t−2) using our function scale shift
and comment on your results.
Answers: The duration of the pulse is 5.001 sec.

Solution
The duration of the pulse is

(N/4 + 1 + N/4)Ts = (N/2 + 1)Ts = 5.001sec.

The following script is used to find the shifted signal by the two approaches.

% Pro 1.21
clear all; clf
Ts=0.001; T=5;N=2*T/Ts; t=-T:Ts:T;
w= [zeros(1,N/4) ones(1,N/4) -ones(1,N/4+1) zeros(1,N/4)];
delay=2;M=delay/Ts;
figure(1)
subplot(131)
plot(t,w); axis([-2*T 2*T 1.1*min(w) 1.1*max(w)]);grid
xlabel(’t’);ylabel(’w(t)’)
% part b
t2=t+delay;
subplot(132)
plot(t2,w); axis([-2*T 2*T 1.1*min(w) 1.1*max(w)]);grid
xlabel(’t’);ylabel(’w(t-2)’)
% part c
w2=[zeros(1,M) w(1:length(w)-M)];
subplot(133)
plot(t,w2,’r’);axis([-2*T 2*T 1.1*min(w) 1.1*max(w)]);grid
xlabel(’t’);ylabel(’w(t-2)’)
% scaling and shifting
% scaling and shifting of window
[w1,t2,t3]=scale_shift(w,1.5,delay,T,Ts);
figure(2)
subplot(131)
plot(t,w); axis([-2*T 2*T 1.1*min(w) 1.1*max(w)]);grid

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.32

xlabel(’t’);ylabel(’w(t)’)
subplot(132)
plot(t2,w1);axis([-2*T 2*T 1.1*min(w1) 1.1*max(w1)]);grid
xlabel(’t’);ylabel(’w(1.5t)’)
subplot(133)
plot(t3,w1); axis([-2*T 2*T 1.1*min(w1) 1.1*max(w1)]);grid
xlabel(’t’);ylabel(’w(1.5t-2)’)
%%%%%
function [z3,t1,t2]=scale_shift (z,gamma,delay,T,Ts)
% perfoms scale and shift of digitized signal
% gamma positive real with two decimal
% shf positive real
% [-T T] range of signal
% Ts sampling period
beta1=100;alpha1=round(gamma,2)*beta1;
g=gcd(beta1,alpha1);beta=beta1/g;alpha=alpha1/g;
z1=interp(z,beta);z2=decimate(z1,alpha);
t1=-T/gamma:Ts:T/gamma;
M=length(t1);
z3=z2(1:M);
t2=t1+delay;

1 1 1 1
1 1
0.8 0.8 0.8 0.8

0.6 0.6 0.6 0.6

0.5 0.5
0.4 0.4 0.4 0.4

0.2 0.2 0.2 0.2

w(1.5t-2)
w(1.5t)
w(t-2)

w(t-2)
w(t)

w(t)

0 0 0 0 0 0

-0.2 -0.2 -0.2 -0.2

-0.4 -0.4 -0.4 -0.4


-0.5 -0.5

-0.6 -0.6 -0.6 -0.6

-0.8 -0.8 -0.8 -0.8


-1 -1
-1 -1 -1 -1

-10 0 10 -10 0 10 -10 0 10 -10 0 10 -10 0 10 -10 0 10


t t t t t t

Figure 1.17: Problem 21: Shifting and scaling of a pulse.

The sharp values at the edges of the pulse are due to the discontinuities in the pulse.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.33

1.22 Windowing, scaling and shifting a discretized analog signal— We wish to obtain a discrete approxi-
mation to a sinusoid x(t) = sin(3πt) from 0 to 2.5 seconds. To do so a discretized signal x(nTs ), with
Ts = 0.001, is multiplied it by a causal window w(nTs ) of duration 2.5, i.e., w(nTs ) = 1 for 0 ≤ n ≤ 2500
and zero otherwise. Use our scale shift function to find x(2t) and x(2t − 5) for −1 ≤ t ≤ 10 and plot them.
Solution
The following script is used to find the scaled and shifted versions of a windowed signal.
% Pro 1.22
clear all; clf
Ts=0.001; T=5; N=2*T/Ts; t=-T:Ts:T;
w0=[zeros(1,N/2) ones(1,N/4+1) zeros(1,N/4)];
delay=2; M=delay/Ts;
% scaling and shifting of windowed signal x
[w1,t2,t3]=scale_shift(w0,1,delay,T,Ts);
x=sin(3*pi*t).*w1;
gamma=2; shf=5;
[z,t2,t3]=scale_shift (x,gamma,shf,T,Ts);
figure(1)
subplot(311)
plot(t,x); axis([-1 2*T 1.1*min(x) 1.1*max(x)]);grid
xlabel(’t’);ylabel(’x(t)’)
subplot(312)
plot(t2,z)
axis([-1 2*T 1.1*min(z) 1.1*max(z)]);grid
xlabel(’t’);ylabel(’x(2t)’)
subplot(313)
plot(t3,z); axis([-1 2*T 1.1*min(z) 1.1*max(z)]);grid
xlabel(’t’);ylabel(’x(2t-5)’)

1
x(t)

-1
-1 0 1 2 3 4 5 6 7 8 9 10
t
1
x(2t)

-1
-1 0 1 2 3 4 5 6 7 8 9 10
t
1
x(2t-5)

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

Figure 1.18: Problem 22: Windowing, scaling and shifting of a sinusoid.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.34

1.23 Multipath effects — In wireless communications, the effects of multi-path significantly affect the quality
of the received signal. Due to the presence of buildings, cars, etc. between the transmitter and the receiver
the sent signal does not typically go from the transmitter to the receiver in a straight path (called line of
sight). Several copies of the signal, shifted in time and frequency as well as attenuated, are received—i.e.,
the transmission is done over multiple paths each attenuating and shifting the sent signal. The sum of
these versions of the signal appears quite different from the original signal given that constructive as well
as destructive effects may occur. In this problem we consider the time shift of an actual signal to illustrate
the effects of attenuation and time-shift. In the next problem we consider the effects of time and frequency
shifting, and attenuation.

Assume that the MATLAB handel.mat signal is an analog signal x(t) that it is transmitted over three paths,
so that the received signal is

y(t) = x(t) + 0.8x(t − τ ) + 0.5x(t − 2τ )

and let τ = 0.5 seconds. Determine the number of samples corresponding to a delay of τ seconds by using
the sampling rate Fs (samples per second) given when the file handel is loaded.

To simplify matters just work with a signal of duration 1 second; that is, generate a signal from handel with
the appropriate number of samples. Plot the segment of the original handel signal x(t) and the signal y(t)
to see the effect of multi-path. Use the MATLAB function sound to listen to the original and the received
signals.

Solution
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

% Pro 1.23
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)

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.35

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.19: Problem 23: original ’handel’ signal (top); two-path affected signal (bottom).

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.36

1.24 Multipath effects, Part 2 — Consider now the Doppler effect in wireless communications. The difference
in velocity between the transmitter and the receiver causes a shift in frequency in the signal, which is
called the Doppler effect. Just like the acoustic effect of a train whistle as the train goes by. To illustrate
the frequency-shift effect, consider a complex exponential x(t) = ejΩ0 t , assume two paths one which does
not change the signal while the other causes the frequency-shift and attenuation, resulting in the signal
h i
y(t) = ejΩ0 t + αejΩ0 t ejφt = ejΩ0 t 1 + αejφt

where α is the attenuation and φ is the Doppler frequency shift which is typically much smaller than the
signal frequency. Let Ω0 = π, φ = π/100, and α = 0.7. This is analogous to the case where the received
signal is the sum of the line of sight signal and an attenuated signal affected by Doppler.
(a) Consider the term αejφt a phasor with frequency φ = π/100 to which we add 1. Use the MATLAB
plotting function compass to plot the addition 1 + 0.7ejφt for times from 0 to 256 sec changing in
increments of T = 0.5 sec.
(b) If we write y(t) = A(t)ej(Ω0 t+θ(t)) give analytical expressions for A(t) and θ(t), and compute and
plot them using MATLAB for the times indicated above.
(c) Compute the real part of the signal

y1 (t) = x(t) + 0.7x(t − 100)ejφ(t−100)

i.e., the effects of time and frequency delays, put together with attenuation, for the times indicated
in part (a). Use the function sound (let Fs = 2000 in this function) to listen to the different signals.
Answers: A(t) = 1.49 + 1.4 cos(φt), θ(t) = tan−1 (0.7 sin(φt)/(1 + 0.7 cos(φt))).
p

Solution
(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  
0.7 sin(φt)
θ(t) = tan−1
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.

% Pro 1.24
clear all; clf
% part (a)
t1=0;T=0.5; m=1;
figure(1)
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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.37

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(2)
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)]);
t1=0:T:(length(y1)-1)*T;
figure(3)
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.20: Problem 24: phasor plot (top–left); magnitude and phase of 1 + ejφt (top–right); result-
ing signal due to multipath (bottom).

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.38

1.25 Beating or pulsation — An interesting phenomenon in the generation of musical sounds is beating or
pulsation. Suppose N P different players try to play a pure tone, a sinusoid of frequency 160 Hz, and that
the signal recorded is the sum of these sinusoids. Assume the N P players while trying to play the pure
tone end up playing tones separated by ∆ Hz, so that the recorded signal is
NP
X
y(t) = 10 cos(2πfi t)
i=1

where the fi are frequencies from 159 to 161 separated by ∆ Hz. Each player playing a different frequency.
(a) Generate the signal y(t) 0 ≤ t ≤ 200 (sec) in MATLAB. Let each musician play a unique frequency.
Consider an increasing number of players, letting N P to go from 51 players, with ∆ = 0.04 Hz, to
101 players with ∆ = 0.02 Hz. Plot y(t) for each of the different number of players.
(b) Explain how this is related with multi-path and the Doppler effect discussed in the previous prob-
lems.
Solution
(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).
% Pro 1.25
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.21: Problem 25: pulsation effect when N P = 101 and ∆ = 0.02 Hz.

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.39

1.26 Chirps — Pure tones or sinusoids are not very interesting to listen to. Modulation and other techniques
are used to generate more interesting sounds. Chirps, which are sinusoids with time-varying frequency,
are some of those more interesting sounds. For instance, the following is a chirp signal

y(t) = A cos(Ωc t + s(t))

(a) Let A = 1, Ωc = 2, and s(t) = t2 /4. Use MATLAB to plot this signal for 0 ≤ t ≤ 40 sec in steps of
0.05 sec. Use sound to listen to the signal.
(b) Let A = 1, Ωc = 2, and s(t) = −2 sin(t) use MATLAB to plot this signal for 0 ≤ t ≤ 40 sec in steps
of 0.05 sec. Use sound to listen to the signal.
(c) What the frequency of these chirps are is not clear. The instantaneous frequency IF (t) is the deriva-
tive with respect to t of the argument of the cosine. For instance for a cosine cos(Ω0 t) the IF (t) =
dΩ0 t/dt = Ω0 , so that the instantaneous frequency coincides with the conventional frequency. De-
termine the instantaneous frequencies of the two chirps and plot them. Do they make sense as
frequencies? Explain.
Solution

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

% Pro 1.26
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

Copyright 2018, Elsevier, Inc. All rights reserved.


Chaparro-Akan — Signals and Systems using MATLAB 1.40

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.22: Problem 26: linear and sinusoidal chirps (left) and their corresponding instantaneous
frequencies (right).

Copyright 2018, Elsevier, Inc. All rights reserved.

You might also like