Discrete-Time System: 3.1.1 Accumulator
Discrete-Time System: 3.1.1 Accumulator
Discrete-Time System: 3.1.1 Accumulator
3. DISCRETE-TIME SYSTEM
A system is a combination of elements that act together to perform function not
possible with any of individual part. The system can be viewed as any process that
results in the transformation of signals. Thus, a system has an input signal and
output signal, which is related to the input through the system transformation.
In the discrete-time system (DTS) discrete–time inputs is transformed into
discrete–time outputs (see Figure 1). These systems will be represented
symbolically as
y(nT)
x(nT)
x [ nT ] y [ nT ]
x[nT] y[nT]
DTS
Figure 1
(3.1)
3.1.2 Upsampler
(3.2)
2
n=0:9;
x = [1 2 3 4 5 7 3 2 3 1];
L=3;
subplot(2,1,1)
stem(n,x,'fill')
y=zeros(1,L*length(x));
y([1:L:length(y)])=x;
subplot(2,1,2)
stem(n,y(1:length(x)),'fill')
6
x(n)
0
0 1 2 3 4 5 6 7 8 9
3 y(n)
0
0 1 2 3 4 5 6 7 8 9
Figure 2
(3.3)
3
The average filtering is used in stock market analysis for determining slowly varying trend
from data that contents high frequency fluctuations. In this case, a possible approach is to
average data over an interval in order to smooth out the fluctuations and keep only trend.
Original signal
8
%Generation the
original signal 6
R=50;
m=0:1:R-1; s 4
s=2*m.*(0.9.^m);
subplot (2,1,1)
2
stem(m,s);
xlabel('n');ylabel('s');
title('Original signal') 0
0 5 10 15 20 25 30 35 40 45 50
%Generation random noise
d=rand(R,1)-0.5; n
subplot (2,1,2) Noise
stem(m,d); 0.5
xlabel('n');ylabel('d');
title('Noise')
d 0
-0.5
0 5 10 15 20 25 30 35 40 45 50
n
6
%Generation noisly signal
x=s+d'; 5 y(n)
plot (m,x)
4
xlabel('n');ylabel('x');
y
hold on 3
M=3; x(n)
Filtering of noisly signal 2
b=ones(M,1)/M;
1
y=filter(b,1,x);
plot (m,y,'r','linewidth',2) 0
xlabel('n');ylabel('y')
-1
0 5 10 15 20 25 30 35 40 45 50
n
Figure 3
4
Factor 2-interpolation:
(3.4)
y(n)=
Factor 3-interpolation:
(3.5)
x(n)
3
x(1)
2
x(0)
1 n
2
0
0 1 3 4 5 6 7 8
y(n) x(2)
3
x(1)
2
x(0)
1
n
0
0 1 2 3 4 5 6 7 8 9
x(2)
Figure 4
3.2 Properties of DTS
One particularly simple memory less system is the identity system, whose output
is identical to its input. That is,
y n = x n
y (n) = 2 x(n)
for which the inverse system is
z (n) = (1/2) y(n)
Figure 6
6
The inverse system is widely used in communication system to avoid distortion introduced by
channel. For this purpose inverse of channel model filter is introduced to the receiver.
3.2.3 Causality
A system is causal if the output any time depends only on values of the
input at the present time and in the past.
A system described by y(n)=ax(n+1) is non-causal or anticipative. Output depends of the
future input.
The forward difference system defined by the relationship
y[n] = x[n + 1] − x[n]
is not causal, since the current value of the output depends on a future value of the input. The
backward difference system, defined as
y[n] = x[n] − x[n − 1]
has an output that depends only on the present and past values of the input. This system is
causal by definition.
Example
y(n)=a0x(n)+ a1x(n-1)+ a2x(n-2)+ a3x(n-3)+ a4x(n-4)
M
yn xn k
1 (3.6)
2M 1 k M
7
3.2.4 Stability
Every system designed to process signals must be stable. If an electrical system is not stable,
it will likely burn out or saturate after the application of an input, no matter how small. If a
mechanical system or a structure is not stable, it will generally blow up or disintegrate. If a
computer program is unstable, it will overflow. Thus, every system must be designed to be
stable in order to function properly.
A system is said to be BIBO (bounded-input bounded-output) stable if every bounded
input excites a bounded output.
This implies that if,
x(n) Bu
M
yn xn k
1
(3.8)
M 1 k M
Suppose x[n] =µ [n], then y[0]=1, y[1]=1, y[2]=1,…. The input is bounded by 1, output also
is bounded by 1. System is stable.
3. 2. 5 Time Invariance
A system is time invariant if a time shift in the input signal causes a
time in the output signal. Specifically, if y [n] is the output of a discrete – time–
invariant system when x [n] is the input, then y [n - no] is the output when x [n – no] is
applied.
x(n)=x1(n-n0)
y(n)=y( n-n0)
Suppose x(n)=µ(n); (0)=1, then y(0) = sin1; if (2)=1, then y (2) = sin 1, in general, if
x(t)=(t)=1, the output is always sin 1 no matter what n is. Thus, the system is time invariant.
Suppose x(n)=µ(n); if x (n)=1 at n=0, then y(0) = (sin 0)x1=0; if x (n)=1 at t=1, then y(1) =
(sin 1)x1=0.84x1=0.84. We find that the output is different if the same input is applied at
different time. Thus, the system described by y (n) = (sin n)x (n) is time varying.
3. 2. 6 Linearity
The condition (2.2) is referred to as homogeneity (or scaling) property; the condition (2.3) is
referred to as additivity property.
The two properties defining a linear system can be combined into a
single statement, which is written below for both the continuous-time and discrete-
time cases:
x(n) = ax1(n) + bx2(n)
where a and b are any complex constants. This very important fact is known
as the superposition property.
n
yn xk
k 0
is called the accumulator system, since the output at time n is the accumulation or sum of the
present and all previous input samples. The accumulator system is a linear system. Since this
may not be intuitively obvious, it is a useful exercise to go through
the steps of more formally showing this. We begin by defining two arbitrary inputs
x1[n] and x2[n] and their corresponding outputs
n n
y1 n x 1 k y 2 n x k 2
k k
When the input is x3[n] = ax1[n] + bx2[n], the superposition principle requires the output y3[n]
= ay1[n] + by2[n] for all possible choices of a and b.
n n n n n
y 3 n x 3 k (ax 1 k bx 2 k) a x 1 k b x 2 k
k k k k k
= y1[n] + by2[n].
Thus, the accumulator system of s atisfies the superposition principle for all inputs and is
therefore linear.
Linear systems possess another important property, which is that zero
input yields zero output. For example, if x[n] y[n] , then the scaling property
tells us that
0 = 0.x [n] 0.y [n] = 0
A linear time-invariant system satisfies both the linearity and time –invariance
properties. Consider then the system
y [n] = 2x [n] + 3
We see that this system not linear, since y [n] = 3, if x [n] = 0. On the other
hand, this system falls into the class of incrementally linear systems.
vo(n)
x(n) y(n)
Linear
system +
Figure 7
11
The response of digital fitler to a unit sample sequence {δ[n]} is called the unit sample
response, or simply, the impulse response, and is denoted as {h[n]}. Correspondingly, the
response of a discrete-time system to a unit step sequence {μ[n]}, denoted as {s[n]}, is its unit
step response or simply, the step response. As we show next, a linear time-invariant digital
filter is completely characterized in the time-domain by its impulse response or its step
response.
Example. The impulse response {h[n]} of the discrete-time accumulator is obtained by
setting x[n]= δ [n] resulting in
Example. The impulse response {h[n]} of the factor-of-2 interpolator is obtained by setting
x[n]= δ [n] and is given by
The impulse response is seen to be a finite length sequence of length 3 and can be written
alternately as example
h[n]={0.5, 1, 0.5}
eq. since the discrete-time system is time invariant, its response to n 1 will be h[n-1].
We now generalize the above result for an arbitrary input sequence x[n] that can be expressed
as
xn xk n k . (3.9)
k
In the above expression, x[k] denotes specifically the k-th sample value. The response of the
LTI discrete-time system to the sequence xk n k will be x[k]h[n-k]. As a result, the
response y[n] of the discrete-time system to x[n] will be given by
13
yn xk hn k ,
k
by a simple change of variables. The above sum in Eqs. Is called the convolution sum of the
sequences x[n] and h[n], and represented compactly as:
Second, the convolution sum operation, for stable and single-sided sequences, is associative,
i.e.,
x1n x2 n x3 n x1n x2 n x3 n.
shall therefore consider alternative time-domain descriptions of such system that involve only
finite sums of products.
To understand the process involved in generating the new sequence y[n], let us first
compute the sample y[0] that is given by
yn xk hn k .
k
For n=0 y0 xk h k .
k
Thus, to compute the output sample y[0] we first time-reverse the sequence h[k] to arrive at
h[-k]. For n=1
y1 xk h1 k ,
k
which indicates that first the time-reserved sequence h[-k] is shifted to the right by one
sampling period to arrive at the sequence h[1-k]. Then the k-th sample of this sequence is
multiplied with the k-th input sample x[k] and summed over all values of k to arrive at y[1].
This process is continued for increasing values of n.
x(k) = (-2 0 1 -1 3)
h(k) = (1 2 0 -1 )
Find y(k). Sketch sequences.
We systematically develop the sequence y[n] generated by the convolution of the two
finite-length sequence x[n] and h[n] show in figure. As can be seen from the plot of the
shifted time-reversed version {h[n-k]} for n<0 sketched in figure for n=-3, for any value of
the sample index k, the kth sample of either {x[k]} or {h[n-k]} is zero. As a result the
product of the k-th samples is always zero for any k, and consequently, the convolution sum
of eq. leads to
y[n]=0 for n<0.
Consider now the calculation of y[0]. We form {h[-k]} as shown in figure. The
product sequence {x[k]h[-k]} is potted in figure, which has a single nonzero sample for k=0,
x[0]h[0]. Thus, y[0]=x[0]h[0]=-2.
15
For the computation of y[1], we shift {h[-k]} to the right by one sample period
to form {h[1-k]} as sketched in figure. The product sequence {x[k]h[1-k]} shown in figure
has one nonzero sample or k=0, x[0]h[1]. As a result,
Y[1]=x[0]h[1]+x[1]h[1] =-4
Y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]=0+0+1=1
y[3]=x[0]h[3]+x[1]h[2]+x[2]h[1]+x[3]h[0]=2+0+0+1=3,
y[4]=x[1]h[3]+x[2]h[2]+x[3]h[1]+x[4]h[0]=0+0-2+3=1,
y[5]=x[2]h[3]+x[3]h[2]+x[4]h[1]=-1+0+6=5,
y[6]=x[3]h[3]+x[4]h[2]=1+0=1,
y[7]=x[4]h[3]=-3.
From the plot of {h[n-k]} for n >7 as shown in figure and the plot of {x[k]} in figure, it can
be seen that there is no overlap between these two sequence. As a result y[n]=0 for n>7.
Output sequences generated by the convolution is given below.
y(n)
5
-1
-2
-3
-4
0 1 2 3 4 5 6 7
x(n)
Figure 8
In addition to direct substitution, discrete convolution can also be carried out using the table.
The table lists h[k] and x[k] on the top row and left-most column. The products of these
16
elements yield the entries of the table . The sums of those along the dotted lines yield the
convolution . Note that the positions of h[k] & x[k] can be interchanged and the result will
still be the same .
This is a convenient method of computing discrete convolution by hand.
x[k 1 2 0 -1 0
h[k]
-2
-2 4 0 2 -4
0
0 0 0 0 4
1
1 2 0 -1 2
-1
-1 -2 0 1 0
3
3 6 0 -3 0
Figure 9
% Convolution
x=[-2 0 1 -1 3];
h=[1 2 0 -1];
y=conv(x,h);
M=length(y)-1;
n=0:1:M;
disp(y);
stem(n,y,'fill','linewidth',3)
xlabel('n');ylabel('y')
3. 5 Interconnection of Systems
Input Output
DTS1 - h1(n) DTS2 - h2(n)
Figure 10
Note that, in general, the ordering of the filters in the cascade has no effect on the overall
impulse response because of the commutative property of convolution.
It can be shown that the cascade connection of two stable systems is stable. Likewise,
the cascade connection of the passive (lossless) systems is passive (lossless).
The cascade connection schema is employed in the development of an inverse system.
If the two LTI system in the cascade connection of figure are such that
Then the LTI system h2 n is said to be the inverse of the LTI system h1 n , and vice-versa.
As a result of the above relation, if the input to the cascaded system is x[n], its output is also
x[n]. An application of this concept is in the recovery of a signal from its distorted version
appearing at the output of a transmission channel is known.
The following example illustrates the development of an inverse system.
Example.
From example the impulse of the discrete time accumulator is the unit step response n .
Therefore, from eq. the inverse system must satisfy the condition
n
h2 0 1, h2 l 0, n 1.
l 0
As a results,
h2 1 1 and h2 n 0, for n 2.
Thus the impulse response of the overall filter is given here by
b) Parallel interconnection
h1(n)
Input Output
c) +
b)
h2(n)
Figure 11
y [ n ] = ( 2 x [ n ] – x [ n ]²)²
x[n]2
Square
-
y[n]
x[n] Square
+
2x[n] +
Multiplier by 2
Figure 12
c) Feedback Interconnection
An example of which is illustrated in Figure 13. Here the output of the System
1 is the input to System 2, while the output of System 2 is fed back and
added to the external input to produce the actual input to System 1. Feedback
system arises in a wide variety of applications. For example, a speed governor
on an automobile senses vehicle velocity and adjusts the input from the driver
in order to keep the speed at a safe level. Also, electrical circuits are often
useful viewed as containing feedback interconnections.
20
Fiigure 13
We know that DTS is defined to be BIBO stable if , if the output y(n) remain bounded for all
bounded input x(n). LTI system is BIBO stable if and only if its impulse response h(n) is
absolutely sumable
(3.11)
Example. h(n) =
if , S < ∞ system is BIBO stable. If, on the other hand, |a| ≥ 1, then the sum is
infinite and the system is unstable
(3.12)
N M
b yn k a xn k ,
k 0
k
k 0
k
21
If we assume the system to be causal, then we can rewrite equation to express y[n] explicitly
as a function of x[n]:
N M
yn yn k k xn k ,
bk b
k 1 b0 k 0 b0
Where x[n] and y[n] are, respectively, the input and output of the system, and {bk} and {ak}
are constants. The order of the discrete-time system is said to be N (assuming N ≥M), which is
the order of the difference equation characterizing the system. It is possible to implement an
LTI system characterized by eq. since the computation here involves two infinite sum of
products. In general, such a system may not be causal, as illustrated by the following example.
Example.
The filter described by
yn ayn 1 xn
has an impulse response h[n] (obtained by setting xn n );
hn a n n ca n ,
where c is any arbitrary constant. Consider two solutions:
The first solution h1 n, obtained for c=0, represents a causal system and is stable for a 1,
where as the second solution h2 n, obtained for c=-1, represents a non causal system that is
stable for a 1.
Example.
There exist infinite-impulse response LTI discrete-time systems that cannot be characterized
by the difference equation form of equation. The system defined by the impulse response
hn n 1
1
n2
is such an example. Note that the above system is causal and also BIBO stable.
22
If we assume the system to be causal, then we can rewrite equation to express y[n]
explicitly as a function of x[n]:
The following example illustrates the computation of the impulse responses of an LTI system
Example.
Program given below can be employed to compute the impulse response of a causal finite-
dimensional LTI discrete-system of the form of equation. The program calls for the following
input data: desired length of the impulse response and the filter coefficient vectors p and d
that must be entered inside square brackets. The program then plots the impulse response
sequence. To illustrate its application we determine the first samples of the impulse response
of the causal LTI system defined
1.5
k=0:1:N-1;
stem(k,y,'fill') -0.5
-1
10 20 30 40
Figure 14
The impulse response sequence generated by the program is then plotted as indicated in
figure. Note that the impulse response a discrete-time finite-dimensional system can also be
computed in MATLAB using the function impz.
23
To determine the step response we replace in the above program the statement x = [1
zeros ( 1, N-1 )] with the statement x= [ones (1, N)]. The computed first 41 samples of
the step response are indicated in figure.
From the plots of figures we can conclude that most likely the LTI system of equation
is BIBO stable. However, it is impossible to check the stability of a system just by examining
only a finite segment of its impulse response as in these figures.
then it is known as a finite impulse response (FIR) discrete-time system, for which the
convolution sum reduces to
N2
yn hk xn k . (3.14)
k N1
Note that the above convolution sum, being a finite sum, can be used to calculate y[n]
directly. The basic operations involved are simply multiplication and addition. Note that when
N1 0, the calculate of the present value of the output sequence involves the present value
and N 2 N1 previous values of the input sequence and involves the N 2 N1 1 impulse
response samples describing the FIR discrete-time system.
Examples of FIR discrete-time systems are the moving average system and the linear
interpolators.
If h[n] is of infinite length, then it is known as an infinite impulse response (IIR)
discrete-time system. In this case the convolution sum cannot be used to numerically calculate
the output sequence samples due to the infinite nature of the sum unless the input sequence is
of finite length. The class of IIR filter we are concerned with in this text is the causal system
24
characterized by the linear constant coefficient difference equation of equation. Note that here
also the basic operations needed in the output calculations are multiplication and addition. An
example of an IIR system is the accumulator of equations.
yn0 1 through yn0 N are known. However, it is possible to implement an FIR system
using a recursive computational scheme and an IIR system using a nonrecursive
computational scheme. The former case is illustrated in the example below.
Example.
Consider the FIR discrete-time system given by the impulse response
{h[n]}={1,1,1,1,1,1}.
Substituting the above in equation
N2
yn hk xn k .
k N1
y[n]=x[n]+x[n-1]+x[n-2]+x[n-3]+x[n-4]+x[n-5].
To develop the recursive version of this filter, we note from the above
y[n-1]=x[n-1]+x[n-2]+x[n-3]+x[n-4]+x[n-5]+x[n-6],
25
y[n-1]-x[n-6]=x[n-1]+x[n-2]+x[n-3]+x[n-4]+x[n-5].
Basic elements:
y(n) y(n)
A
x(n) A
x(n) w3(n) w3(n)
x(n) D w4(n)
x(n) z-1 w4(n)
N
y (n) h(k )x(n k )
k 0
y( z) N
H ( z) h(k )z k Transfer function
x( z ) k 0
y(n)
Figure 15
Figure 16
27
z-1 z-1
a1 b1
x(n-1) y(n-1)
z-1 z-1
a2 b2
x(n-2) y(n-2)
Figure 17
x(n) x1(n)
a b
y(n)
z-1
c
Figure 18