LN2 Discrete Time Systems v1 2017
LN2 Discrete Time Systems v1 2017
x n T y n
A SISO system
1
Ex: A delay system 𝑦[𝑛] = 𝑥 [𝑛 − Δ]
2
Ex:
𝑦[𝑛] = 𝑎𝑥 [𝑛] + 𝑏𝑥 [𝑛 − 1]
1 sample
𝑥[𝑛] delay
a b
+ 𝑦[𝑛]
𝑁2
𝑦[𝑛] = ∑ 𝑎𝑘 𝑥 [𝑛 − 𝑘]
𝑁1
3
Ex:
𝑥[𝑛] + 𝑦[𝑛]
1 sample
delay
𝑦 [𝑛 ] = ∑ 𝑥 [𝑘 ]
𝑘=−∞
Note that not all recursive expressions have their nonrecursive counterparts.
4
CLASSIFICATION OF SYSTEMS
5
WITH MEMORY - MEMORYLESS
𝑦 [𝑛 ] = 𝑥 [𝑛 ]
𝑦[𝑛] = 3𝑥 [𝑛]
𝑦[𝑛] = 4𝑥[𝑛]
are memoryless
whereas
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 − 1]
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 + 1]
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 ] + 𝑥 [ 𝑛 − 1]
have memory
You have heard or you will hear about “dynamic systems”; they have memory.
6
LINEARITY
7
Ex:
𝑦 [𝑛 ] = 𝑥 [𝑛 ] + 3 is nonlinear
Proof: Exercise
8
TIME-INVARIANCE
Let 𝑦1 [𝑛] = 𝑇{𝑥[𝑛]} and 𝑦2 [𝑛] = 𝑇{𝑥 [𝑛 − 𝑁0 ]} be the outputs of the system to
𝑥 [𝑛] and 𝑥 [𝑛 − 𝑁0 ], respectively.
9
Ex: Compressor (downsampler!)
𝑥 [𝑛 ] ↓M 𝑦 [𝑛 ]
Is it time-invariant?
10
Before answering the question, let’s see what a compressor is.
Compressor
x[n]
3
2
… 1
…
-2 -1 0 1 2 3 4
n
x[2n]
2
… … M=2
-2 -1 0 1 2 3 4
n
11
Is it time-invariant?
Answer:
𝑦1 [𝑛] = 𝑥 [𝑀𝑛]
𝑦2 [𝑛] = 𝑥 [𝑀𝑛 − 𝑁0 ]
Since
compressor is time-varying.
12
Compressor is time-varying:
x[n]
3
2
… 1
…
-2 -1 0 1 2 3 4
n
x[3n]
3
2
… 1
… M=3
”
-2 -1 0 1 2 3 4
n
x[3n-1]
3
2
… 1
… The response to 𝑥[𝑛 − 1]
” when M = 3
-2 -1 0 1 2 3 4
n
x[3(n-1)]
3
2
… 1
… 𝑥[3𝑛] delayed by 1 sample
”
n
-2 -1 0 1 2 3 4
13
clear all
close all
k = 0:10;
a = (-1).^k
aa = upsample(a,2)
x = [0 aa 0] %input
n = 0:length(x)-1;
stem(n,x)
xlabel('n, sample index')
ylabel('x[n]')
title('input')
x_1 = circshift(x,[0,1]) % input delayed by one sample
figure
n = 0:length(x_1)-1;
stem(n,x_1)
xlabel('n, sample index')
ylabel('x[n-1]')
title('input delayed by one sample')
y = downsample(x,2)
figure
n = 0:length(y)-1;
stem(n,y)
xlabel('n, sample index')
ylabel('y[n]')
title('response to x[n]')
yy = downsample(x_1,2)
figure
n = 0:length(yy)-1;
stem(n,yy)
xlabel('n, sample index')
ylabel('z[n]\neq y[n-1]')
title('response to x[n-1]')
14
Show that it is linear! (exercise)
15
Ex: Expander (upsampler!)
𝑛
𝑥[ ] 𝑛 = 𝑘𝐿
𝑦 [𝑛 ] = { 𝐿 𝐿 ∈ 𝑍, 𝐿>1
0 𝑛 ≠ 𝑘𝐿
𝑥 [𝑛 ] ↑L 𝑦 [𝑛 ]
16
Is it time-invariant?
𝑛
𝑥[ ] 𝑛 = 𝑘𝐿
𝑦1 [𝑛] = { 𝐿
0 𝑛 ≠ 𝑘𝐿
𝑛
𝑥 [ − 𝑁0 ] 𝑛 = 𝑘𝐿
𝑦2 [𝑛] = { 𝐿
0 𝑛 ≠ 𝑘𝐿
Since
𝑛 − 𝑁0
𝑥[ ] 𝑛 − 𝑁0 = 𝑘𝐿
𝑦2 [𝑛] ≠ 𝑦1 [𝑛 − 𝑁0 ] = { 𝐿
0 𝑛 − 𝑁0 ≠ 𝑘𝐿
expander is time-varying.
17
CAUSALITY
A system is said to be causal if the two output signals 𝑦1 [𝑛] and 𝑦2 [𝑛] (due to
two input signals 𝑥1 [𝑛] and 𝑥2 [𝑛]) satisfy
𝑦1 [𝑛] = 𝑦2 [𝑛] 𝑛 ≤ 𝑛0
whenever
𝑥1 [𝑛] = 𝑥2 [𝑛] 𝑛 ≤ 𝑛0
18
Ex:
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 + 1] − 𝑥 [ 𝑛 ] is noncausal
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 ] + 𝑥 [ 𝑛 − 1] is causal
𝑦 [𝑛 ] = 𝑥 [𝑛 ] + 5 is causal
Proof: Exercise
19
STABILITY (BIBO)
20
Ex:
𝑦 [𝑛 ] = ∑ 𝑥 [𝑘 ]
𝑘=−∞
= 𝑦 [ 𝑛 − 1] + 𝑥 [ 𝑛 ]
UNSTABLE
𝑛+1 𝑛≥0
For example, for 𝑥 [𝑛] = 𝑢[𝑛] the output is 𝑦[𝑛] = {
0 𝑛<0
21
Computation of
𝑦[𝑛] = 𝑎𝑦[𝑛 − 1] + 𝑥 [𝑛]
in MATLAB.
clear all
close all
N = 1000; % signal length
a = 0.97; % system parameter
b = 1; % system parameter
k = 1:N; % discrete-time index vector
w = pi/2; % frequency of input sinuoid
% x = 2*(rand(1,N)-0.5); % random input
x = sin(w*k); % sinusoidal input
x = [x zeros(1,N)]; % zero padding (why?)
y = zeros(1,2*N); % output signal
for n = 2:2*N
y(n) = a*y(n-1)+b*x(n);
end
plot(x)
hold on
plot(y,'r')
22