You are on page 1of 53

Linear Constant-coefficient

Difference Equations
N

k =0

a k y[n k ] =

bm x[n m]

for all n

m =0

An important subclass of linear time-invariant


systems consist of those system for which the
input x[n] and output y[n] satisfy an Nth-order
linear constant-coefficient difference equation.
A general form is shown above.

Signal Flow Graph of the


Difference Equation

Assume that a0 = 1. Let TD denote one-sample delay.


x[n]

b0

y[n]

TD

TD
b1

x[n-1]

a1

TD

TD
b2

x[n-2]

a2

y[n-2]

TD

TD
x[n-M]

y[n-1]

bM

aN

y[n-N]

Difference Equation: FIR


system

The assumption a0 = 1 can be always achieved


by dividing all the coefficients by a0 if a00.
The difference equation characterizes a
recursive way of obtaining the output y[n] from
the input x[n].
When ak = 0 for k = 1 N, the difference
equation degenerates to a FIR system.

The output consists of a linear combination of finite


inputs.
M

y[n] =

bm x[n m]

m =0

Difference equation: IIR


System

When bm are not all zeros for m = 1 M, the


difference equation degenerates to
N

y[n] = x[0] + ( a k )y[n k ]


k =1

This causes an IIR system

The effect of an impulse response sequence applied


to the input keeps on circulating around the feedback
loops indefinitely.

Accumulator

Example
n
y[n] = x[k ]
k =

= x[n] +

n 1

x[k ] = x[n] + y[n 1]

k =

Example (continue)

Moving average system when M1=0:

The impulse response is h[n] = u[n] u[nM2 1]

y[n] =

M2

x[n k ]

M 2 +1
1

k =0

Also, note that

y[n] y[n 1] =

1
M 2 +1

(x[n] x[n M 2 1])

The term y[n] y[n1] suggests the implementation


can be cascaded with an accumulator.

Moving Average System

Hence, there are at least two difference equation


representations of the moving average system. First,
x[n]

y[n]

TD
x[n-1]
TD
x[n-2]

TD
x[n-M]

where b = 1/ (M2+1)
and TD denotes onesample delay

Moving Average System


(continue)

Second,

The first representation is FIR, and the second


is IIR.

Solution of Difference
Equation

Just as differential equations for continuous-time


systems, a linear constant-coefficient difference
equation for discrete-time systems does not provide a
unique solution if no additional constraints are
provided.
Solution: y[n] = yp[n] + yh[n]

yh[n]: homogeneous solution obtained by setting all the


inputs as zeros.
N

ak y[n k ] = 0
k =1

yh[n]: a particular solution satisfying the difference equation.

Solution of Difference
Equation

Additional constraints: consider the N auxiliary


conditions that y[-1], y[-2], , y[-N] are given.

The other values of y[n] (n0) can be generated by


N

M
ak
bm
y[n] =
y[n k ] +
x[n m]
k =1 a0
m = 0 a0

when x[n] is available, y[1], y[2], y[n], can be


computed recursively.
To generate values of y[n] for n<N recursively,
N 1

M
ak
bk
y[n N ] =
y[n k ] +
x[n m]
k =1 a N
m =0 a N

Example of the Solution

Consider the difference equation


y[n] = ay[n-1] + x[n].
Assume the input is x[n] =K [n], and the auxiliary
condition is y[1] = c.
2
Hence, y[0] = ac+K, y[1] = a y[0]+0 = a c+aK,
n+1c+anK, for n0.
Recursively, we found that y[n] = a
1
1
For n<1, y[-2] = a (y[1] x[1] ) = a c,
y[2] = a1 y[1] = a2 c, , and y[n] = an+1c for n<1.
Hence, the solution is
y[n] = an+1c+Kanu[n],

Example of the Solution


(continue)

The recursively-implemented system for finding the


solution is non-causal.
The solution system is non-linear:

When K=0, i.e., the input is zero, the solution (system


response) y[n] = an+1c.
Since a linear system requires that the output be zero for
all time when the input is zero for all time.

The solution system is not shift invariant:

when input were shifted by n0 samples, x1[n] =K [n - n0],


the output is y1[n] = an+1c+Kann0 u[n - n0].

LTI solution

Our principal interest in the text is in systems that


are linear and time invariant.
How to make the recursively-implemented solution
system be LTI?
Initial-rest condition:

If the input x[n] is zero for n less than some time n0, the
output y[n] is also zero for n less than n0.
The previous example does not satisfy this condition since
x[n] = 0 for n<0 but y[1] = c.

Property: If the initial-rest condition is satisfied, then


the system will be LTI and causal.

Frequency-Domain Representation of
Discrete-time Signals and Systems

Eigen function of a LTI system

When apply an eigenfunction as input, the output is the


same function multiplied by a constant.

x[n] = ejwn is the eigenfunction of all LTI systems.

Let h[n] be the impulse response of an LTI system, when


ejwn is applied as the input,

y[n ] =

h[k ]e jw(n k ) = e jwn

k =

h[k ]e jwk

k =

Eigenfunction of LTI

( ) h[k ]e

Let H e jw =

k =

[]

jwk

( )

we have y n = H e e
consequently, ejwn is the eigenfunction of the
system, and the associated eigenvalue is H(ejw).
We call H(ejw) the LTI systems frequency
response that consists of the real and
imaginary parts, H(ejw) = HR(ejw) + jHI(ejw), or in
terms of magnitude and phase,
jw

jwn

( ) = H (e )e

He

jw

jw

( )

jH e jw

Example of Frequency

Response

Frequency response of the ideal delay system,


y[n] =x[n nd],
If we consider x[n] = ejwn as input, then
y[n] = e jw(n nd ) = e jwnd e jwn
Hence, the frequency response is

( )= e

He

jw

jwnd

The magnitude and phase are

( )

H e jw = 1,

( )

H e jw = wnd

Linear Combination

When a signal can be represented as a linear


combination of complex exponentials:

x[n] = k e jwk n
k

By the principle of superposition, the output is

( )

y[n] = k H e jwk e jwk n


k

Thus, we can find the output if we know the


frequency response of the system.

Example of Linear Combination

Sinusoidal responses of LTI systems:

A j jw0 n A j jw0 n
+ e e
x1 [n] + x2 [n]
x[n] = A cos(w0 n + ) = e e
2
2

The response of x1[n] and x2[n] are

( )

y1 [n] = H e jw0 ( A / 2 )e j e jw0 n

y 2 [n] = H e jw0 ( A / 2 )e j e jw0 n

If h[n] is real, it can be shown that H(e-jw0) = H*(ejw0), the


total response y[n] = y1[n] + y2[n] is

( )

( )

y[n] = A H e jw0 cos(w0 n + + ), where = H e jw0

Difference to Continuous-time
System Response

For a continuous-time system, the frequency


response is not necessarily to be periodic.
However, for a discrete-time system, the frequency
response is always periodic with period 2, since

( ) h[k ]e

H e jw =

k =

jwk

h[k ]e j (w+ 2 )k =H e j (w+ 2 )

k =

Because H(ejw) is periodic with period 2, we need only


specify H(ejw) over an interval of length 2, eg., [0, 2] or
[, ]. For consistency, we choose the interval [, ].
The inherent periodicity defines the frequency response
everywhere outside the chosen interval.

Ideal Frequency-selective Filters

The low frequencies are frequencies close to zero,


while the high frequencies are those close to .

Since that the frequencies differing by an integer multiple


of 2 are indistinguishable, the low frequency are those
that are close to an even multiple of , while the high
frequencies are those close to an odd multiple of .

Ideal frequency-selective filters:

An important class of linear-invariant systems includes


those systems for which the frequency response is unity
over a certain range of frequencies and is zero at the
remaining frequencies.

Frequency Response of Ideal


Low-pass Filter

Frequency Response of Ideal


High-pass Filter

Frequency Response of Ideal


Band-stop Filter

Frequency Response of Ideal


Band-pass Filter

Frequency Response of the


Moving-average System

The impulse response of the moving-average


system is
1

M1 n M 2

h[n] = M 1 + M 2 + 1

0
otherwise

Therefore, the frequency response is


M2
1
H e jw =
e jwn
M 1 + M 2 + 1 n= M1
By noting that the following formula holds:

[ ]

m +1


= 1
k =n
m

, m>n

Frequency Response of the Movingaverage System (continue)

[ ]

H e jw
=

1
e jwM 1 e jw(M 2 +1)
=
M1 + M 2 + 1
1 e jw
1
e jw(M 1 + M 2 +1) / 2 e jw(M 1 + M 2 +1) / 2

M1 + M 2 + 1

1
=
M1 + M 2 + 1

1 e jw
e jw(M 1 + M 2 +1) / 2 e jw(M 1 + M 2 +1) / 2

e jw(M 2 M 1 +1) / 2
e jw(M 2 M 1 ) / 2

e jw / 2 e jw / 2
sin[ jw(M 1 + M 2 + 1) / 2] jw(M 2 M 1 ) / 2
1
e
=
M1 + M 2 + 1
sin[w / 2]

( ) exp

= He

jw

( )

jH e jw

(magnitude and phase)

Frequency Response of the Movingaverage System (continue)


M1 = 0 and M2 = 4
Amplitude
response

Phase
response
2w

Suddenly Applied Complex


Exponential Inputs

In practice, we may not apply the complex


exponential inputs ejwn to a system, but the more
practical-appearing inputs of the form
x[n] = ejwn u[n]

i.e., complex exponentials that are suddenly applied at an


arbitrary time, which for convenience we choose n=0.
Consider its output to a causal LTI system:

n
y[n] = h[k ]x[n k ] = h[k ]e jwk e jwn

k =
k

=0

n<0
n0

Suddenly Applied Complex


Exponential Inputs (continue)

We consider the output for n 0.

jwn


jwk
jwn
jwk

e
e
y[n] = h[k ]e
h[k ]e

k
k
n
=
0
=
+
1

jw jwn
jwk jwn
e
=H e e
h[k ]e

k = n +1

( )

Hence, the output can be written as y[n] = yss[n] + yt[n],


where
jw jwn
y ss n = H e e
Steady-state response

[]

yt [n] =

( )

h[k ]e jwk e jwn

k = n +1

Transient response

Suddenly Applied Complex


Exponential Inputs (continue)

If h[n] = 0 except for 0 n M (i.e., a FIR system),


then the transient response yt[n] = 0 for n+1 > M.
That is, the transient response becomes zero
since the time n = M. For n M, only the steadystate response exists.
For infinite-duration impulse response (i.e., IIR)

yt [n] =

h[k ]e jwk e jwn

k = n +1

h[k ] Qn

k = n +1

For stable system, Qn must become increasingly


smaller as n , and so is the transient response.

Suddenly Applied Complex


Exponential Inputs (continue)

Illustration for the FIR case by convolution

Suddenly Applied Complex


Exponential Inputs (continue)

Illustration for the IIR case by convolution

Representation of Sequences by
Fourier Transforms

Fourier Representation: representing a signal by


complex exponentials.

1
x[n] =
2

( )

X e jw e jwn dw

( ) = x[n]e

X e

jw

n =

jwn

Inverse Fourier
transform

Fourier transform (or forward


Fourier transform)

A signal x[n] is represented as the Fourier integral of the


complex exponentials in the range of frequencies [, ].
The weight X(ejw) of the frequency applied in the integral can
be determined by the input signal x[n], and X(ejw) reveals
how much of each frequency is required to synthesize x[n].

Representation of Sequences by
Fourier Transforms (continue)
X (e jw ) = X (e jw )e jX (e )
jw

The phase X(ejw) is not uniquely specified since any


integer multiple of 2 may be added to X(ejw) at any
value of w without affecting the result.

Denote ARG[X(ejw)] to be the phase value in [, ].


Since the frequency response of a LTI system is the Fourier
transform of the impulse response, the impulse response
can be obtained from the frequency response by applying
the inverse Fourier transform integral:

1
h[n] =
2

( )

H e jw e jwn dw

Existence of Fourier Transform


Pairs

Whey they are transform pairs? Consider the integral

1
jwm jwn
x n
x[m]e
e dw

2 m =

1
=
x[m]
2
m =

1
Since
2

jw(n m )

jw(n m )

dw

sin (n m ) 1 m = n
dw =
=
= [n m]
(n m )
0 m n

x n =

x[m] [n m] = x[n]

m =

Conditions for the Existence of


Fourier Transform Pairs

Conditions for the existence of Fourier transform pairs


of a signal:

Absolutely summable
x[n] <

n =

Mean-square convergence:

lim

( )

( )

X e jw X M e jw

( ) x[n]e

dw = 0 , for X M e jw =

jwn

n=M

In other words, the error |X(ejw) XM(ejw) | may not approach


for each w, but the total energh in the error does.

Conditions for the Existence of


Fourier Transform Pairs (continue)

Still some other cases that are neither absolutely


summable nor mean-square convergence, the Fourier
transform still exist:
Eg., Fourier transform of a constant, x[n] = 1 for all n,
is an impulse train:

( ) 2 (w + 2r )

X e jw =

r =

The impulse of the continuous case is a infinite heigh, zero


width, and unit area function. If some properties are
defined for the impulse function, then the Fourier transform
pair involving impulses can be well defined too.

Conditions for the Existence of


Fourier Transform Pairs (continue)

Properties of continuous impulse function:


(w) = 0 for w 0 ,

(w)dw = 1, (w0 ) f (w)dw = f (w0 )

Eg., consider a sequence whose Fourier transform is

the periodic impulse train


jw

( ) = 2 (w w

X e

+ 2r )

r =

then the sequence is a complex exponential sequence (note


that extends only over one period, from, we need include
the term)

1
x(n ) =
2

2 (w w0 )e jwn dw = e jw0 n

Symmetry Property of the Fourier


Transform

Conjugate-symmetric sequence: xe[n] = xe*[n]

Conjugate-asymmetric sequence: xo[n] = xo*[n]

If a real sequence is conjugate symmetric, then it is


called an even sequence satisfying xe[n] = xe[n].
If a real sequence is conjugate antisymmetric, then it is
called an odd sequence satisfying x0[n] = x0[n].

Any sequence can be represented as a sum of a


conjugate-symmetric and asymmetric sequences,
x[n] = xe[n] + xo[n], where xe[n] = (1/2)(x[n]+ x*[n])
and xo[n] = (1/2)(x[n] x*[n]).

Symmetry Property of the Fourier


Transform (continue)

Similarly, a Fourier transform can be decomposed


into a sum of conjugate-symmetric and antisymmetric parts:
X(ejw) = Xe(ejw) + Xo(ejw) ,
where
Xe(ejw) = (1/2)[X(ejw) + X*(ejw)]
and
Xo(ejw) = (1/2)[X(ejw) X*(ejw)]

Symmetry Property of the Fourier


Transform (continue)

Fourier Transform Pairs (if x[n] X(ejw))

x*[n] X*(e jw)


x*[n] X*(ejw)
Re{x[n]} Xe(ejw) (conjugate-symmetry part of X(ejw))
jIm{x[n]} Xo(ejw) (conjugate anti-symmetry part of X(ejw))
xe[n] (conjugate-symmetry part of x[n]) XR(ejw) = Re{X(ejw)}
xo[n] (conjugate anti-symmetry part of x[n])
jXI(ejw) = jIm{X(ejw)}

Symmetry Property of the Fourier


Transform (continue)

Fourier Transform Pairs (if x[n] X(ejw))

Any real xe[n] X(ejw) = X*(ejw) (Fourier transform is


conjugate symmetric)
Any real xe[n] XR(ejw) = XR(ejw) (real part is even)
Any real xe[n] XI(ejw) = XI(ejw) (imaginary part is odd)
Any real xe[n] |XR(ejw)| = |XR(ejw)| (magnitude is even)
Any real xe[n] XR(ejw)= XR(ejw) (phase is odd)
xo[n] (even part of real x[n]) XR(ejw)
xo[n] (odd part of real x[n]) jXI(ejw)

Example of Symmetry Properties

The Fourier transform of the real sequence x[n] = anu[n]


for a < 1 is
1
jw

( ) = 1 ae

X e

jw

Its magnitude is an even function, and phase is odd.

Fourier Transform Theorems

Linearity
x1[n] X1(ejw), x2[n] X2(ejw)
implies that

a1x1[n] + a2x2[n] a1X1(ejw) + a2X2(ejw)

Time shifting
x[n] X(ejw)
implies that

( )

x[n nd ] e jwnd X e jw

Fourier Transform Theorems


(continue)

Frequency shifting
x[n] X(ejw)
implies that

jw0 n

x[n] X e

j (w w0 )

Time reversal
x[n] X(ejw)
If the sequence is time reversed, then x[n] X(ejw)
Furthermore, if x[n] is real then x[n] X*(ejw), since X(ejw)
is conjugate symmetric.

Fourier Transform Theorems


(continue)

Differentiation in frequency
x[n] X(ejw)

( )

implies that

dX e jw
nx[n] j
dw
Parsevals theorem
x[n] X(ejw)
implies that

E=

x[n]

n =

1
=
2

X (e )
jw

dw

Fourier Transform Theorems


(continue)
The convolution theorem
x[n] X(ejw) and h[n] H(ejw),
and if y[n] = x[n] h[n], then
Y(ejw) = X(ejw)H(ejw)

The modulation or windowing theorem


x[n] X(ejw) and w[n] W(ejw),
and if y[n] = x[n]w[n], then

( )

Ye

jw

1
=
2

X (e )W (e

j (w )

)d

a periodic
convolution

Fourier Transform Pairs


[n] 1

[n n0 ] e

jwn0

1 ( < n < )

2 [w + 2k ]

k =

a u[n] ( a < 1)
n

1
1 ae

jw

Fourier Transform Pairs (continue)


u[n]

1
1 ae

jw

[w + 2k ]

k =

(n + 1)a u[n] ( a < 1)


n

r n sin w p (n + 1)
sin w p

(1 ae )

jw 2

u[n] ( r < 1)

( )

1
1 2r cos w p e jw + r 2 e j 2 w

1
w < wc
sin wc n
jw
X e =
n
0 wc < w

Fourier Transform Pairs (continue)


1 0 n M
sin[w(M + 1) / 2] jwM / 2
x[n] =

e
sin[w / 2]
0 otherwise
e jw0 n

2 (w w0 + 2k )

k =

cos[w0 n + ]

j
j
(
)

w
+
2

k
+

e
(w + w0 + 2k )
0

k =

Determining a Fourier Transform


Using Symmetric Properties and Pairwise Formulas Examples

Suppose we wish to find the Fourier transform of


x[n] = anu[n-5].
x1 [n] = a u[n]
n

x2 [n] = x1 [n 5]

( )

1
1 ae

jw

( )

= X 1 e jw

( )

Thus, X 2 e jw = e j 5 w X 1 e jw =

( )

x[n] = a 5 x2 [n], so X e jw =

e j 5w
1 ae jw

a 5e j 5w
1 ae jw

Another Example

Determining the impulse response for a


difference equation
y[n](1/2) y[n1] = x[n] (1/4)x[n1]
To find the impulse response, we set x[n] = [n].
Then the above equation becomes
h[n](1/2) h[n1] = [n] (1/4)[n1]
Applying the Fourier transform, we obtain
H(ejw) (1/2)e-jwH(ejw) = 1 (1/4) e-jw
So H(ejw) = (1 (1/4) e-jw) / (1 (1/2) e-jw)

Another Example (continue)

From the pairwise table, we know

a u[n] ( a < 1)
n

1
1 ae

jw

thus, (1/2)nu[n] 1 / (1 (1/2) e-jw)


By the shifting property,
(1/4)(1/2)n1u[n1] (1/4) e-jw / (1 (1/2) e-jw)
Thus,
h[n] = (1/2)nu[n] (1/4)(1/2)n1u[n1]

You might also like