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

Middle East Technical University

Department of Electrical and Electronics Engineering


EE301: Signals and Systems I

Solutions for Homework 1


October 20, 2019
If you face any problem or mistake please contact Ömer Çayır, ocayir@metu.edu.tr, DZ-10.

1. i. x(t)

−1
−6 −5 −4 −3 −2 1 2 3 4 5 6 t

−1

x(t + 1)

−2
−6 −5 −4 −3 −1 1 2 3 4 5 6 t

−1

ii. x(2t)

−0.5
−6 −5 −4 −3 −2 −1 0.5 1 2 3 4 5 6 t

−1

 
iii. t−2
x
3

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

−1
iv. 1
xe (t) = Eν {x(t)} = (x(t) + x(−t))
2
xe (t)

0.5

−6 −5 −4 −3 −2 −1 1 2 3 4 5 6 t

1
xo (t) = Od {x(t)} = (x(t) − x(−t))
2
xo (t)

1
0.5
−2 −1
−6 −5 −4 −3 1 2 3 4 5 6 t
−0.5
−1

2. • If a CT signal x(t) is periodic, there exists a positive number T such that x(t + T ) = x(t)
and its fundamental period T0 is the smallest nonzero period T satisfying this relation.

• If a DT signal x[n] is periodic, there exists a positive integer N such that x[n + N ] = x[n]
and its fundamental period N0 is the smallest nonzero period N satisfying this relation.
 π
i. x(t) = 3 cos 4t +
3
2π π
is periodic with the fundamental period T0 = = .
4 2
h  i   
ii. π 2 1 2π
x(t) = cos 2t − = 1 + cos 4t −
3 2 3
2π π
is periodic and its fundamental period is T0 = = .
4 2
iii. x(t) = 2 cos (10t + 1) − sin (4t − 1)
2π π 2π π
cos (10t + 1) is periodic with period = and sin (4t − 1) is periodic with period = .
10 5 π π  4 2
Hence, x(t) is periodic and its fundamental period is T0 = LCM , = π.
5 2
iv. 1 1
x(t) = Eν {cos (4π t) u(t)} = [cos (4π t) u(t) + cos (−4π t) u(−t)] = cos (4π t)
2 2
(Remember that cos (−θ) = cos (θ).)
2π 1
The signal x(t) is periodic and its fundamental period is T0 = = .
4π 2
 π 
v. x[n] = j n = exp j n
2
 π 
x[n + N ] = x[n] =⇒ exp j N = 1 = exp (j2πk) for k ∈ Z
2
Then, we obtain N = 4k. Hence, x[n] is periodic and its fundamental period is N0 = 4 (for
k = 1).
√  π n √ n  π 
vi. x[n] = (1 + j)n = 2 exp j = 2 exp j n
4 4
√ n
Owing to 2 , we cannot find a nonzero N satisfying x[n + N ] = x[n], and the signal x[n]
is not periodic.
 
vii. 25
x[n] = exp j πn
4
 
25
x[n + N ] = x[n] =⇒ exp j πN = 1 = exp (j2πk) for k ∈ Z
4
8
Then, we obtain N = k. Hence, x[n] is periodic and its fundamental period is N0 = 8
25
(for k = 25).

3. (1) A system is memoryless (instantaneous) if the output at any time instant depends only on
the value of the input at that particular instant.

(2) A system is causal if its output at any time depends only on the values of the input at present
time and in the past.

(3) A system is stable if bounded inputs lead to bounded outputs (BIBO stable).

(4) A system is time-invariant if a time shift in the input signal causes same amount of time shift
in the output signal.

(5) A system is linear if it possesses the superposition property:

CT: a x1 (t) + b x2 (t) → a y1 (t) + b y2 (t) ⇐= x1 (t) → y1 (t) and x2 (t) → y2 (t)
DT: a x1 [n] + b x2 [n] → a y1 [n] + b y2 [n] ⇐= x1 [n] → y1 [n] and x2 [n] → y2 [n]

System (1) Memoryless (2) Causal (3) Stable (4) Time-Invariant (5) Linear

i. y[n] = x[n − 2]+x[2 − n] 7 7 3 7 3


ii. y(t) = cos (3t) x(t) 3 3 3 7 3
2n
X
iii. y[n] = x[k] 7 7 7 7 3
k=−∞
dx(t)
iv. y(t) = 7 3 7 3 3
dt

i. y[n] = x[n − 2] + x[2 − n]


The system is not causal. For instance, when n = 0, we see that y[0] = x[−2] + x[2], and
the current value of the output depends on the future value of the input.
The system is not memoryless since it is not causal.
The system is not time-invariant owing to x[2−n]. Let x2 [n] = x1 [n−n0 ] for x1 [n] → y1 [n]
and x2 [n] → y2 [n], then check whether y2 [n] = y1 [n − n0 ] or not.
)
y2 [n] = x2 [n − 2] + x2 [2 − n] = x1 [n − 2 − n0 ] + x1 [2 − n − n0 ]
=⇒ y2 [n] 6= y1 [n − n0 ]
y1 [n − n0 ] = x1 [n − n0 − 2] + x2 [2 − n + n0 ]

ii. y(t) = cos (3t) x(t)


The system is not time-invariant owing to cos (3t). Let x2 (t) = x1 (t − t0 ) for x1 (t) → y1 (t)
and x2 (t) → y2 (t), then check whether y2 (t) = y1 (t − t0 ) or not.
)
y2 (t) = cos (3t) x2 (t) = cos (3t) x1 (t − t0 )
=⇒ y2 (t) 6= y1 (t − t0 )
y1 (t − t0 ) = cos (3t − 3t0 ) x1 (t − t0 )

iii. 2n
X
y[n] = x[k]
k=−∞

The system is not causal. For instance, when n = 1, we see that y[1] = x[2]+x[1]+x[0]+. . .,
and the current value of the output depends on the future value of the input.
The system is not memoryless since it is not causal.
The system is not time-invariant owing to the upper limit of the summation 2n. Assuming
x2 [n] = x1 [n − n0 ] for x1 [n] → y1 [n] and x2 [n] → y2 [n], we obtain y2 [n] 6= y1 [n − n0 ].
2n 2n 2n−n

X X `,k−n0
X0 

y2 [n] = x2 [k] = x1 [k − n0 ] = x2 [`]



k=−∞ k=−∞ `=−∞
=⇒ y2 [n] 6= y1 [n − n0 ]
2n−2n
X0 


y1 [n − n0 ] = x1 [k]


k=−∞

The system is not stable. Let x[n] = u[n]. Then, we have


2n
X 2n
X
y[n] = u[k] = u[k] = (2n + 1) u[n],
k=−∞ k=0

and y[n] → ∞ as n → ∞.
iv. dx(t)
y(t) =
dt
The derivative of x(t) can be expressed as

dx(t) x(t) − x(t − ∆)


= lim ,
dt ∆→0 ∆
see Section 2.5.3 from Oppenheim. Thus, the system is causal, but it is not memoryless
since the current value of the output depends on the past value of the input.

The system is not stable. Let x(t) = 4 − t2 if |t| < 2, and x(t) = 0 otherwise. Then, we
have
dx(t) t
y(t) = =√
dt 4 − t2
if |t| < 2, and it is zero otherwise. As t → 2, y(t) → ∞, while x(t) 6 2 for all t.
Z ∞ Z ∞
4. i. yi (t) = x1 (t) ∗ x2 (t) = x1 (t − τ ) x2 (τ ) dτ = [u(t − τ − 3) − u(t − τ − 5)] e−3τ dτ
−∞ 0 | {z }
nonzero only for t−5<τ <t−3

For t 6 3, we have yi (t) = 0.


For 3 < t 6 5, we have
Z   t−3
t−3
−1 −3τ 1 − e−3(t−3)
yi (t) = e −3τ
dτ = e = .
3 3
0 τ =0

For t > 5, we have


Z   t−3 
t−3
−3τ −1 −3τ
e−3(t−5) − e−3(t−3) 1 − e−6 e−3(t−5)
yi (t) = e dτ = e = = .
t−5 3 τ =t−5 3 3


0, t63



 1 − e−3(t−3)
, 3<t65
yi (t) = 3

 

 −6 e−3(t−5)
 1−e

, t>5
3
ii. dx1 (t)
yii (t) =
dt
∗ x2 (t) = [δ(t − 3) − δ(t − 5)] ∗ x2 (t) = x2 (t − 3) − x2 (t − 5)
yii (t) = e−3(t−3) u(t − 3) − e−3(t−5) u(t − 5)

iii. 
0,
 t63
dyi (t) e−3(t−3) , 3<t65
yii (t) = =
dt 

 e−6 − 1 e−3(t−5) , t > 5

5. We find the output signals for the given input signals and h[n] = αn u[n], where α ∈ C, as follows:

X ∞
X ∞
X 1
y1 [n] = h[n] ∗ x1 [n] = x1 [n − k] h[k] = αk u[k] = αk = , if |α| < 1
1−α
k=−∞ k=−∞ k=0

∞ ∞ n 
(n + 1) u[n], α=1
X X X
k k
y2 [n] = x2 [n − k] h[k] = u[n − k] α u[k] = u[n] α = n+1
k=−∞ k=−∞ k=0 1 − α

u[n], α 6= 1
1−α

X ∞
X −1
X
n−k
y3 [n] = x3 [k] h[n − k] = u[−k − 1] α u[n − k] = αn−k u[n − k]
k=−∞ k=−∞ k=−∞

This summation is bounded only for |α| < 1, and it can be computed separately for n < −1 and
n > −1, since u[n − k] is nonzero only when k 6 n.
 n ∞
 X X 1

 α n−k `,n−k
= α `
= , n < −1 and |α| < 1
−1 
 1−α
X k=−∞ `=0
y3 [n] = αn−k u[n − k] = −1 ∞

 X `,−k−1
X αn+1
k=−∞ 
 α n−k
= α n+`+1
= , n > −1 and |α| < 1
 1−α
k=−∞ `=0
As x3 [n] = x1 [n] − x2 [n], we have y3 [n] = y1 [n] − y2 [n] owing to the distributive property of LTI
systems shown below.

y3 [n] = h[n] ∗ x3 [n] = h[n] ∗ (x1 [n] − x2 [n]) = h[n] ∗ x1 [n] − h[n] ∗ x2 [n] = y1 [n] − y2 [n]


 1
 , n < 0 and |α| < 1
1−α
y3 [n] = y1 [n] − y2 [n] =

 αn+1
 , n > 0 and |α| < 1
1−α


 1
n+1  , n < −1 and |α| < 1
α 1 1−α
= =⇒ y3 [n] = y1 [n] − y2 [n] =
1 − α 1−α 
 αn+1
n=−1  , n > −1 and |α| < 1
1−α

(
6. i. 1, 1 6 n 6 5
x1 [n] = x2 [n] =
0, otherwise


X 5
X 
n − 1, 1<n66
y[n] = x1 [n] ∗ x2 [n] = x1 [k] x2 [n − k] = x2 [n − k] = 11 − n, 6 < n 6 10


k=−∞ k=1 0, otherwise
1

0
0 2 4 6 8 10 12

0
0 2 4 6 8 10 12

0
0 2 4 6 8 10 12

To verify our result x1 [n] ∗ x2 [n] in MATLAB, the sample code is given below.
x = @ ( n ) (n >=1 & n <=5)*1; % x [ n ]=1 if 1 <=n <=5 , x [ n ]=0 otherwise
nx = 0:6; % sample index for x1 and x2
ny = 2* min ( nx ):2* max ( nx ); % sample index for the convolution

% obtain x1 and x2
xOne = x ( nx );
xTwo = x ( nx );
% compute the convolution of x1 and x2 by using ’ conv ’ function
y = conv ( xOne , xTwo );

% visualization of the DT signals


figure (1); subplot (211); % x1
stem ( nx , xOne , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ min ( ny ) max ( ny )] , ’ YTick ’ ,[0 1])
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$x_1 [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)

subplot (212); % x2
stem ( nx , xTwo , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ min ( ny ) max ( ny )] , ’ YTick ’ ,[0 1])
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$x_2 [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)

figure (2); % y
stem ( ny ,y , ’ filled ’ , ’ LineWidth ’ ,2);
title ( ’ The convolution of $$x_1 [ n ] $$ and $$x_2 [ n ] $$ ’ , ...
’ Interpreter ’ , ’ latex ’ );
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$y [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)
ii. Assuming x1 [n] = 0 for n 6 0 and n > N1 , and x2 [n] = 0 for n 6 0 and n > N2 , we can use
the MATLAB code given below to compute the convolution of x1 [n] and x2 [n].
function [y , ny ] = ee301hw1q6partii ( xOne , xTwo )
% get the length of each input signal
NOne = length ( xOne );
NTwo = length ( xTwo );

% memory allocation for the convolution of the input signals


y = zeros (1 , NOne + NTwo -1);

% select the loop with less repetitions to run faster


if NOne < NTwo
% use x1 [1]* x2 [n -1]+ x1 [2]* x2 [n -2]+...+ x1 [ N1 ]* x2 [n - N1 ]
for k =1: NOne
ind = k +(0: NTwo -1);
y ( ind ) = y ( ind )+ xOne ( k )* xTwo ;
end
else
% use x2 [1]* x1 [n -1]+ x2 [2]* x1 [n -2]+...+ x2 [ N2 ]* x1 [n - N2 ]
for k =1: NTwo
ind = k +(0: NOne -1);
y ( ind ) = y ( ind )+ xTwo ( k )* xOne ;
end
end

% get the sample index for the convolution of the input signals
ny = 2:( NOne + NTwo );
( (
iii. n, 1 6 n 6 20 11 − n, 1 6 n 6 10
x1 [n] = x2 [n] =
0, otherwise 0, otherwise
20

10

0
5 10 15 20 25 30

10

0
5 10 15 20 25 30

1000

500

0
5 10 15 20 25 30

To compute x1 [n] ∗ x2 [n] in MATLAB, the sample code is given below.


NOne = 20;
nxOne = 1: NOne ; % sample index for x1
NTwo = 10;
nxTwo = 1: NTwo ; % sample index for x2

% obtain x1 and x2
% x1 [ n ]= n if 1 <=n <=20 , x1 [ n ]=0 otherwise
xOne = nxOne ;
% x2 [ n ]=11 - n if 1 <=n <=10 , x2 [ n ]=0 otherwise
xTwo = 11 - nxTwo ;

% compute the convolution of x1 and x2 by using ’ conv ’ function


[y , ny ] = ee301hw1q6partii ( xOne , xTwo );

% get lower and upper limits of time axis for alignment


nMin = min (1 , min ( ny ));
nMax = max ( max ( NOne , NTwo ) , max ( ny ));

% visualization of the DT signals


figure (1); subplot (211); % x1
stem ( nxOne , xOne , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ nMin nMax ])
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$x_1 [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)

subplot (212); % x2
stem ( nxTwo , xTwo , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ nMin nMax ])
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$x_2 [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)

figure (2); % y
stem ( ny ,y , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ nMin nMax ])
title ( ’ The convolution of $$x_1 [ n ] $$ and $$x_2 [ n ] $$ ’ , ...
’ Interpreter ’ , ’ latex ’ );
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$y [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)
iv. x1 [n − 4] ∗ x2 [n + 5] = (x1 [n] ∗ δ[n − 4]) ∗ (x2 [n] ∗ δ[n + 5])
= (x1 [n] ∗ x2 [n]) ∗ (δ[n − 4] ∗ δ[n + 5])
| {z } | {z }
y[n] from part (iii) δ[n+1]

= y[n + 1]
Using commutative After running the code given in part (iii), we use the following lines in
MATLAB to obtain the desired result.
figure (2); % y
stem ( ny -1 ,y , ’ filled ’ , ’ LineWidth ’ ,2);
set ( gca , ’ XLim ’ ,[ nMin nMax ])
title ( ’ The convolution of $$x_1 [n -4] $$ and $$x_2 [ n +5] $$ ’ , ...
’ Interpreter ’ , ’ latex ’ );
xlabel ( ’ $$n$$ ’ , ’ Interpreter ’ , ’ latex ’ );
ylabel ( ’ $$y [ n ] $$ ’ , ’ Interpreter ’ , ’ latex ’)

1000

500

0
5 10 15 20 25 30

You might also like