Solution Manual For Signals and Systems Using Matlab Luis F. Chaparro
Solution Manual For Signals and Systems Using Matlab Luis F. Chaparro
Solution Manual For Signals and Systems Using Matlab Luis F. Chaparro
Luis F. Chaparro
Copyright 2014, Elsevier, Inc. All rights reserved.
Chapter 0
1
Chaparro — Signals and Systems using MATLAB 0.2
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
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.
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.
while
so that equating the real and imaginary parts of the above two equations we get the desired trigonometric
identities.
(b) We have
Now,
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.
(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
0.10 (a) Shifting to the right a cosine by a fourth of its period we get a sinusoid, thus
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)
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.
S(1 − α) = S − αS
= (1 + α + · · · + αN −1 ) − (α + α2 + · · · + αN −1 + αN )
= 1 − αN
(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
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
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).
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.
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)
is connected with the forward finite difference ∆[x(n)] given in the chapter as follows
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’)
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
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 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
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
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
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
% 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})
S = 5050
5151
0.18 (a) The following figure shows the upper and lower bounds when approximating the integral of t:
1 x(t) = t
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.
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)
% upper bound
z=simple(symsum(k*Tˆ2,1,n));
zz=subs(z)
% average
int= 0.5*(yy+zz)
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:
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
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
% 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’)
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.
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
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
Int = 0.7867
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
% 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’)
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
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
% 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
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.
−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.
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.
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
2000
1000
−1000
−2000
−10 −8 −6 −4 −2 0 2 4 6 8 10
θ
% 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
Continuous–time Signals
t t t
1 −1 1 2
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
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,
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
y(t)
−1 1 t
Figure 1.3: Problem 2: Triangular signal y(t) with discontinuity at the origin.
(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.
1.4 The signal x(t) = t[u(t) − u(t − 1)] so that its reflection is
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).
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
(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.
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
x1 (t + 10T0 ) x1 (t)
v1 (t + 10T0 ) = =
y1 (t + 10T0 ) y1 (t)
(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
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
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
1
I= = −j = 1e−jπ/2
j
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
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
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
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.
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
(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
x(t)
t
−2 2
y(t)
1
(2)
t
−2 2
−1 (−2)
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
x(t)
1
1
t
−1
−1
y(t)
1
(1)
t
−1 1
(−2)
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)
or cos(Ω0 t)u(t).
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
(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.
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
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
1.17 (a) The function g(t) corresponding to the first period of x(t) is given by
(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
T3 = 2π/Ω3 = 2/3
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
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
ezplot((exp(-t))ˆ2,[0,5])
axis([0 5 0 1]);title(’envelope of |y(t)|ˆ2’)
hold off
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Ω.
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).
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
% 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
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
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).
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’
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.
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.
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
0.8
0.6
0.4
0.2
Figure 1.17: Problem 25: magnitude squared signal used to compute power.
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).
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)]);
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
Figure 1.19: Problem 27: phasor plot (top–left); magnitude and phase of 1 + ejφt (top–right); resulting signal
due to multipath (bottom).
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’)
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.
% 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
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).
Continuous–time Systems
800 x(t)
y(t)
600
400
200
−200
−400
−600
−800
−1000
−2 −1 0 1 2 3 4
t
1
Chaparro — Signals and Systems using MATLAB 2.2
x1 (t) y1 (t)
3
2 2
(1)
t t
1
x2 (t) y2 (t)
4
(2) 2 2
t t
1
(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
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 τ .
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)
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
i(t) R = 1/2
+
x(t) +
_ C = 1F y(t)
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)]
which is not
i1 (t − 0.25) = 2π cos(2πt)[1 + sin(2πt)]
so the system is time varying.
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
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
which starts at zero, grows to a maximum of 1 − e−1 at t = 1 and goes down to zero as 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
2.10 The input to all the systems is x(t) = cos(t), −∞ < t < ∞
(a) The system is non-linear, as the output
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
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
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.
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
(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
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
ds(t)
= δ(t) − e−t δ(t) + e−t u(t)
dt
= e−t u(t) = h(t)
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
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
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
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
(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
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
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
f (t)h
= lim = f (t)
h→0 h
(c) Multiplying the two terms of the ordinary differential equation by eat we get
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
graphically. So that
∞
X
y1 (t) = z(t − 2k) = r(t) − 2r(t − 1) + r(t − 2)
k=0
dy1 (t)
y2 (t) = = u(t) − 2u(t − 1) + u(t − 2) = h1 (t)
dt
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)
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
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
(b) When N = 1, τ = 1 and α = 0.1 the input/output equation for the echo system is
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.,
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
β1 β2 βM
z(t)
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.
%% 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
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
Figure 2.12: Problem 23: input x(t) and output y(t) of the zener diode.
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
(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
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
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.
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
%% 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.
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.
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.
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)])
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)
1
Chaparro — Signals and Systems using MATLAB 3.2
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.
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
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
then
e−s s 2πe−s
V (s) = + 2 , ROC: σ > 0
s + 4 s + 4π 2
2
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
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)
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.
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)
d2 x(t)
= δ(t) − 2δ(t − 1) + 2δ(t − 3) − δ(t − 4)
dt2
(b) The Laplace transform of the second derivative is
(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
3.10 (a) Considering zero initial conditions the Laplace transform of the ordinary differential equation is
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
−∞
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.
(s − 1)X(s)
(s + 2)2 + 1
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
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
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
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
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.
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
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.
Input Output
δ(t) = du(t)/dt h(t) = ds(t)/dt
Rt Rt
r(t) = −∞ u(t0 )dt0 ρ(t) = −∞ s(t0 )dt0
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
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
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)
(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
y(t) T =1
1 ···
t
1
y(t) T =2
1
···
t
2 4
cosh(s) − 1
=
s2 sinh(s)
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
dz(t)
x(t) = = −1(u(t) − u(t − 1)) + (1 − t)(δ(t) − δ(t − 1))
dt
= δ(t) − (u(t) − 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
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
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
(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
(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
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 .
(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
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
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.
Z 0 Z T
1 1
y(t) = − x(t − σ)dσ = x(t − σ)dσ
T T T 0
1
h(t) = [u(t) − u(t − T )]
T
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
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
h(t − τ ) 1 x(τ )
t−1 t 2 τ
y(t)
t
1 2 3
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.
Y (s)
G(s) =
C(s)
Y (s) = H(s)(C(s) − Y (s))
H(s)
G(s) =
1 + H(s)
Y (s)
G1 (s) =
C(s)
Y (s) = H(s)(C(s) + Y (s))
H(s)
G1 (s) =
1 − H(s)
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.
s+1 −(s − 1) −1
G(s) = H(s)Hap (s) = =
(s − 1)(s2 + 2s + 1) s + 1 (s + 1)2
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
% 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
−0.5
−1
−1.5
−2
−2.5
0 1 2 3 4 5 6 7 8 9 10
t
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
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
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.
ezplot(x,[0,5])
axis([0 5 -0.6 0.6])
grid
x = exp(-t)*sinh(t)-heaviside(t-1)*exp(-2*t+2)
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
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
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)
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)’)
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.
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
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
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)))
subplot(122)
ezplot(h,[0,8])
axis([0 8 -0.2 0.4])
grid
r = 0 - 0.3536i
0 + 0.3536i
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
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
−(s + 2) a + b(s + 1)
=
(s + 1)2 (s + 1)2
(s + 1) 1
Yzi (s) = =
(s + 1)2 s+1
so that
yzi (t) = e−t u(t)
(c) The complete response is then
(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;
%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;
0.8 0.8
1 1
0.6 0.6
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 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.
%% 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
(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).
0.4
1
0.2 0.15 0.15
0 0
jΩ
jΩ
−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.
1 − e−2s
Y (s) = 0.5 = Y1 (s) − Y1 (s)e−2s
s2 + π 2
0.5
y(t) = (sin(πt)u(t) − sin(π(t − 2)u(t − 2))
π
%% 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).
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
% 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
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).
1 0.5s
X(s) = (e − e−0.5s )
s
1 s
Y2 (s) = (e − 2 + e−s )
s2
which gives
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
%% 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
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
(c) y3 (t) is the smoothest, and its support is also the largest.
3.41 (a) The two expressions for y1 (t) are equivalent. Indeed, since
then
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])
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)
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 )
3.42 (a)(b) The following script shows how to do polynomial multiplication using conv function.
The multiplication of the polynomials
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
-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)
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
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
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))
%% 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)’)
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Ω
−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).
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
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.
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
so
x(t) = −2 cos(t) = −ejt − e−jt
thus X1 = X−1 = −1.
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
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
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
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.
If k = 0, the dc value X0 is
Z 1
1 t2 1
X0 = tdt = | = 0.5
T0 0 2 t=0
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
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.
∞
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.
x(t)
1
··· ···
t
−1 0 1 2
dx(t)
dt
1
···
−1 0 1 2
t
(−1) (−1) (−1) (−1)
It is also possible to find a similar expression for other values of t which are not in the discontinu-
ities.
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
so that
Xk k odd
Wk =
Xk + Yk/2 k even
then X
y(t) = 2x(t) − 3 = (2X0 − 3) + 2Xk ejΩ0 kt
k6=0
The signal
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
|Xk |
4
0.5
k
−2 −1 0 1 2
∠Xk
−2 −1 0
k
1 2
−π
(c) Comparing
with the output obtained from applying the eigenfunction property of LTI:
x(t)
1
··· ···
2 4 6
t
cos(2)
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 )
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
which gives
p
A2 + B 2 = 1
tan−1 (B/A) = −2
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)
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
4.14 (a)
|H(jΩ)|
1
Ω
−4.5π −1.5π 1.5π 4.5π
∠H(jΩ)
π/2
Ω
−π/2
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
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 π π
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.
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
π
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).
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
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
(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
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
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
1 sin(πk/2)
Xk = X1 (s) |s=j2kπ = 2
T0 πk
so that X
x(t) = Xk ej2πkt
k
where
sin(πk/2)
Yk = j2πkXk = 4jkπ = 4j sin(πk/2)
πk
which coincides with the result in part (a).
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
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)
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π
k, odd
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.
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
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 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).
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
2
=
π(1 − 4k 2 )
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).
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;
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).
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
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,
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).
4.26 (a) x(t) is a train of rectangular pulses.The Laplace transform of the period x1 (t) is
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.
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.,
π −s πe−0.5s 0.5s
X1 (s) = (1 + e ) = (e + e−0.5s )
s2 + π 2 s2 + π 2
2πe−jπk 2
Xk = X1 (s) |s=j2πk = 2 2 2
cos(πk) =
−4π k + π (1 − 4k 2 )π
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
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;
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.
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
% 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);
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).
% 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).
% 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
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
% 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
0.8
0.6
xa(t)
0.4
0.2
0 1 2 3 4 5 6 7 8 9 10
t (sec)
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;
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);
−3 −4 −3
x 10 Periodic signal x 10 x 10 Periodic signal
x(t)
0
1 12
−1
0.5 −2
0 10
Amplitude
<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
<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.
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 ’])
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
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];
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
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.
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)
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
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.
(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Ω
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)]
this is because the imaginary part is the integral of an odd function which is zero. Since cos(.) is an even
function
X(−Ω) = X(Ω)
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 (Ω)
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
2 2(1 − jΩ)
Z(Ω) = = = X(Ω) + Y (Ω)
1 + jΩ 1 + Ω2
where the first is a cosine transform and the second a sine transform.
(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)
by symmetry of x(t).
(c) Compression
X(Ω/2)
X3 (Ω) = 2 = X(Ω/2)
2
(d) Modulation: x4 (t) = cos(0.5πt)x(t) so
where
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
sin(Ω)
P2 (Ω) = F[u(t) − u(t − 2)] = 2e−jΩ
Ω
Using
we have
(b) By duality
by duality
so that
2e−jΩ [1 − cos(Ω)]
X(Ω) =
Ω2
2
sin(Ω/2)
= e−jΩ
Ω/2
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
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)
The region of convergence 0 < σ < 0 is empty so the Laplace transform does not exist and the
Fourier transform cannot be obtained this way.
(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π
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=−∞
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=−∞
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
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
where
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
where
2e−jπΩ/4 sin(πΩ/4)
Q(Ω) =
Ω
which when replaced above does not give the expression given in the problem.
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
(b) The frequency components of x(t) with harmonic frequencies bigger than 2 are filtered out so
X(Ω)
Ω
−π π
(b)
Z π Z π
1 |Ω| 2 Ω 1
x(0) = dΩ = dΩ =
2π −π π 2π 0 π 2
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)
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
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
Call y1 (t) the output of the differentiator and y(t) the output of the delay
(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
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)
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
|Y (Ω)|
1
0.707
Ω
−1 1
(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Ω)
so that
y(t) = x(t)(−jt) = −jtδ(t − 1) − jtδ(t + 1) = −jδ(t − 1) + jδ(t + 1)
which gives
verifying that multiplication by −jt in the time domain corresponds to computing the derivative in the
Ω-domain.
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=−∞
(c) Both δTs (t) and ∆Ts (Ω) are periodic, the first of period Ts and the second of period 2π/Ts .
so that
sin(Ω)e−jΩ
Y (Ω) = X(Ω)
Ω
where the FT of x(t) is
(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
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 | =
3π
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 < π
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
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).
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);
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
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.
4πe−jΩ/4 cos(Ω/4)
X2 (Ω) = X2 (s) |s=jΩ =
4π 2 − Ω2
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)
% 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])
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.
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
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
2 2 8
X(s) = + =
−s + 2 s + 2 4 − s2
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)|’)
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)
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
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
0.8
0.6
0.4
0.2
−0.2
−10 −5 0 5 10
w
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,
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
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
−20
1
−40
0.5
−60
0 −80
−1 −0.5 0 0.5 1 −200 −100 0 100 200
−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).
|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)’)
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).
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 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)
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)
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
VC (s) 1/s 1
= = 2
Vs (s) 1 + s + 1/s s +s+1
VL (s) s s2
= = 2
Vs (s) 1 + s + 1/s s +s+1
VR (s) 1 s
= = 2
Vs (s) 1 + s + 1/s s +s+1
%% 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
2
0 0 0
−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.
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Ω
1
h(t) = [u(t + π) − u(t − π)] = 0.16[u(t + π) − u(t − π)].
2π
which is non-causal since h(t) 6= 0 for t < 0.
(b) The impulse response of the bandpass filter is
%% 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)’)
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).
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)
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
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)
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
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)
Vi (s) + Vo (s)
−R2
R1
−
R1 + R 2
AR1
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
−
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.
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
(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
6.5 (a) The transfer function of a stable second–order all–pass filter is of the form
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
N (s) (s − α)2 + β 2
G(s) = =
N (−s) + N (s) (s + α) + β 2 + (s − α)2 + β 2
2
(s − α)2 + β 2
=
2(s2 + α2 + β 2 )
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)
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)
(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).
1
H(s) =
(s + 1)2 + 1
Hc (s) 1 s2 + 1
= ⇒ Hc (s) =
s2 + 1 + Hc (s) 2
(s + 1) + 1 (s + 1)2
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).
Y (s) s(s + 1)
G(s) = = 2
X(s) s +1
Y (s) s2 + 1 G(s)
H(s) = = =
X(s) s(s + 1) 1 + G(s)F (s)
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
6.9 (a) Output of system A: x(t) = δ(t) − [u(t) − u(t − 1)] and by superposition
(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
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
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
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
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.
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)
b1
� v2 (t) � v1 (t)
b0 + +
x(t) y(t)
−a1
−a0
f11 = b1 , f12 = b0
Fbc = bo
b1 b0 1 b1
= then
f21 f22 0 b0
f21 = b0
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
is not invertible because its determinant is zero, so there is no possible transformation in this case.
Replacing V2 (s) = V1 (s)/s from equation (iii) in equation (ii) we have that
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
y2 (t) = w1 (t)
ẇ1 (t) = x2 (t) + y2 (t) + w2 (t)
ẇ2 (t) = −2x2 (t) + 2y2 (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’)
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).
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)
num = 0 1 -1
den = 1 1 -2
A =
-1 2
1 0
B =
1
0
C =
1 -1
D =
0
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
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)
%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.
Ao =
-2 1
-1 0
bo =
1
-1
co =
1
0
ans =
-1.0000 + 0.0000i
-1.0000 - 0.0000i
which provide the necessary equations for the minimal realization. A block diagram is shown in Fig. 6.9.
R R
+
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
|H(j1)|2 (1/2)
= = 1/2
|H(j0)|2 1
Ω |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 .
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 ∞.
Ω=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
Y (s) 1
H(s) = = 2
X(s) s + 2s + 1
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
(d) The difference between the outputs and the inputs of the filter in the above cases is
both of which tend to zero as t → ∞ and indicating that the responses eventually follow the input
exactly.
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)
cos(40π × 103 t)
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.
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
which gives
c
L1 = L0 + = (10 + 38.5) × 103 = 48.5 × 103 meters
4(f0 − ν)
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’)
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).
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.
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)
% 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.
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.
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.
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.
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.
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.
−1
4
3
2
1
0
−1
−2
1 1 1
|H|
|H|
0.4 0.4 0.4
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.
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);
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;
[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
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
1 0.5
0
0.5
−0.5
0 −1
−100 −50 0 50 100 0 1 2 3 4 5
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);
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)
subplot(221)
plot(W,abs(S));axis([-120 120 -0.1 1.5]);title(’Spectrum |S| of received signal’); grid
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.
X=fftshift(X);
x=real(ifft(X))/Ts;t=[0:N-1]*Ts;
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
0 0
−60 −40 −20 0 20 40 60 0 1 2 3 4 5
Sampling Theory
(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
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.
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)
where M (Ω) is the Fourier transform of m(t). The maximum frequency present in x(t) is
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
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).
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
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.
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
01 00 10 00 01 00 · · ·
x̂(nTs ) = ∆δ(nTs ) + 0δ((n − 1)Ts ) − 2∆δ((n − 2)Ts ) + 0δ((n − 3)Ts ) + ∆δ((n − 4)Ts )
01 01 00 11 10 11 00 01 01 00, · · ·
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.
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.,
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π.
(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
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
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
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 .
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
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
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)
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
Z ∞
e−2t ∞
Ex = 2 e−2t dt = 2 | =1
0 −2 0
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
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
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.
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
1 n = −1, 0, 1
xe [n] = 0.5(x[n] + x[−n]) 0.25 n = −2, 2
0 otherwise
−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
9.3 (a) The discrete frequency for the given signals are
2π
(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,
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:
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
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
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
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:
Time-invariance
since 2 cannot be expressed in terms of π, so y[n] is not periodic. It will also be true for any
multiple of 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.
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.
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
obtained when the input is δ[n] and the outputs is h[n] (no initial conditions) we have
y(t)
h(t − τ ) x(τ )
1 1
τ t
t − 2.5 t 3.5 2.5 3.5 6
(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
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.
x[n] x[n − 1]
D
y[n]
+
(b) The impulse response is found by letting x[n] = δ[n], IC zero, and y[n] = h[n]. Recursively,
9.15 (a) x[n] = δ[n] + δ[n − 1] + δ[n − 2] and y[n] = δ[n − 1] + δ[n − 2] + δ[n − 3], and
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.
9.16 (a) Since δ[n] = u[n] − u[n − 1] using the LTI of the system
(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
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
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]
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.
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 ).
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
β
(c) The output is the convolution sum of x(nTs ) and h(nTs ) which gives
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.
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
(b) If x[n] = δ[n] then the input to the second system is w[n] = h[n] = δ[n] + δ[n − 1] and
For n ≥ 0 the values of g[n] are obtained using the above equation
or
1 n = 0, 2
g[n] = −1 n=1
0 otherwise
or
y[n] = 0 n<0
y[0] = 1
y[1] = 0
y[n] = (−1)n n≥2
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
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.
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
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
which is not the previous result shifted, so that the system is time-varying.
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
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.
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
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
···
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.
% 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
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
∞
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
0.8
0.6
x[n]
0.4
0.2
−5 0 5 10 15 20
n
% 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).
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
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
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]’)
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].
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.,
2π
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.
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).
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
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
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’)
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.
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
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].
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
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.
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
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’)
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)
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
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].
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
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
Repeating this process we realize that after more iterations we get that,
(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’)
0.8
0.6
h[n]
0.4
0.2
0 5 10 15 20 25
n
9.42 (a) Letting x[n] = δ[n] the impulse response of the filter is
% 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
(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
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.
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
∞
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’)
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].
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
..
.
% 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)
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
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
∞
X
r[n] = u[n − k]
k=0
∞
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
−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).
(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
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
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].
% 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
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
(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)
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
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
The Z–transform
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
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.
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=−∞
d X(z) −α
=
dz (z − α)2
so that we have
−α −αz −2
= ⇔ (n − 1)α(n−1) u[−n].
(z − α)2 (1 − αz −1 )2
z2
X(z) =
z2 − 1
the poles are z = ±1, and the zeros z = 0, double.
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[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
Y (z)
X(z) = = (1 + 0.5z −1 )2 = 1 + z −1 + 0.25z −2
H(z)
(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
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.
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 )
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→∞
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]
(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
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
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
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
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]
(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 π.
(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
Y (z) 1 − z −1
H(z) = =
X(z) 3(1 − 2z −1 /3)
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.
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
Moreover, the pole z = 1 is on the unit disc and as such the system is not BIBO stable.
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 )
H(z) = z −1 + 2z −2 + 2z −3 + · · · + 2z −10000 + · · ·
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
where
H(ej0 ) = 2,
(j + 1)2
H(ejπ/2 ) = 0.5 = 1ej0 ,
j
H(ejπ ) = 0
(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
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.
10.17 If input is δ[n] = u[n] − u[n − 1] the output is h[n] = s[n] − s[n − 1] where
y[0] = 0 y[1] = 1
y[2] = 3 y[3] = 4
y[4] = 4 y[n] = 3 n ≥ 5
thus
so that
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
Y (s) 2s
H(s) = = 2
X(s) s + 2s + 1
(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])
Using Z-transform
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
|H(ej0 )| = 1
|H(ejπ )| = 0
(α + β) ± (α − β)
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
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
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
X(z) = Y (z)R(z)
= 1 + 0.5z −1 − 0.75z −2 − 0.25z −3
so that
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
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
h[0]a1 = −h[1]
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.
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 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.
10.27 (a) The z-transform of the state variables (zero initial conditions) and output equations are
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
X(z)
W (z) =
1 + a1 z −1 + a2 z −2
The block diagram is shown in Fig. 10.2. The equations for the state and the output coincide with
the given ones.
−a1
−a2
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)
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
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
or the sequence {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, · · · } for n ≥ 0. The Z-transform of f [n] is then
which is not in a closed-form. To get that, we use the Z-transform shift property in the given difference
equation:
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
% 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
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
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
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
Y (z) 1
H(z) = =
X(z) 1 − 2r cos(ω0 )z −1 + r2 z −2
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.
If ω0 = 3π/2 we will get the same transfer function and impulse response as cos(3π/2) = 0.
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
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[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
which gives
y1 [0] = −y[−2] + 2 = 0
y1 [1] = −y[−1] + 0 = 2
y1 [2] = y1 [0] = 0
y1 [3] = −y[1] = 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
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
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).
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
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’)
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).
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.
(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!).
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).
(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)
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)),’+’)
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.
A (B + C) − 2Bz −1
X(z) = +
1 − z −1 (1 − 2z −1 )2
A = X(z)(1 − z −1 )|z−1 =1 = 2
C = X(z)(1 − 2z −1 )2 |z−1 =1/2 = 2
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
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
α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]
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
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]
% 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
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)
A1 = -0.5000
B1 = 1
C1 = -0.5000
D1 = 1
A2 = 1.0000 -0.5000
1.0000 0
B2 =1
0
C2 =0.6000 -0.4000
D2 = 0.8000
1
Chaparro — Signals and Systems using MATLAB 11.2
ii. Z-transform
so ROC must include the unit circle (UC) and as such α > 1.
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ω .
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
for k > 2, Bk = 0.
by duality (ω → n, τ → ω0 )
cos(nω0 + θ) ↔ π ejθ δ(ω + ω0 ) + e−jθ δ(ω − ω0 )
For θ = 0
For θ = π/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.
|X(ejω )|
ω
−π π
∠X(ejω )
ω
−π π
and because of the odd symmetry of the phase it is zero at ω = 0. See Fig. 11.1.
Magnitude values
ω |X(ejω )|
0 5
±π/2 1
±π 1
Magnitude values
ω |X1 (ejω )|
0 3
±π/2 1
±π 1
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
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
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
e−jω
H(ejω ) = (1 + 2 cos(ω))
3
1 + 2 cos(ω)
jω
|H(e )| =
3
−ω 1 + 2 cos(ω) ≥ 0
∠H(ejω ) =
−ω + π 1 + 2 cos(ω) < 0
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.
0.5 z −1 + |{z}
H(z) = |{z} 1.2 z −2 + |{z}
0.5 z −3
h[1] h[2] h[3]
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.
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.
(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
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
0 −1
NX
X(ejω ) = 2πX[k]δ(ω − kω0 ), ω0 = 2π/N0
k=0
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
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
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
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
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
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.
(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
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]
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.
(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.
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
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
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.
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
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
Y = Fy
= FHx
1
= FH(F∗ )T X
det F
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
(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.
11.28 We have
If H(ejω ) ≥ 0 for all values of ω, its phase is zero. To find α consider the following
% 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
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
ω/π
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
1 − 2e−jω
H(ejω ) =
1 − 0.5e−jω
at ω = π
1+2
|H(ejπ )| = =2
1 + 0.5
√
1 + 2j
|H(ejπ/2 )| = = p 5 =2
1 + 0.5j 5/4
In general,
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
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ω ).
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’)
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.
%% 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
%% 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’)
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.
Z π/2
1 1
h[n] = 1e−jωN ejωn dω = sin(π(n − N )/2)
2π −π/2 π(n − N )
Z π/2
1 π
h[N ] = dω = = 0.5
2π −π/2 2π
%% 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.
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.
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ω
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’)
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.
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’)
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.
|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
ω/π
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=−∞
we get that
Z π
|X(ejω )|2 dω = 2π(1 + 4 + 9 + 4 + 1) = 38π
−π
X(z) = 1 + 2z −1 + 3z −2 + 2z −3 + z −4 = z −2 [z 2 + 2z 1 + 3 + 2z −1 + z −2 ]
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’)
|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].
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]
%% 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’)
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].
N −1
1 X
Xk = x[n]e−j2πnk/N
N n=0
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
%% 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.
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.
X = Sx
%% 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
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
so that
X0 x[0]
X1 x[2]
X2 = S1 x[1]
X3 x[3]
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
%% 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;
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
|X1|
|X|
0 0 0.4 0.4
−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.
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
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
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’)
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.
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])
0 0 0
Figure 11.22: Problem 43 Desired, noisy and denoised signals (top); magnitude spectra |X(ejω )| and
|Y (ejω )|
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’)
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
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’)
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
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).
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)’)
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.
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
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)
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
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
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
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
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
%% 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
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).
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
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
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]
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
(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 (∗)
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(z) = (α + βz −1 + αz −2 )(1 + z −1 )
β
z2 + z+1=0
α s
p 2
−β/α ± (β/α)2 − 4 −β β
zeros z2,3 = = ± −1
2 2α 2α
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.
H(ejπ/2 ) = 0
H(ejπ ) = 2ej0 = 2
2
×
Figure 12.1: Problem 4: Poles and zeros and vectors to ω = 0 to find H(ej0 ).
β − 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.
1 + (−2.5) z −1 + |{z}
H(z) = |{z} 1 z −2
| {z }
h[0] h[1] h[2]
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.
∠H(ej0 ) = 0
∠H(ejπ/2 ) = 0
∠H(ejπ ) = 0
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
(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
~ 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.
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
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
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
so that the resulting filter has h[n](−1)n as impulse response, therefore it is high-pass.
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)
y[0] = 0.000999
y[1] = 0.0030
y[2] = 0.0050
y(0) = 0
y(0.002) = 0.0020
y(0.004) = 0.0040
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 ]
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.
√
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)
2
x[n] + + + + y[n]
− + + +
−1
z z −1
√
0.5 −2 0.9 2
z −1
−0.81
(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
−4.94
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).
12.16 Using the variables v[n] and w[n] we obtain the following expressions
with Z-transforms
%% 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’)
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).
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
0.1
0.05
<H
0
−0.05
−0.1
0 0.5 1 1.5 2 2.5 3
0.5
Imaginary Part
0 4 4
−0.5
−1
−3 −2 −1 0 1 2 3
Real Part
% convolution sum
g=(1/3)*[1 2 1]; gg=conv(g,g)
which gives
(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).
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])
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.
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.
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)
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
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)
%% 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’)
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
ω/π
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.
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
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
Figure 12.10: Problem 23: Poles/zeros of discrete filter for bilinear transformation of order 12 (left) and 14
(right).
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
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)
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
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,
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
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
%% 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’)
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).
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])
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.
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
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
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.4
0.2 clean signal
0
−0.2
−0.4
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)
12.29 (a)(b) Multiplying by −1 the gain specifications we obtain the loss specifications
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’)
Nb =20 Butterworth
Nc =10 Chebyshev
Ne =6 Elliptic
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
Figure 12.15: Problem 29: Poles/zeros (left, clockwise from top left) and magnitude responses of Butterworth,
Chebyshev and elliptic filters.
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 )
(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)
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).
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)
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.
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)’;
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])
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)
2πfc
ωc = = 0.25π
fs
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’)
|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.
N
X −1
Ĥ(z) = hd [n − (N − 1)/2]w[n − (N − 1)/2]z −n
n=0
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
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.
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
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).
12.36 (a) The impulse response h[n] = 0.5n u[n], and so the downsampled impulse response is
since
1 2n ≥ 0 or n ≥ 0
u[2n] =
0 n<0
X∞
1
H(z) = = 0.5n z −n
1 − 0.5z −1 n=0
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’)
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 ω/π
1
h[n] = (δ[n] + δ[n − 1] + δ[n − 2])
3
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
(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’)
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.
N (z)
Z −1 =
D(z)
b0 + b1 Z −1 + b2 Z −2
H(Z) =
a0 + a1 Z −1 + a2 Z −2
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);
%% 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.
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)
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
1 1 2
|H1|
1 1
0.5 0.5 |H2|
Imaginary Part
Imaginary Part
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.