+ All Categories
Home > Engineering > DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Date post: 21-Apr-2017
Category:
Upload: amr-e-mohamed
View: 340 times
Download: 0 times
Share this document with a friend
53
MATLAB( 01 ) Discrete - Time Signals and Systems Assist. Prof. Amr E. Mohamed
Transcript
Page 1: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

MATLAB(01)

Discrete-Time Signals and

Systems

Assist. Prof. Amr E. Mohamed

Page 2: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete-Time Signals

2

Page 3: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete-Time Signals

A discrete signal will be denoted by x(n), in which the variable n is integer-

valued and represents discrete instances in time (Sequence of Number).

๐‘ฅ(๐‘›) = { ๐‘ฅ(๐‘›) } = { . . . , ๐‘ฅ( โˆ’ 1), ๐‘ฅ(0), ๐‘ฅ(1), . . . }

where the up-arrow indicates the sample at n = 0.

In MATLAB we can represent a finite-duration sequence by a row vector

of appropriate values.

For example, a sequence x(n) = { 2, 1, โˆ’ 1, 0, 1, 4, 3, 7 } can be

represented in MATLAB by

An arbitrary infinite-duration sequence cannot be represented in

MATLAB due to the finite memory limitations.

3

โ†‘

โ†‘

Page 4: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences

1. Unit sample sequence:

For example, to implement

over the ๐‘›1 โ‰ค ๐‘›0 โ‰ค ๐‘›2 interval, we will use the following MATLAB function.

4

Page 5: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

2. Unit step sequence:

For example, to implement

over the ๐‘›1 โ‰ค ๐‘›0 โ‰ค ๐‘›2 interval, we will use the following MATLAB function.

5

Page 6: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

3. Real-valued exponential sequence:

For example, to generate ๐‘ฅ ๐‘› = 0.9 ๐‘› , 0 โ‰ค ๐‘› โ‰ค 10, we will need the

following MATLAB script:

6

Page 7: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

4. Complex-valued exponential sequence:

where ฯƒ produces an attenuation (if <0) or amplification (if >0) and ฯ‰ 0 is

the frequency in radians.

For example, to generate ๐‘ฅ ๐‘› = ๐‘’(2 + ๐‘—3)๐‘› , 0 โ‰ค ๐‘› โ‰ค 10, we will need

the following MATLAB script:

7

Page 8: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

5. Sinusoidal sequence:

where A is an amplitude and ฮธ0 is the phase in radians.

For example, to generate ๐‘ฅ ๐‘› = 3 ๐‘๐‘œ๐‘  0.1๐œ‹๐‘› +๐œ‹

3+ 2 ๐‘ ๐‘–๐‘›( 0.5๐œ‹๐‘› ),

0 โ‰ค ๐‘› โ‰ค 10, we will need the following MATLAB script:

8

Page 9: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

6. Random sequences:

Many practical sequences cannot be described by mathematical

expressions like those above. These sequences are called random (or

stochastic) sequences and are characterized by parameters of the

associated probability density functions.

In MATLAB two types of (pseudo-) random sequences are available.

The rand(1,N) generates a length N random sequence whose elements are

uniformly distributed between [0, 1].

The randn(1,N) generates a length N Gaussian random sequence with mean

0 and variance 1.

Other random sequences can be generated using transformations of the

above functions.

9

Page 10: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Types Of Sequences (Cont.)

7. Periodic sequence:

A sequence x(n) is periodic if x(n) = x(n + N), โˆ€n. The smallest integer N

that satisfies this relation is called the fundamental period. We will use

หœx(n) to denote a periodic sequence.

To generate P periods of ๐‘ฅ(๐‘›) from one period { ๐‘ฅ(๐‘›), 0 โ‰ค ๐‘› โ‰ค ๐‘ โˆ’ 1} ,we

can copy ๐‘ฅ(๐‘›) ๐‘ƒ times:

But an elegant approach is to use MATLABโ€™s powerful indexing

capabilities.

10

Page 11: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences

1. Signal addition:

This is a sample-by-sample addition given by

The following function, called the ๐‘ ๐‘–๐‘”๐‘Ž๐‘‘๐‘‘ function, demonstrates these

operations.

11

Page 12: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

2. Signal multiplication:

This is a sample-by-sample (or โ€œdotโ€) multiplication) given by This is a sample-by-

sample addition given by

The following function, called the ๐‘ ๐‘–๐‘”๐‘š๐‘ข๐‘™๐‘ก function, demonstrates these operations.

12

Page 13: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

3. Scaling:

In this operation each sample is multiplied by a scalar ฮฑ.

๐›ผ { ๐‘ฅ(๐‘›) } = { ๐›ผ๐‘ฅ(๐‘›) }

An arithmetic operator (*) is used to implement the scaling operation in

MATLAB.

13

Page 14: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

4. Shifting:

In this operation, each sample of x(n) is shifted by an amount k to obtain a

shifted sequence y(n).

๐‘ฆ(๐‘›) = { ๐‘ฅ(๐‘› โˆ’ ๐‘˜) }

If we let ๐‘š = ๐‘› โˆ’ ๐‘˜, then ๐‘› = ๐‘š + ๐‘˜ and the above operation is given by

๐‘ฆ(๐‘š + ๐‘˜) = { ๐‘ฅ (๐‘š) }

This is shown in the function ๐‘ ๐‘–๐‘”๐‘ โ„Ž๐‘–๐‘“๐‘ก.

14

Page 15: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

5. Folding:

In this operation each sample of x(n) is flipped around n = 0 to obtain a

folded sequence y(n).

๐‘ฆ(๐‘›) = { ๐‘ฅ( โˆ’ ๐‘›) }

In MATLAB this operation is implemented by ๐‘“๐‘™๐‘–๐‘๐‘™๐‘Ÿ(๐‘ฅ) function for

sample values and by โˆ’๐‘“๐‘™๐‘–๐‘๐‘™๐‘Ÿ(๐‘›) function for sample positions as shown

in the ๐‘ ๐‘–๐‘”๐‘“๐‘œ๐‘™๐‘‘ function.

15

Page 16: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

6. Sample summation:

This operation differs from signal addition operation. It adds all sample

values of ๐‘ฅ(๐‘›) between ๐‘›1 and ๐‘›2.

It is implemented by the ๐‘ ๐‘ข๐‘š(๐‘ฅ(๐‘›1: ๐‘›2)) function.

16

Page 17: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

7. Sample products:

This operation also differs from signal multiplication operation. It

multiplies all sample values of ๐‘ฅ(๐‘›) between ๐‘›1 and ๐‘›2.This operation

differs from signal addition operation. It adds all sample values of ๐‘ฅ(๐‘›)between ๐‘›1 and ๐‘›2.

It is implemented by the ๐‘๐‘Ÿ๐‘œ๐‘‘(๐‘ฅ(๐‘›1: ๐‘›2)) function.

17

Page 18: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Operations On Sequences (Cont.)

8. Signal energy:

The energy of a sequence x(n) is given by

where superscript (โˆ—) denotes the operation of complex conjugation.

The energy of a finite-duration sequence ๐‘ฅ(๐‘›) can be computed in

MATLAB using

18

Page 19: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

OPERATIONS ON SEQUENCES (Cont.)

9. Signal power:

The average power of a periodic sequence ๐‘ฅ(๐‘›) with fundamental period ๐‘is given by

19

Page 20: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #1

20

Page 21: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #1 - Solution

21

Page 22: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #1 - Solution

22

Page 23: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #1 - Solution

23

Page 24: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #1 - Solution

24

Note that over the given interval, the sequence หœx (n) has four periods.

Page 25: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #2

25

Page 26: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #2 - Solution

26

Page 27: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #3

27

Page 28: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #3 - Solution

28

Page 29: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Even and odd synthesis

A real-valued sequence x e (n) is called even (symmetric) if

๐‘ฅ๐‘’(โˆ’๐‘›) = ๐‘ฅ๐‘’(๐‘›)

Similarly, a real-valued sequence x o (n) is called odd (antisymmetric) if

๐‘ฅ๐‘œ(โˆ’๐‘›) = โˆ’๐‘ฅ๐‘œ(๐‘›)

Then any arbitrary real-valued sequence x(n) can be decomposed into

its even and odd components

๐‘ฅ(๐‘›) = ๐‘ฅ๐‘’(๐‘›) + ๐‘ฅ๐‘’(๐‘›)

where the even and odd parts are given by

๐‘ฅ๐‘’ ๐‘› =1

2๐‘ฅ ๐‘› + ๐‘ฅ โˆ’๐‘› ๐‘Ž๐‘›๐‘‘ ๐‘ฅ๐‘œ(๐‘›) =

1

2[๐‘ฅ(๐‘›) โˆ’ ๐‘ฅ(โˆ’๐‘›)]

29

Page 30: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Even and odd synthesis

Using MATLAB operations discussed so far, we can obtain the following

๐‘’๐‘ฃ๐‘’๐‘›๐‘œ๐‘‘๐‘‘ function.

30

Page 31: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

EXAMPLE #4 with Solution

31

Page 32: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete Time Systems

32

Page 33: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete Time Systems

A discrete-time system (or discrete system for short) is described as an

operator T[ ยท ] that takes a sequence x(n) (called excitation) and

transforms it into another sequence y(n) (called response). That is,

๐‘ฆ(๐‘›) = ๐‘‡[๐‘ฅ(๐‘›)]

1. LINEAR SYSTEMS:

A discrete system T[ ยท ] is a linear operator L[ ยท ] if and only if L[ ยท ]

satisfies the principle of superposition, namely,

๐ฟ ๐‘Ž1๐‘ฅ1 ๐‘› + ๐‘Ž2๐‘ฅ2 ๐‘› = ๐‘Ž1๐ฟ ๐‘ฅ1 ๐‘› + ๐‘Ž2๐ฟ[๐‘ฅ2(๐‘›)], โˆ€๐‘Ž1, ๐‘Ž2, ๐‘ฅ1 ๐‘› , ๐‘ฅ1 ๐‘›

33

Page 34: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete Time Systems (Cont.)

2. Linear time-invariant (LTI) system:

A linear system in which an input-output pair, x(n) and y(n), is invariant to a

shift k in time is called a linear time-invariant system i.e.,

๐‘ฆ(๐‘›) = ๐ฟ[๐‘ฅ(๐‘›)] โ‡’ ๐ฟ[๐‘ฅ(๐‘› โˆ’ ๐‘˜)] = ๐‘ฆ(๐‘› โˆ’ ๐‘˜)

For an LTI system the L[ยท] and the shifting operators are reversible as shown here.

Let x(n) and y(n) be the input-output pair of an LTI system. Then the output is

given by the convolution:

๐‘ฆ ๐‘› = ๐ฟ๐‘‡๐ผ ๐‘ฅ ๐‘› = ๐‘ฅ ๐‘› โˆ— โ„Ž(๐‘›) =

๐‘˜=โˆ’โˆž

โˆž

๐‘ฅ(๐‘˜)โ„Ž(๐‘› โˆ’ ๐‘˜)

34

Page 35: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete Time Systems (Cont.)

3. Stability:

The primary reason for considering stability is to avoid building harmful

systems or to avoid burnout or saturation in the system operation.

A system is said to be bounded-input bounded-output (BIBO) stable if

every bounded input produces a bounded output.

| ๐‘ฅ(๐‘›) | < โˆž โ‡’ | ๐‘ฆ(๐‘›) | < โˆž ,โˆ€ ๐‘ฅ, ๐‘ฆ

An LTI system is BIBO stable if and only if its impulse response is

absolutely summable.

๐ต๐ผ๐ต๐‘‚ ๐‘†๐‘ก๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ โ‡โ‡’

โˆ’โˆž

โˆž

| โ„Ž(๐‘›) | < โˆž

35

Page 36: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Discrete Time Systems (Cont.)

4. Causality:

This important concept is necessary to make sure that systems can be

built. A system is said to be causal if the output at index ๐‘›0 depends only

on the input up to and including the index ๐‘›0; that is, the output does not

depend on the future values of the input.

An LTI system is causal if and only if the impulse response

โ„Ž(๐‘›) = 0, ๐‘› < 0

36

Page 37: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Convolution

MATLAB does provide a built-in function called conv that computes the

convolution between two finite-duration sequences. The conv function

assumes that the two sequences begin at n = 0 and is invoked by

Example #5:

Let the rectangular pulse ๐‘ฅ(๐‘›) = ๐‘ข(๐‘›) โˆ’ ๐‘ข(๐‘› โˆ’ 10) of Example 2.4 be an

input to an LTI system with impulse response โ„Ž(๐‘›) = (0.9)๐‘›๐‘ข(๐‘›) .

Determine the output y(n).

Solution:

37

Page 38: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Convolution (Cont.)

A simple modification of the conv function, called ๐‘๐‘œ๐‘›๐‘ฃ_๐‘š , which

performs the convolution of arbitrary support sequences can now be

designed.

38

Page 39: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #6

Given the following two sequences

๐‘ฅ ๐‘› = 3, 11, 7, 0,โˆ’ 1, 4, 2 , โˆ’ 3 โ‰ค ๐‘› โ‰ค 3;

โ„Ž(๐‘›) = [2, 3, 0,โˆ’ 5, 2, 1], โˆ’ 1 โ‰ค ๐‘› โ‰ค 4

determine the convolution y(n) = x(n) โˆ— h(n).

Solution:

39

โ†‘

โ†‘

Page 40: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Sequence Correlations Revisited

The crosscorrelation ๐‘Ÿ๐‘ฅ๐‘ฆ(โ„“ ) can be put in the form

๐‘Ÿ๐‘ฅ๐‘ฆ(โ„“ ) = ๐‘ฆ(โ„“) โˆ— ๐‘ฅ(โˆ’โ„“)

The autocorrelation ๐‘Ÿ๐‘ฅ๐‘ฅ(โ„“ ) in the form

๐‘Ÿ๐‘ฅ๐‘ฅ(โ„“ ) = ๐‘ฅ(โ„“) โˆ— ๐‘ฅ(โˆ’โ„“)

Therefore these correlations can be computed using the ๐‘๐‘œ๐‘›๐‘ฃ_๐‘š

function if sequences are of finite duration.

40

Page 41: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #7

Let ๐‘ฅ(๐‘›) = [3, 11, 7, ๐ŸŽ,โˆ’ 1, 4, 2] be a prototype sequence, and let ๐‘ฆ(๐‘›)

be its noise-corrupted-and-shifted version ๐‘ฆ(๐‘›) = ๐‘ฅ(๐‘› โˆ’ 2) + ๐‘ค(๐‘›)

where w(n) is Gaussian sequence with mean 0 and variance 1. Compute

the crosscorrelation between y(n) and x(n).

Solution:

let us compute the crosscorrelation using two different noise sequences.

41

Page 42: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #7 - Solution

42we observe that the crosscorrelation indeed peaks at โ„“ = 2, which implies that y(n) is similar to x(n) shifted by 2. This approach can be used in applications like radar signal processing in identifying and localizing targets.

Page 43: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Sequence Correlations Revisited

Note that the signal-processing toolbox in MATLAB also provides afunction called xcorr for sequence correlation computations. In itssimplest form.

computes the crosscorrelation between vectors x and y, while

computes the autocorrelation of vector x. It generates results that areidentical to the one obtained from the proper use of the conv mfunction.

However, the ๐‘ฅ๐‘๐‘œ๐‘Ÿ๐‘Ÿ function cannot provide the timing (or lag)information (as done by the ๐‘๐‘œ๐‘›๐‘ฃ_๐‘š function), which then must beobtained by some other means.

43

Page 44: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Difference Equations

An LTI discrete system can also be described by a linear constant coefficient

difference equation of the form

If ๐‘Ž๐‘ โ‰  0, then the difference equation is of order ๐‘. This equation describes a

recursive approach for computing the current output, given the input values

and previously computed output values. In practice this equation is computed

forward in time, from ๐‘› = โˆ’โˆž to ๐‘› = โˆž.

Therefore another form of this equation is

44

Page 45: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Difference Equations (Cont.)

A solution to this equation can be obtained in the form

๐‘ฆ(๐‘›) = ๐‘ฆ๐ป(๐‘›) + ๐‘ฆ๐‘ƒ(๐‘›)

The homogeneous part of the solution, ๐‘ฆ๐ป(๐‘›) , is given by

๐‘ฆ๐ป(๐‘›) =

๐‘˜=1

๐‘

๐ถ๐‘˜ ๐‘ง๐‘˜๐‘›

where ๐‘ง๐‘˜, ๐‘˜ = 1, . . . , ๐‘ are ๐‘ roots (also called natural frequencies) of thecharacteristic equation

0

๐‘

๐‘Ž๐‘˜ ๐‘ง๐‘˜ = 0

This characteristic equation is important in determining the stability ofsystems. If the roots ๐‘ง๐‘˜ satisfy the condition

|๐‘ง๐‘˜| < 1, ๐‘˜ = 1, . . . , ๐‘

45

Page 46: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

MATLAB Implementation

A function called ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ is available to solve difference equationsnumerically, given the input and the difference equation coefficients. Inits simplest form this function is invoked by

where

are the coefficient arrays from the difference equation, and ๐‘ฅ is theinput sequence array. The output ๐‘ฆ has the same length as input ๐‘ฅ. Onemust ensure that the coefficient ๐‘Ž0 not be ๐‘ง๐‘’๐‘Ÿ๐‘œ.

To compute and plot impulse response, MATLAB provides the function๐‘–๐‘š๐‘๐‘ง. When invoked by

fgdg

46

Page 47: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #8

Given the following difference equation

๐‘ฆ(๐‘›) โˆ’ ๐‘ฆ(๐‘› โˆ’ 1) + 0.9๐‘ฆ(๐‘› โˆ’ 2) = ๐‘ฅ(๐‘›); โˆ€ ๐‘›

a. Calculate and plot the impulse response โ„Ž(๐‘›) at ๐‘› = โˆ’ 20, . . . , 100.

b. Calculate and plot the unit step response ๐‘ (๐‘›) at ๐‘› = โˆ’ 20, . . . , 100.

c. Is the system specified by โ„Ž(๐‘›) stable?

47

Page 48: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #8 - Solution

From the given difference equation the coefficient arrays are

a. MATLAB script:

b. MATLAB script:

48

Page 49: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Example #8 โ€“ Solution (Cont.)

c. To determine the stability of the system, we have to determine h(n)

for all n. Although we have not described a method to solve the

difference equation,

we can use the plot of the impulse response to observe that h(n) is

practically zero for ๐‘› > 120. Hence the sum |โ„Ž(๐‘›)| can be determined from

MATLAB using

โ€ข which implies that the system is stable.

An alternate approach using MATLABโ€™s roots function.

โ€ข Since the magnitudes of both roots are less than one, the system is stable.49

Page 50: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

Digital Filters

Filter is a generic name that means a linear time-invariant system

designed for a specific job of frequency selection or frequency

discrimination. Hence discrete-time LTI systems are also called digital

filters. There are two types of digital filters.

FIR

IIR

50

Page 51: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

FIR Digital Filters If the unit impulse response of an ๐ฟ๐‘‡๐ผ system is of finite duration, then the

system is called a finite-duration impulse response (or๐‘ญ๐‘ฐ๐‘น) filter. Hence for an๐‘ญ๐‘ฐ๐‘น filter โ„Ž(๐‘›) = 0 for ๐‘› < ๐‘›1 and for ๐‘› > ๐‘›2.

The difference equation that describes a causal FIR filter is:

๐‘ฆ(๐‘›) =

๐‘š=0

๐‘€

๐‘๐‘š ๐‘ฅ ๐‘› โˆ’ ๐‘š

Furthermore, โ„Ž(0) = ๐‘0 , โ„Ž(1) = ๐‘1, . . . , โ„Ž(๐‘€) = ๐‘๐‘€, while all other โ„Ž(๐‘›)โ€™s are 0.

FIR filters are also called Nonrecursive or moving average (MA) filters.

In MATLAB ๐‘ญ๐‘ฐ๐‘น filters are represented either as impulse response values {โ„Ž(๐‘›)} or asdifference equation coefficients {๐‘๐‘š} and {๐‘Ž0 = 1} .

Therefore to implement ๐‘ญ๐‘ฐ๐‘น filters, we can use either the ๐‘๐‘œ๐‘›๐‘ฃ(๐‘ฅ, โ„Ž) function (andits modification that we discussed) or the ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ(๐‘, 1, ๐‘ฅ) function.

There is a difference in the outputs of these two implementations that should benoted. The output sequence from the ๐‘๐‘œ๐‘›๐‘ฃ(๐‘ฅ, โ„Ž) function has a longer length thanboth the ๐‘ฅ(๐‘›) and โ„Ž(๐‘›) sequences. On the other hand, the output sequence from the๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ(๐‘, 1, ๐‘ฅ) function has exactly the same length as the input ๐‘ฅ(๐‘›) sequence. Inpractice (and especially for processing signals) the use of the filter function isencouraged. 51

Page 52: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

IIR Digital Filters If the impulse response of an LTI system is of infinite duration, then the system is

called an infinite-duration impulse response (or IIR) filter.

The following part of the general IIR difference equation:

๐‘›=0

๐‘

๐‘Ž๐‘› ๐‘ฆ ๐‘› โˆ’ ๐‘š = ๐‘ฅ(๐‘›)

Describe a recursive filter in which the output y(n) is recursively computed from itspreviously computed values and is called an autoregressive (AR) filter. The impulseresponse of such filter is of infinite duration and hence it represents an IIR filter.

The general IIR difference equation is:

๐‘›=0

๐‘

๐‘Ž๐‘› ๐‘ฆ ๐‘› โˆ’ ๐‘š =

๐‘š=0

๐‘€

๐‘๐‘š ๐‘ฅ ๐‘› โˆ’ ๐‘š

It has two parts: an AR part and an MA part. Such an IIR filter is called anautoregressive moving average, or an ARMA, filter. In MATLAB, IIR filters aredescribed by the difference equation coefficients {๐‘๐‘š} and {๐‘Ž๐‘˜} and areimplemented by the ๐‘“๐‘–๐‘™๐‘ก๐‘’๐‘Ÿ(๐‘, ๐‘Ž, ๐‘ฅ) function.

52

Page 53: DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems

53


Recommended