digital signal processing

36
DIGITAL SIGNAL PROCESSING (DSP) SIGNAL PROCESSING

Upload: shaji-joseph

Post on 14-Nov-2014

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Signal Processing

DIGITAL SIGNAL PROCESSING (DSP)

SIGNAL PROCESSING

Page 2: Digital Signal Processing

Topics• Continuous time (CT) and Discrete time (DT) signals• Periodic and pulse signals• Energy and power in signals• Standard CT and DT signals• Impulse, step, pulse, ramp, sine and exponential• Analysis of CT signals• Fourier Series and Fourier Transforms• Convolution and Correlation• Analysis of DT signals• Discrete Fourier Transform of DT signals• Fast Fourier Transform• Z Transform• Digital filtering in time domain• Linear Filters• FIR Filters• IIR Filters

Page 3: Digital Signal Processing

SIGNAL

• A signal is defined as any physical quantity that varies with time, space or any other independent variable or variables.

• Mathematically, a signal can be represented as a function of one or more independent variables.

S1(t) = 7t

S2(t) = 18t2.

Here S1(t) and S2(t) represents two signals- one that varies linearly with time t and the other varies quadratically with t.

• Complex signals are there which cannot be expressed by simple mathematical equations. (eg: speech signal, ECG , EEG…)

SIGNAL

Analog Discrete and Digital

Page 4: Digital Signal Processing

Analog signals

Analog signal processor

Analog Input Signal

Analog Output Signal

• Analog signals are continuous function of an independent variable, such as time, space etc.

Analog System

• It is defined for every instant of independent variable, so the magnitude is continuous in the specified range for analog signals.

• Both magnitude of signal and independent variable are continuous.

• Signals can be easily processed directly by appropriate analog systems.

Page 5: Digital Signal Processing

DIGITAL SIGNAL PROCESSING (DSP)

• The Digital Signal processing is the processing of signals by digital systems.

• The digital systems are either software, hardware or firmware.

• In digital processing of signal on a digital computer, the operation performed on a signal consists of a number of mathematical operations as specified by a software program.

• Program represents an implementation of system in software

• Digital hardware (logic circuits) also can be used as system in hardware to perform the desired operations.

A / D Converter

Digital Signal Processor

D / A Converter

Analog Input Signal

Digital Input Signal

Digital Output Signal

Analog Output Signal

Page 6: Digital Signal Processing

Advantages of DSP:

Flexibility : Digital programmable system allow flexibility in reconfiguring the DSP operations by simply changing the program

Accuracy : DSP provides better control of accuracy requirements, while tolerance limits has to be met in the analog counterpart

Easy Storage : Digital signals can be easily stored in magnetic media without deterioration or loss of signal fidelity. They can also be easily transported and processed off-time in remote laboratories.

Processing : DSP allows for the implementation of more sophisticated signal processors than its analog counterparts.

Cost effective : With advancement in VLSI technology the digital implementation of the signal processing system is cheaper.Limitations of DSP:

1. The conversion speed of ADC and the processing speed of signal processors should be very high to perform all real time processing

2. Signals of high bandwidth require fast sampling rate ADCs and fast processors.

Page 7: Digital Signal Processing

Applications of DSP:

Speech Processing : Speech compression & decompression for voice storage system and for transmission & reception of voice signals. Speech synthesis in message warning systems.

Communication : Elimination of noise by filtering and echo cancellation by adaptive filtering in transmission channels.

Biomedical : Spectrum analysis of ECG signals to identify various disorders in heart. Spectrum analysis of EEG signals to study the malfunctions or disorders in the brain.

Consumer electronics : Music synthesis, Karoake systems, Surround sound systems, Digital audio & video.

Seismology : Spectrum Analysis of seismic signals (I.e. signals generated by movement of rocks) can be used to predict the Earthquake, Volcanic eruptions, Nuclear explosions and Earth movement.

Image processing : Two different filtering on images for image enhancement, finger print matching, identifying hidden images in the signals received by radars etc.

Page 8: Digital Signal Processing

DISCRETE TIME SIGNALS

A discrete time signal x(n) is a function of an independent variable where the independent variable is an integer.

Signal x(n) is not defined for non-integer values of n.

A discrete time signal is defined for every integer value of ‘n’ in the range - < n <

Methods of representing Discrete Time signal

1. Functional representation

x(n) = -1 ; n = -2

2 ; n = -1

1.5 ; n = 0

-0.9 ; n = 1

1.4 ; n = 2

1.6 ; n = 3

0 ; other n

2. Graphical representation

x(n)

- 1

-2 -1 0 1 2 3

2

1.5 1.41.6

0.9

Page 9: Digital Signal Processing

3. Tabular representation

n -2 -1 0 1 2 3

x(n) -1 2 1.5 -0.9 1.4 1.6

4. Sequence representation

An infinite duration signal or sequence with the time origin (n = 0) indicated by the symbol is represented as

x(n) = {… -1, 2, 1.5, -0.9, 1.4, 1.6 …}

Some Elementary Discrete Time signals

1. Digital impulse signal or unit sample sequence

Impulse signal, δ(n) =1 ; n ≥ 0

0 ; n ≠ 0

δ(n)

n

1

0

Page 10: Digital Signal Processing

Delayed impulse δ1(n) = δ(n – n0) =1 ; n ≥ 0

0 ; n ≠ 0

δ1(n)

n

1

n0

Delayed impulse signal

2. Unit Step signal

Unit step signal, u(n) =1 ; n ≥ 0

0 ; n < 0

u(n)

n

1

0

Unit step signal

The unit step signal is related to digital impulse by the summation relation

u(n) = Ʃ δ( n – k ) summation limit is k = 0 to infinity

Page 11: Digital Signal Processing

3. Ramp signal

Ramp signal, ur(n) =n ; n ≥ 0

0 ; n < 0

ur(n)

n

Ramp signal

4. Exponential signal

Exponential signal, g(n) =an ; n ≥ 0

0 ; n < 0

g(n)

n

Exponential signal

0 < a < 1

Page 12: Digital Signal Processing

Mathematical operations on Discrete Time signals

1. Shifting in time

A signal x(n) may be shifted in time by replacing the independent variable ‘n’ by ‘n-k’, where ‘k’ is an integer. If k is positive integer, the time shift results in a delay by k units of time. If k is negative integer, the time shift results in an advance of the signal by mod(k) units in time. The delay results in shifting each sample of x(n) to right. The advance results in shifting each sample of x(n) to left.

Eg:- Let x(n) = 1 ; n = 2

2 ; n = 3

3 ; n = 4

x(n)

0 1 2 3 4 5 6

12

3

Page 13: Digital Signal Processing

Let x1(n) = x(n-2), where x1 is delayed signal of x(n)

when n = 4; x1(4) = x(4-2) = x(2) = 1

when n = 5; x1(5) = x(5-2) = x(3) = 2

when n = 6; x1(6) = x(6-2) = x(4) = 3

x1(n)

0 1 2 3 4 5

12

3

6

Let x2(n) = x(n+2), where x2 is advanced signal of x(n)

when n = 0; x2(0) = x(0+2) = x(2) = 1

when n = 1; x2(1) = x(1+2) = x(3) = 2

when n = 2; x2(2) = x(2+2) = x(4) = 3

x2(n)

0 1 2 3 4 5 6

12

3

n

n

Page 14: Digital Signal Processing

2. Folding or reflection or Transpose

The folding of a signal x(n) is performed by changing the sign of the time base n in the signal x(n). The folding operation produces a signal x(-n) which is mirror of x(n) with respect to time origin n = 0.

Eg:- Let x(n) = n; -3 ≤ n ≤ 3. Now folded signal x1(n) = x(-n) = -n; -3 ≤ k ≤ 3

x (n)

0 1 2 3

-2-3 -1

n

x 1(n)

0

1 2 3

-2-3 -1 n

3. Amplitude scaling or scalar multiplication

Amplitude scaling of a signal by a constant A is accomplished by multiplying the value of every signal sample by A.

Let y(n) be amplitude scaled signal of x(n), then y(n) = Ax(n)

Page 15: Digital Signal Processing

Let x(n) = 20 ; n = 0 and A = 0.1, then y(n) = 2.0 ; n = 0

36 ; n = 1 3.6 ; n = 1

40 ; n = 2 4.0 ; n = 2

-15 ; n = 3 -1.5 ; n = 3

4. Time scaling or down sampling

In a signal, x(n), if n is replaced by λn, where λ is an integer, then it is called the scaling or down sampling.

Eg:- If x(n) = an; n ≥ 0; then x1(n) = x(2n) = an for even values of n

0 1 2 3 4 5

x(n)

n0 1 2 3 4 5

x1(n)

n

Page 16: Digital Signal Processing

5. Signal (vector) addition

The sum of two signals x1(n) and x2(n) is a signal y(n), whose value at any instant is equal to the sum of the samples of these two signals at that instant.

i.e. , y(n) = x1(n) + x2(n) ; -∞ < n < ∞

Eg:- Let x1(n) = {1, 2, -1, 2} and x2(n) = {-2, 1, 3, 1}

When n = 0; y(0) = x1(0) + x2(0) = 1 + (-2) = -1

When n = 1; y(1) = x1(1) + x2(1) = 2 + 1 = 3

When n = 2; y(2) = x1(2) + x2(2) = -1 + 3 = 2

When n = 3; y(3) = x1(3) + x2(3) = 2 + 1 = 3

y(n) = x1(n) + x2(n) = {-1, 3, 2, 3} 6. Product or vector multiplication

Signal multiplication results in the product of two signals on a sample – by – sample basis. The product of two signals x1(n) and x2(n) is a signal y(n), whose value at instant is equal to the product of the samples of these two signals at that instant. The product is also called modulation.

Page 17: Digital Signal Processing

Eg:- Let x1(n) = {1, 2, -1, 2} and x2(n) = {-2, 1, 3, 1}

When n = 0; y(0) = x1(0) x x2(0) = 1 x (-2) = -2

When n = 1; y(1) = x1(1) x x2(1) = 2 x 1 = 2

When n = 2; y(2) = x1(2) x x2(2) = -1 x 3 = -3

When n = 3; y(3) = x1(3) x x2(3) = 2 x 1 = 2

y(n) = x1(n) x x2(n) = {-2, 2, -3, 2}

Classification of Discrete Time signals

The discrete time signals are classified depending on their characteristics. Some ways of classifying discrete time signals are :

1.Energy signals and power signals

2.Periodic and aperiodic signals

3.Symmetric and antisymmetric signals

Page 18: Digital Signal Processing

1. Energy signals and power signals

The energy E of a signal x(n) is defined as

E = Ʃ |x(n)|2 , summation over n= -∞ to ∞

The energy of a signal may be finite or infinite, and can be applied to complex valued and real-valued signals. If E is finite (0 < E < ∞), then x(n) is called an energy signal.

The average power of a discrete time signal x(n) is defined as

P = lim (1/ (2N+1)) Ʃ |x(n)|2 limit is as n tends to infinity; ……….. 1

the summation is over n = -N to N

If we define the signal of x(n) over the finite interval –N ≤ n ≤ N as

EN = Ʃ |x(n)|2 ; Where summation is over n = -N to N…………. 2

Then we can express the signal energy E as,

E = lim EN ; as N tends to ∞ ………… 3

………… 1

Page 19: Digital Signal Processing

Then average power of the signal is

P = lim (1 / 2N+1) EN ……………. 4

If E is finite, then P = 0. If E is infinite, then P may be finite or infinite. If P is finite and non-zero, then the signal is called power signal.

Page 20: Digital Signal Processing

Fourier transform

In mathematics, the continuous Fourier transform is one of the specific forms of Fourier analysis. As such, it transforms one function into another, which is called the frequency domain representation of the original function (where the original function is often a function in the time-domain). In this specific case, both domains are continuous and unbounded. The term Fourier transform can refer to either the frequency domain representation of a function or to the process/formula that "transforms" one function into the other.

There are several common conventions for defining the Fourier transform of a complex-valued Lebesgue integrable function, x  In communications and signal processing, for instance, it is often the function:

  for every real number f

When the independent variable f represents time (with SI unit of seconds), the transform variable represents ordinary frequency (in hertz). If is Hölder continuous, then it can be reconstructed from X by the inverse transform:

  for every real number t

Page 21: Digital Signal Processing

FOURIER TRANSFORM OF DISCRETE TIME SIGNALS

The Fourier transform (FT) of discrete time signals is called discrete time fourier transform (DTFT).

Let x(n) = Discrete-time signal

X(ɷ) or X(eiɷ) = Fourier transform of x(n)

The fourier transform of a finite energy discrete time signal, x(n) is defined as

X(ɷ) = Ʃ e-jɷn , summation is over n = -infinity to +infinity

The Fourier transform is one of the several mathematical tools that is useful in the analysis and design of LTI (Linear Time Invariant) system. Another one is the Fourier Series. These signal representations basically involve the decomposition of the signals in terms of sinusoidal components. In such a decomposition, the signal is said to be represent in the frequency domain.

Page 22: Digital Signal Processing

To obtain the Fourier Transform representation, we shall start by finding the Fourier transformation of sampled Analog signal.

Let the sampled analog signal = xa*(t)Its Fourier transform is given by ,

F{xa*(t)} = - ʃ xa*(t) e-jωt dt (limit is from –infinity to +infinity)

Again this can be written as , = ʃ Σ xa (nT) δ(t-nT) e-jω(nT) dt (limit is from –infinity to +infinity)

= Σ ʃ xa(nT) e-jω(nT) δ(t-nT) dt

Using the shifting property of the impulse function,

F{xa*(T)} = Σ xa(nT) e-jω(nT)

Let x(n) = xa(nT)

We define the Fourier transform to be, F{xa*(t)} when T = 1

i.e., X(ejω) = F{x(n)} = Σ x(n) e-jωn at T = 1

Page 23: Digital Signal Processing

From the above equation, we find that X(ejω) is a complex no., and it consists of real part and imaginary part.

i.e., X(ejω) = XReal(ejω) + XImag(ejω)

| X(ejω) | = [ (XReal(ejω))2 + (XImag(ejω))2]

Phase angle, ϕ = tan-1[ XImag(ejω) / XReal(ejω) ]

1. Linearity

Fourier Transform Theorems and Properties

If x1(n) is Fourier transformed to X1(ejω)

and x2(n) ----------------- X2(ejω)

Then , ax1(n) + bx2(n) ----------------- aX1(ejω) + bX2(ejω)

Proof:F{ax1(n) + bx2(n)} = Σ(ax1(n) + bx2(n)) e-jωn

Page 24: Digital Signal Processing

= Σ ax1(n) e-jωn + Σ bx2(n) e-jωn

= a Σ x1(n) e-jωn + b Σ x2(n) e-jωn

= a X1(ejω) + b X2(ejω)2. Time Shifting Property

If x(n) ----------------- X(ejω)

Then , x(n-k) ----------------- e-jωk X(ejω)

Proof:

Let n-k = p

Then Fourier function, F{x(n-k)} = F{x(p)}

F{x(p)} = Σ x(p) e-jω(p+k)

F{x(p)} = Σ x(p) e-jωp e-jωk

F{x(p)} = e-jωk Σ x(p) e-jωp = e-jωk X(ejω) (limit is from p=-infinity to + infinity). Hence proved.

Page 25: Digital Signal Processing

3. Time Reversal

If x(n) ----------------- X(ejω)

Then , x(-n) ----------------- X(e-jω)

Proof:

Let -n = p

Then Fourier function, F{x(-n)} = F{x(p)}

F{x(p)} = Σ x(p) ejωp

F{x(p)} = X (e-jω) (limit is from p=-infinity to + infinity). Hence proved.

4. Convolution Theorem

If x1(n) ----------------- X1(ejω)

x2(n) ----------------- X2(ejω)

Page 26: Digital Signal Processing

Then , x1(n) * x2(n) ----------------- X1(ejω) * X2(ejω)

Proof:

x1(n) * x2(n) ----------------- Σ x1(k) * x2(n-k)(summation is from k=-infinity to + infinity)

Fourier transform,

x1(n) * x2(n) ----------------- Σ x1(n) * x2(n) e-jωn

(summation is from n=-infinity to + infinity)

= Σ Σ x1(k) * x2(n-k) e-jωn

(first summation is from k=-infinity to + infinity, second is over the same limit for n.)

= Σ x1(k) Σ x2(n-k) e-jωn

Put n-k = p

= Σ x1(k) Σ x2(p) e-jω(p+k)

(limit is for p = -infinity to + infinity)

= Σ x1(k) e-jωk Σ x2(p) e-jωp

= X1(ejω) * X2(ejω)

Page 27: Digital Signal Processing

5. Differentiation in frequency domain

If x(n) ----------------- X(ejω)

Then,

nx (n) ----------------- j d/dω {X2(ejω)}

Proof:

X (ejω) = Σ x (n) e-jωn

d/dω {X (ejω)} = - j Σ n x (n) e-jωn

j d/dω {X (ejω)} = Σ n x (n) e-jωn

Results:

X (ejω) = Σ x (n) e-jωn

Inverse Fourier Transform, x (n) = 1 / 2π ʃ X (ejω) ejωn dω

Page 28: Digital Signal Processing

linear time-invariant system are, of course, linearity and time invariance

Linear Time Invariant Systems

•Linearity means that the relationship between the input and the output of the system satisfies the superposition property. If the input to the system is the sum of two component signals:

then the output of the system will be

where a & b = any constant number where yn(t) is the output resulting from the sole input xn(t).

Page 29: Digital Signal Processing

•Time invariance means that whether we apply an input to the system now or T seconds from now, the output will be identical, except for a time delay of the T seconds. If the output due to input x(t) is y(t), then the output due to input x(t − T) is y(t − T). More specifically, an input affected by a time delay should effect a corresponding time delay in the output, hence time-invariant.

The fundamental result in LTI system theory is that any LTI system can be characterized entirely by a single function called the system's impulse response. The output of the system is simply the convolution of the input to the system with the system's impulse response. This method of analysis is often called the time domain point-of-view. The same result is true of discrete-time linear shift-invariant systems, in which signals are discrete-time samples, and convolution is defined on sequences.

Relationship between the time domain and the frequency domain

Page 30: Digital Signal Processing

Impulse ResponseThe impulse response of a system is its output when presented with a very brief input signal, an impulse. An impulse represents the limiting case of a pulse made very short in time while maintaining its area or integral (thus giving an infinitely high peak). While this is impossible in any real system, it is a useful concept as an idealization.A system in the class known as LTI systems (linear, time-invariant systems) is completely characterized by its impulse response.

 The Impulse response from a simple audio system. Showing the original impulse, with high

frequencies boosted, then with low frequencies boosted.

Page 31: Digital Signal Processing

Practical applications of Impulse response

• Loudspeakers

A very useful real application that demonstrates this idea was the development of impulse response loudspeaker testing in the 1980s which led to big improvements in loudspeaker design. Loudspeakers suffer from phase inaccuracy, a defect unlike normal measured properties like frequency response.

• Digital Filtering

Impulse response is a very important concept in the design of digital filters for audio processing, because these differ from 'real' filters in often having a pre-echo, which the ear is not accustomed to.

Impulse response analysis is a major facet of radar, ultrasound imaging, and many areas of digital signal processing. An interesting example would be broadband internet connections. Where once it was only possible to get 4 kHz speech signal over a local telephone wire, or data at 300 bit/s using a modem, it is now commonplace to pass 2 Mb/s over these same wires, largely because of 'adaptive equalisation' which processes out the time smearing and echoes on the line.

• Electronic processing

Page 32: Digital Signal Processing

FIR Systems

In FIR (Finite duration Impulse response) systems, the impulse response consists of finite number of samples. The convolution formula for FIR system is given by,

y(n) = Σ h(k) x(n-k)Where h(n) = 0; n < 0 and n ≥ N

From eqn 1 , it can be concluded that the impulse response selects only N samples of the input signal.

Thus, the system acts as a window that views only the most recent N input signal samples in forming the output. It neglects all prior input samples. So a FIR system has a finite memory of length N samples.

In general, a FIR system is described by the difference equation,

y(n) = Σ bk x(n-k)Where summation is over k = 0 to N-1

Let Z{y(n)} = Y(z); Z{x(n)} = X(z);

Z{x(n-k)} = z-k X(z)

……….……… 1

……….……… 2

Page 33: Digital Signal Processing

On taking Z transform of eqn 2, we get,

Y(z) = Σ bk z-k X(z)

Y(z) / X(z) = Σ bk z-k

H(z) = Y(z) / X(z) = Σ bk z-k = b0 + b1 z-1 +..+bN-1 z-(N-1)

Eqn 3 is the general form of transfer function of FIR system.

….……… 3

IIR Systems

In IIR (Infinite duration Impulse Response) systems, the impulse response has infinite number of samples. The convolution formula for IIR systems is given by,

y(n) = Σ h(k) x(n-k)Since, this sum involves the present and all the past input sample, we can say that the system has an infinite memory.

In general, an IIR system is described by the difference equation,

y(n) = - Σ ak y(n-k) + Σ bk y(n-k)

Where the first summation is from k=1 to N and the second summation is over k=0 to M

….……… 4

Page 34: Digital Signal Processing

Let Z{y(n)} = Y(z) ; Z{y(n-k)} = z-k Y(z)Let Z{x(n)} = X(z) ; Z{x(n-k)} = z-k X(z)

On taking Z-transform of eqn 4, we get,

Y(z) = - Σ ak z-k Y(z) + Σ bk z-k X(z)Y(z) + Σ ak z-k Y(z) = Σ bk z-k X(z)(1 + Σ ak z-k) Y(z) = Σ bk z-k X(z)

Y(z) / X(z) = Σ bk z-k / (1 + Σ ak z-k)

H(z) = Y(z) / X(z) = Σ bk z-k / (1+Σ ak z-k) = (b0 + b1 z-1 + b2 z-2 + .. + bM z-M) / (1 + a1 z-1 + a2 z-2 + .. + aN z-N)

The eqn 5 is the general form of transfer function of IIR System.

….……… 5

Page 35: Digital Signal Processing

Infinite Impulse Response (IIR)

Infinite impulse response (IIR) is a property of signal processing systems. Systems with that property are known as IIR systems or when dealing with electronic filter systems as IIR filters. They have an impulse response function which is non-zero over an infinite length of time. This is in contrast to finite impulse response filters (FIR) which have fixed-duration impulse responses.

The simplest analog IIR filter is an RC filter made up of a single resistor (R) feeding into a node shared with a single capacitor (C). This filter has an exponential impulse response characterized by an RC time constant.

Finite Impulse Response (FIR)

A finite impulse response (FIR) filter is a type of a digital filter. The impulse response, the filter's response to a Kronecker delta input, is 'finite' because it settles to zero in a finite number of sample intervals. This is in contrast to infinite impulse response filters which have internal feedback and may continue to respond indefinitely. An Nth order FIR filter has a response to an impulse that is N+1 samples in duration.

Page 36: Digital Signal Processing

Z - transform

In mathematics and signal processing, the Z-transform converts a discrete time-domain signal, which is a sequence of real or complex numbers, into a complex frequency-domain representation.

The Z-transform and advanced Z-transform were introduced (under the Z-transform name) by E. I. Jury in 1958 in Sampled-Data Control Systems (John Wiley & Sons). The idea contained within the Z-transform was previously known as the "generating function method".

The Z-transform, like many other integral transforms, can be defined as either a one-sided or two-sided transform.

Bilateral Z-transform

The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z) defined as

where n is an integer and z is, in general, a complex number:

z = Aejφ where A is the magnitude of z, and φ is the complex argument (also referred to as angle or phase) in radians.