• 沒有找到結果。

Digital signal processing basics

CHAPTER 3. THEORETICAL PRELIMINARIES OF SIGNAL PROCESSING PROCESSING

3.2 Digital signal processing basics

Under-sampling a continuous-time signal can introduce a distortion into the signal, which is generally referred to as “aliasing” (a relatively high-frequency component in the analog input signal appears at a lower frequency in the reconstructed output signal). Nyquist showed that sampling rate must exceed two-times of the cutoff frequency of the bandlimited signal to fully recover the continuous signal. Let x tc

( )

be continuous and bandlimited signal with

( )

0 for

c N

X jΩ = Ω ≥ Ω , (3. 13)

where Ω is the cutoff frequency and also referred to as the Nyquist frequency. N

c

( )

may be desirable because interpolation during singnal alignment can degrade resolution. Oversampling is also required if you intend to use deconvolution to increase resolution; the final deconvolved signal must also meet the Nyquist Sampling Criterion.

Many of the phenomena studied in engineering and science are periodic in nature eg. the sound signal in an alternating current circuit. These periodic functions can be analysed into their constituent components (fundamentals and harmonics) by a process called Fourier analysis. We are aiming to find an approximation using trigonometric functions for various square, saw tooth, etc waveforms that occur in electronics. We do this by adding more and more trigonometric functions together.

The sum of these special trigonometric functions is called the Fourier series. The Fourier series was shown as a way of representing the spectrum of a periodic signalas a series of discrete line sin the frequency-domain. In this module, the concept of the Fourier transform will be introduced and applied to nonperiodic functions. The Fourier transform defines a relationship between a signal in the time-domain and its representation in the frequency-domain. Summary of Fourier series and transform relations is shown in Table 1.

A transfer function (TF) is a mathematical representation, in terms of spatial or temporal frequency, of the relation between the input and output of a linear time-invariant system. With optical imaging devices, for example, it is the Fourier

transform of the point spread function. Let ( )x t is the input and ( )y t is the output.

If a complex harmonic signal with a sinusoidal component with amplitude X , angular frequency ω and phase arg( )X

( arg( ))

( ) j t j t X

x t = Xeω = X e ω+ , (3. 19)

where X = X ejarg( )X is input to a linear time-invariant system. Frequency response function (FRF) is the measure of any system output spectrum in response to an input signal. The frequency response (H jω) describes this change for every frequency ω in terms of gain:

The TF can also be shown using the Fourier transform which is only a special case of the bilateral Laplace transform for the case where s= jω.

The impulse response, or impulse response function (IRF), of a dynamic system is its output when presented with a brief input signal, called an impulse. The Laplace transform of the IRF is known as the TF. It is usually easier to analyze

systems using TFs as opposed to IRFs. The Laplace transform of a system output may be determined by the multiplication of the TF with the input function in the complex plane, also known as the frequency domain. An inverse Laplace transform of this result will yield the output function in the time domain. In array applications, impulse responses enable the acoustic characteristics of a location.

Infinite impulse response (IIR) filter is a type of a signal processing filter whose impulse response is of infinite length of time. This is in contrast to finite impulse response (FIR) filters, which have fixed-duration impulse responses. Direct-form IIR filters are often described and implemented in terms of the difference equation that defines how the output signal is related to the input signal:

1 0 order, b are the feedforward filter coefficients, ′i Λ is the feedback filter order and ai are the feedback filter coefficients. The direct-form Ⅰ structure is shown in Fig.

12 and the direct-form Ⅱ structure is shown in Fig. 13. The corresponding rational system function is

A FIR filter is a type of a signal processing filter whose impulse response is of finite duration, because it settles to zero in finite time. Direct-form FIR filters are described by the following difference equation, which defines the output ( )y n in terms of its input ( )x n :

( ) i ( )

i

y n =

Λ b x n i, (3. 24)

where x n is the input signal, ( )( ) y n is the output signal, b are the filter i coefficients and Λ is the filter order. This can be recongnized as the discrete convolution of ( )x n with the impulse response

Convolution is the mathematical process that relates the output ( )y t of a linear, time-invariant system to its input ( )x t , and impulse response ( )h t . The output is

( ) ( )* ( ) ( )* ( )

y t =x t h t =h t x t , (3. 26)

where “*” represents the commutative convolution operation. For two finite discrete sequences of length N and x N , the linear or aperiodic convolution sum takes on a h slightly different form defined intervals. For Nx >Nh, each summation need only be calculated for the

0≤knNh− terms. The output ( )1 y n will have length Nx+Nh− . In 1 frequency domain convolution, multiplication in the frequency domain translates to circular convolution in the time domain in the discrete case. The output is

( ) ( ( ))f ( ( ) ( ))f f

y n =IFFT Y n =IFFT X n H n , (3. 28)

where n is the discrete frequency variable and IFFT is inverse FFT. In the Block f convolution using the overlap-add method (OAD) as shown in Fig. 15, the input blocks need not be precisely N samples long. But it is generally a good idea to h keep NxΛ on the order of N to avoid unnecessarily long block convolutions. The h overlap between block outputs must remain Nh1, regardless. Mathematically,

( )

x n and ( )y n can be represented as

block block the OAD, the overlap-save method (OAS) requires that the input blocks overlap as shown in Fig. 16. Then the input blocks are circularly convolved with the impulse response. Because of the overlap redundancy at the input, the circular artifacts in the output (the first Nh− samples) can simply be discarded. Mathematically, 1 symbolic representations of ( )x n and ( )y n are rather cumbersome, but can be

where (*) denotes circular convolution. The output is

0 1 2

( ) ( ) | ( ) |f f ( ) |f

y n = y n y n y n , (3. 33)

where " | " denotes concatenation and m indexes the last Nblock−(Nh− samples of 1) each block.

In digital signal processing, time delay is common problem. The delay usually is not an integer in digital signal processing. There are many ways to deal with these fractional delay problems. The simplest approach is Lagrange interpolation method.

Firstly we divide τm by sampling period T to acquire the fractional delay Ψ . m

The delay is separated into two parts

m m Dm em

T

τ = Ψ = + , (3. 34)

where D and m e are the integer and fractional component of m Ψ , respectively. m FIR filter coefficients to implement the Lagrange interpolation can be calculated by

0

The case N =1 corresponds to the linear interpolation using two samples.

In signal processing, the Wiener filter is a filter. Its purpose is to reduce the amount of noise present in a signal by comparison with an estimation of the desired noiseless signal. A Wiener filter is not an adaptive filter because the theory behind this filter assumes that the inputs are stationary.

The input to the Wiener filter is assumed to be a signal ( )x t corrupted by

function of ˆ( )x t and ( )x t . The goal is to minimize E e by finding the optimal { }2 ( )

h t that is the Wiener filter IRF.

The Wiener filter problem has solutions for three possible cases. Firstly, non-causal filter is acceptable. Next, causal filter is desired. Finally, finite amount of past data is used. The first case is simple to solve but is not suited for real-time applications. The non-causal solution is

ˆ, ( )

Provided that ( )h t is optimal, then the minimum mean-square error equation reduces to

The causal FIR Wiener filter, instead of using some given data matrix X and output vector Y , finds optimal tap weights by using the statistics of the input and output signals. It populates the input matrix X with estimates of the auto-correlation of the input signal T and populates the output vector Y with estimates of the cross-correlation between the output and input signals V.

In order to derive the coefficients of the Wiener filter, we consider a signal ( )w n being fed to a Wiener filter of order Λ and with coefficients , 0, ,a ii = … Λ. The output of the filter is denoted ( )x n which is given by the expression

0 Wiener filter is designed so as to minimize the mean square error (MMSE) which can be stated concisely as follows:

arg min { ( )}2

ai = E e n , (3. 44)

where { }e i denote the expectation operator. In the general case, the coefficients a may be complex and may be derived for the case where i w n and ( )( ) v n are complex as well. For simplicity, we will only consider the case where all these quantities are real. The mean square error may be rewritten as:

2 2

The derivative of the MSE may therefore be rewritten as

2

Letting the derivative be equal to zero, we obtain

0

which can be rewritten in matrix form

=

These equations are known as the Wiener-Hopf equations. The matrix T appearing in the equation is a symmetric Toeplitz matrix. These matrices are known to be positive definite and therefore non-singular yielding a unique solution to the determination of the Wiener filter coefficient vector a T v . = 1

Least mean squares (LMS) algorithms are a class of adaptive filter used to mimic a desired filter by finding the filter coefficients that relate to producing the LMS of the error signal. Most linear adaptive filtering problem is shown in Fig. 17. That is, an unknown system H z is to be identified and the adaptive filter attempts to adapt ( ) the filter ˆ ( )H z to make it as close as possible to H z , while using only observable ( ) signals ( )x n ( )d n and ( )e n ; but ( )y n , ( )v n and ˆ( )y n are not directly observable. Its solution is closely related to the Wiener filter. The idea behind LMS filters is to use steepest descent to find filter weights H n which minimize a ( ) cost function. We start by defining the cost function as

{

2

}

( )n E e n( )

ξ = , (3. 51)

where E i

{ }

denotes the expected value.

The objective of the adaptive filter is to minimize the instantaneous mean square error and according to LMS algorithm updating the coefficient vector in the negative direction with step size µ:

( 1) ( ) ˆ

h n′ + =h n′ −μ2 ∇ , ξ (3. 52)

where μ/ 2 is the step size, is the gradient operator, ∇ξˆ is an instantaneous estimate of

That means we have found a sequential update algorithm which minimizes the cost function. For most systems the expectation function E

{

x( ) ( )n e n*

}

must be

approximated. This can be done with the following unbiased estimator

{

*

}

1 *

where N indicates the number of samples we use for that estimate. The simplest case is N =1

{

*

}

*

ˆ ( ) ( ) ( ) ( )

E x n e n =x n e n . (3. 56)

For that simple case the update algorithm follows as ˆ *

( 1) ( ) ( ) ( )

h n′ + =h n + xμ n e n . (3. 57)

Indeed this constitutes the update algorithm for the LMS filter.

The purposed of Kalman filter is to use measurements that are observed over time that contain noise and other inaccuracies, and produce values that tend to be closer to the true values of the measurements and their associated calculated values.

There are two equations in Kalman filtering. The first equation is called the process equation:

(n+ =1) (n+1, ) ( )n n + 1( )n

x F x v , (3. 58)

where (F n+1, )n is a known M M× state transition matrix relating the state of the

system at times n+1 and n. The M× vector 1 v1( )n represents process noise.

The vector v1( )n is a zero-mean, white-noise process whose correlation matrix is defined by

The second equation is called the measurement equation:

( ) ( ) ( ) 2( )

y n =C n x n +v n (3. 60)

where C( )n is a known N M× measurement matrix. The N×1 vector v2( )n is the measurement noise modeled as a zero-mean, white-noise process whose correlation matrix is defined by

2

Table 1 Summary of Fourier series and transform relations.

Continuous time Discrete time

Time-domain Frequency-domain Time-domain Frequency-domain Fourier

Table 2 FIR filter coefficients to implement Lagrange interpolation for N =1 and 2

N = .

0

w m w m1 w m2

1

N = 1− em e m

2

N = (em−1)(em−2) / 2 −e em( m− 2) e em( m−1) / 2

Fig. 12 Signal flow graph of direct-form Ⅰ IIR structure.

z1

z1

z1

z1

z1

z1

b 0

b 1

b 2

bΛ−1

bΛ

a1

a2

aΛ −1

aΛ ( )

x n x n′( ) y n ( )

Fig. 13 Signal flow graph of direct-form Ⅱ IIR structure.

( )

x n y n ( )

b0

b1

b2

bΛ−1

bΛ z1

z1

z1

a 1

a 2

aΛ −1

aΛ

( ) x n′′

Fig. 14 Direct-form realization of an FIR system.

z1 z1 z1

(0)

h h(1) h(2) h(Λ −1) h( )Λ

( ) x n

( ) y n

Fig. 15 Block convolution using the OAD. (a) input ( )x n , (b) impulse

of x n and 2( ) h n , (f) output ( ) y n for block convolution of 3( ) x n and 3( ) ( )

h n , (g) shifted block outputs, overlap is Nh− = , and (h) the sum of 1 2 overlapped block outputs equivalent to the direct convolution result.

Fig. 16 Block convolution using the OAS. (a) input signal ( )x n divided into

output y n using direct convolution, (d) output ( ) y n for block circular 1( ) convolution of x n and 1( ) h n , (e) output ( ) y n for block circular 2( ) convolution of x n and 2( ) h n , (f) output ( ) y n for block circular 3( ) convolution of x n and 3( ) h n , (g) output ( ) y n for block circular 4( ) convolution of x n and 4( ) h n , and (h) sequential concatenation of block ( ) outputs after discarding the first two samples of each block, which is equivalent to the direct convolution result. "|" represents concatenation.

Fig. 17 LMS block diagram.