40
7/27/2019 Analysis Toolpak FFT App Chp 12 http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 1/40 12-1 Chapter 12  Analysis ToolPak: FFT Applications What this chapter is about  Now that you know how to use the Fourier Analysis tool in EXCEL, let’s see how to apply it to five operations that are useful with real-world data. This chapter will enable you to perform feats of analysis on your computer that you could only dream about before the invention of the Fast Fourier Transform (FFT). First, we’ll briefly review some of the analytical concepts behind the numeri- cal methods. The main things we’ll do with the FFT are:  convolution (linear filtering of data),  deconvolution (removing system distortion and restoring a data set to its original form, approximately),  correlation (measuring similarity and time delay, detecting the presence of known signals in noise),  system identification (measuring properties of an unknown system, like safe cracking),  coherence and SNR functions (measuring the frequency range shared by signals and measuring signal/noise ratio as a function of frequency). 12.1 Step-function and impulse response There is an infinite variety of possible signals that you can use to probe a system. Of this infinite set some are more useful than others because of our ability to generate approximations to specific signals. This Chapter is optimized for running from th CD, assumed to be in Drive D: Hyperlinks may not function properly if this Chapter is run from another drive. The Work-  books folder must be in the same drive as this Chapter. If the hyperlinks do not operate automatically, you can run the related EXCEL file in manual operation in another window.

Analysis Toolpak FFT App Chp 12

Embed Size (px)

Citation preview

Page 1: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 1/40

12-1

Chapter 12 Analysis ToolPak:FFT Applications

What this chapter is about

 Now that you know how to use the Fourier Analysis tool in EXCEL, let’s see howto apply it to five operations that are useful with real-world data. This chapter will enable you to perform feats of analysis on your computer that you could onlydream about before the invention of the Fast Fourier Transform (FFT).

First, we’ll briefly review some of the analytical concepts behind the numeri-cal methods. The main things we’ll do with the FFT are:

•  convolution (linear filtering of data),

•  deconvolution (removing system distortion and restoring adata set to its original form, approximately),

•  correlation (measuring similarity and time delay, detecting

the presence of known signals in noise),

•  system identification (measuring properties of an unknownsystem, like safe cracking),

•  coherence and SNR functions (measuring the frequency

range shared by signals and measuring signal/noise ratio as afunction of frequency).

12.1 Step-function and impulse response

There is an infinite variety of possible signals that you can use to probe a system.Of this infinite set some are more useful than others because of our ability togenerate approximations to specific signals.

This Chapter is optimized for running from thCD, assumed to be in Drive D:Hyperlinks may not function properly if thisChapter is run from another drive. The Work- books folder must be in the same drive as thisChapter.If the hyperlinks do not operate automatically,you can run the related EXCEL file in manual

operation in another window.

Page 2: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 2/40

12-2 Chapter 12. Analysis ToolPak: FFT Applications

The sine wave, the unit step, the impulse (delta or  δ  ) function and random

noise have been found to be particularly useful. Sine waves are very narrow-spectrum signals; steps, impulses and noise are wide-spectrum signals.

✪✪✪✪ Step-function response

Before we discuss convolution let’s review the concepts of step-function re-sponse and impulse response. We will need these soon when we explore the con-volution process. A step function is sometimes called a Heaviside function after Oliver Heaviside, the eccentric English genius. The response to a step functioncompletely characterizes a linear system.

To illustrate these ideas in an easy way let's examine a familiar system. Con-

sider an  RC series circuit, input across  R and C , output across C , with the ca- pacitor fully discharged at t = 0. The product RC is the time constant .

Figure 12-1. When the switch S is in the up posi-tion the capacitor  C  charges through resistor  R .The battery supplies voltage V o to the RC  circuit.When the switch is in the down position the ca-pacitor discharges through the resistor.

For our present purposes let V = V o be a constant voltage. At t = 0 let’s putthe switch in the up position and add up the voltages,

q IRV  += . (12-1)

At t = 0, q = 0 and V = V o . We can include the initial conditions by means of a unit step function, u(t ), which has the properties that u(t ) is zero until t = 0 andafter that u(t ) = 1 forever. You can start the step function at any time t o by using

)( ot u , and you can form a pulse of length T  by using )( ot T u − . Since

dt dq I  /= Eq. (12-1) can be written as

oV t uC 

q

dt 

dq R )(=+ (12-2)

which has a particular solution oCV t ut q )()( = . The reduced equation is

dt  RC q

dq 1−= . (12-3)

which has a solution,

Page 3: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 3/40

12.1 Step-function and impulse response 12-3

 RC t oeCV t ut q

/)()( −= . (12-4)

So, the complete solution is

 RC t oo eCV t uCV t ut q

/)()()( −−= (12-5)

or 

)1()()( / RC t o eCV t ut q −−= . (12-6)

It is convenient to normalize this to the charge 0/)()( CV t qt qn = , and when we

do this we obtain the normalized response to a unit step function input,

)1)(()( / RC t n et ut q −−= . (12-7)

An example of a unit step function and a step function response are shown in Fig.12-2. In this Figure, the step function and the response start at t = 0.55.

Impulse response

The time derivative of )(t qn is the normalized current )(t  I n ,

 RC t n e

 RC t ut  I  /1)()( −= . (12-8)

This is the normalized impulse response (the response to a delta function input).

Figure 12-2. Unit step function and step function response. Time constant is RC seconds. The amplitude rises to 0.632121 at 1 unit from the start (0.55 here).

Step Function Response

0

0.2

0.4

0.6

0.8

1

1.2

0 1 2 3 4 5 6 7

Time (normalized to 1 time constant)

   A  m  p   l   i   t  u   d  e

Page 4: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 4/40

12-4 Chapter 12. Analysis ToolPak: FFT Applications

The standard notation for the normalized impulse response is h(t) and we willuse this starting now,

 RC t e RC 

t ut h /1)()( −= (12-9)

We have explicitly included u(t ) as a reminder that the impulse response is acausal function: there is no output before there is input. Because the delta func-

tion )(t δ  is the derivative of the unit step function, the impulse response is the

derivative of the response to a unit step function. (We're omitting some subtlemathematical questions here about the derivative of a step function.) Both arestandard ideal test signals with the useful property that each completely describes

the system in the time domain. They can only be approximated using hardware because nothing has a zero rise-time and nothing goes on forever.

The RC circuit we are discussing is used as a single-pole low-pass filter (or integrator), because the input is across R and C in series and the output is acrossC . Its response to a unit impulse is shown in Fig. 12-3. The impulse is at t = 0.

Although we have been discussing u(t ) and h(t ) for an RC circuit, everythingwe did, and will do, applies to mechanical and acoustical systems because of theanalogous quantities shown in Table 12-1.

Figure 12-3. Impulse response of the RC series circuit. Response falls to 1/e =0.367879 when RC = 1. Note causality; output is zero before the input starts.

Impulse Response

0

0.2

0.4

0.6

0.8

1

1.2

-2 -1 0 1 2 3 4 5 6 7 8 9 10

Time (normalized to 1 time constant)

   A  m  p   l   i   t  u   d  e

Page 5: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 5/40

12.2 Frequency domain, phasors 12-5

TIPAs defined, the step function u(t ) starts at t = 0. You can start the step function at

any time ot  by using )( ot t u − . For example, to start at t = 63 let the step function

 be )63( −t u .

h(t ) is sometimes called the Green’s function. George Green is one of thesmall group of Cambridge scientists honored by burial in Westminster Abbey.The group includes Dirac, Maxwell and Kelvin. The Greens’s function contains

all of the information about a system. We’ll see how to use it later.

12.2 Frequency domain, phasors

 Now that we've taken care of the time domain let's examine the frequency do-main. We will use the phasor method, sometimes called “the poor man’s Fourier 

transform”. We start with a general input inV  and sum the voltages around the

loop after  inV  has been applied for a time much greater than RC seconds,

0=−−C 

q IRV in (12-10)

so

q IRV in += (12-11)

where I is current, R is resistance, q is electric charge, and C is capacitance.

Table 12-1. Analogous quantities in physical systems

Mechanical Electrical Acoustical  

F  force V  potential difference Pressure

 x  displacement q charge Volume displacement

v  velocity I  current Volume current

a acceleration

dt 

dI 

rate of change of current

Rate of change of vol-

ume current

m mass L inductance Inertance

k  restoring force con-stant

1/C  reciprocal of ca-pacitance

Reciprocal of acousticcapacitance

R  resistance force con-stant

R  resistance  Acoustic resistance

Page 6: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 6/40

12-6 Chapter 12. Analysis ToolPak: FFT Applications

 Now let t io eqt q ω =)( , so )()( t qit  I  ω = and we have

q RC i

qqRiV in )1( +=+= ω ω  (12-12)

But q/C is just the voltage across the capacitor in Fig. 12-1, which is the output

voltage out V  so we can write,

 RC iV 

out 

in ω +=1 (12-13)

Invert Eq. (12-13) to obtain the usual expression for the Gain, )( ω iG ,

22)(1)(1

1

1

1)(

 RC 

 RC i

 RC  RC iV 

V iG

in

out 

ω 

ω 

ω ω ω 

+−

+=

+== (12-14)

This is the frequency domain response of the system in Cartesian or rectangular coordinates, that is, in terms of the real and imaginary parts. From now on we are

going to call the frequency domain response )(ω  H  , which is standard notation

for the system function or transfer function (see Fig. 12-4),

22 )(1)(1

1)(

 RC 

 RC i

 RC  H 

ω 

ω 

ω ω 

+−

+= . (12-15)

Figure 12-4. System function. Thick blue line: Real. Thin red line: Imaginary. Fre-quency is normalized in units of 1/RC . (The time constant is RC seconds.)

System Function

corresponding to

an exponential h(t).

See Eq.(12-15)

0.0001

0.001

0.01

0.1

1

-60 -40 -20 0 20 40 60

Frequency (normalized to reciprocal of 1 time constant)

   R  e  a   l

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

   I  m  a  g   i  n  a  r  y

Page 7: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 7/40

12.2 Frequency domain, phasors 12-7

)(ω  H  completely describes the system in the frequency domain, just as h(t )

or the step-function response completely describes the system in the time do-main. The same information is contained in both of these functions.

In Section 12.3 we will see how to use the Fourier transform to find )(ω  H  if 

you know h(t ), and how to find h(t ) if you know )(ω  H  . In other words, the im-

 pulse response and the system function comprise a Fourier transform pair. Theseexact analytical results will be compared with FFT results using the spreadsheet.

It is often more useful to express the system function in polar coordinates,

that is, in terms of the magnitude |)(| ω  H  and phase )(ω θ  ,

22 ImRe|)(| +=ω  H  (12-16)

   

  =

Re

Imarctan)(ω θ  (12-17)

So, the frequency domain response (shown in Fig. 12-5) becomes

2)(1

1)(

 RC  H 

ω ω 

+= (12-18)

)arctan()( RC ω ω θ  −= (12-19)

Figure 12-5. Magnitude and phase of  )(ω  H  for the RC circuit. Thick blue curve:

magnitude. Thin red curve: phase. Frequency is normalized in units of 1/RC .

System Function

corresponding to

an exponential h(t)

0

0.2

0.4

0.6

0.8

1

1.2

-60 -40 -20 0 20 40 60

Frequency (normalized to reciprocal of 1 time constant)

   M  a  g  n   i   t  u   d  e

-90

-75

-60

-45

-30

-15

0

15

30

45

60

75

90

   P   h  a  s  e   (   d  e  g  r  e  e  s   )

Page 8: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 8/40

12-8 Chapter 12. Analysis ToolPak: FFT Applications

Because of the wide range of the magnitude it is convenient to scale the magni-

tude in decibels. In terms of volts, )/log(20dB inout  V V = so,

])(1log[10|])(log[|20dB 2 RC  H  ω ω  +−== (12-20)

 Note in Fig. 12-6 and Eq. (12-18) that the magnitude falls to 0.707, and the phaseshift is –45 degrees at the so-called corner frequency 1/ RC rad/s. In other words,

the corner frequency is  RC c /1=ω  . The magnitude drops to –3 dB at the corner 

frequency, according to Eq. (12-20), because –10 log(2) = –3 .01.Figure 12-6 is a standard Bode chart format with the magnitude on a log

scale, phase linear in degrees, and a logarithmic frequency scale. For any physi-cal system with a simple exponential impulse response the magnitude always

falls to –3 dB (half power) and the phase shift is always –45 degrees at a fre-quency that is the reciprocal of the time constant, which is equal to a frequencyof 1 on this normalized frequency scale. Figure 12-7 shows the polar plot.

 Now that we have )(ω  H  in polar form we can express it conveniently as

)(|)(|)( ω θ ω ω  ie H  H  = . (12-21)

This immediately gives us three powerful tools:

Linear filtering, convolution

If we know )(ω  H  and the input spectrum )(ω in F  then we can find the output

spectrum )(ω out  F  . This is linear filtering in the frequency domain.

Figure 12-6. Bode plot. Magnitude (blue, thick) and phase (red, thin) for a system

with an exponential decay h(t ). Note: −3 dB and −45 degrees ⇔ frequency = 1.

System Function corresponding to an exponential h(t)

-60

-50

-40

-30

-20

-10

0

0.1 1 10 100

Frequency (normalized to reciprocal of 1 time constant)

   d   B

-90

-75

-60

-45

-30

-15

0

   P   h  a  s  e   (   d  e  g  r  e  e  s   )

Page 9: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 9/40

12.2 Frequency domain, phasors 12-9

Figure 12-7. Polar plot of Imaginary vs. Real for the exponential decay impulseresponse.

We can find the output waveform by using the inverse Fourier transform on thespectrum. (See Section 12.5.) This is also called convolution in the frequencydomain,

)()()( ω ω ω  inout  F  H  F  = . (12-22)

Inverse filtering, deconvolution

If we know the output spectrum )(ω out  F  and )(ω  H  we can find the input. (See

Section 12.7.) This is called deconvolution or inverse filtering ;

)(

)()(

ω 

ω ω 

 H 

 F  F  out 

in = . (12-23)

System identification

We can determine the system function by sending in a known signal )(ω in F  and

measuring the output )(ω out  F  . This means that we can measure )(ω  H  using any

signal, even random noise (see Section 12.12). Finding )(ω  H  is called  system

identification:

Imaginary vs. Real

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0 0.2 0.4 0.6 0.8 1 1.2

Real

   I  m  a  g   i  n  a  r  y

Page 10: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 10/40

12-10 Chapter 12. Analysis ToolPak: FFT Applications

)(

)()(

ω 

ω ω 

in

out 

 F 

 F  H  = . (12-24)

Later, we will show how to compute convolution, deconvolution, system identi-fication and the coherence and SNR functions using the FFT.

12.3 System function via Fourier transform

Before we use the spreadsheet let’s review the relation between the impulse re-sponse and the system function. Both of these functions convey the same infor-mation, one in the time domain and one in the frequency domain. These twofunctions are related by the Fourier transform.

As a simple example let's consider h(t ) for the RC circuit, given by Eq. (12-9). This is a special case, but it is more general than it appears because of thecomplex modulation-spectrum shift property of the Fourier transform. The Fou-rier transform of the impulse response is given by

dt eet u RC 

 H  t i RC t  ω ω  −+∞

∞−−∫ = /)(

1)( (12-25)

Collect exponentials and set the lower limit with u(t ),

dt e RC 

 H  t i RC ∫ +∞ +−=0

)/1(1)( ω ω  (12-26)

and this easily integrates to,

)/1(

101

)/1(

|1)(

0)/1(

ω ω ω 

ω 

i RC  RC i RC 

e

 RC  H 

t i RC 

+−−

=+−

=∞+−

(12-27)

so,

 RC ii RC  RC  H 

ω ω ω 

+=

+

=1

1

)/1(

11)( . (12-28)

As usual let's separate the real and imaginary parts and simplify,

22

)(1)(1

1)(

 RC 

i

 RC 

 H 

ω 

ω 

ω 

ω 

+−

+= . (12-29)

This is exactly what we found for  )(ω  H  in Eq. (12-15) using phasors. Now you

know how to find the system function if you measure the system's response in thetime domain. It is faster to measure things in the time domain and then use theFFT to obtain the frequency response; this is the secret of Fourier-transformspectroscopy in the infrared and in pulsed nuclear magnetic resonance (NMR). Nevertheless, it is usually more accurate to measure spectra slowly in frequency.

Page 11: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 11/40

12.4 Swiss Army Signal Processing 12-11

✪✪✪✪ Impulse response via Fourier transform

 Next, let's see how you can compute the impulse response of a system if youmeasure the system function. (This requires a bit more advanced calculus than

we have used so far.) Suppose you have measured )(ω  H  and now you need h(t).

In general, h(t) is the inverse Fourier transform of  )(ω  H  ,

ω ω π 

ω  d e H t h t i∫ ∞+

∞−= )(

2

1)( (12-30)

so for the special case of the RC filter we have

ω ω π 

ω 

d  RC i

e

t h

t i

∫ ∞+

∞− += 12

1

)( (12-31)

This integral looks tricky, but it isn't. There are several ways to do this integral.First, you could look it up in a table of Fourier transforms. Second, if you write

the exponential in terms of )sin()cos( t it  ω ω  + and rewrite the integral in terms of 

the real and imaginary parts, then the odd part integrates to zero because it is anodd function and you are left with the even function.

If you don’t have any tables, you can do it with complex variables (Chapter 7). Consider  ω i as a complex variable and rewrite Eq. (12-31) as,

)()/1(2

1)( ω 

ω π 

ω 

id i RC 

e

iRC t h

t i

∫ ∞+

∞− += (12-32)

This can be evaluated immediately with the Cauchy residue theorem. (If youdon’t know what this is, don’t worry about it now. You’ll learn it in other 

courses.) The integrand has a pole at  RC i /1−=ω  so the integral is iπ 2 times

the value of the residue, )/exp( RC t − , at the pole and the impulse response is

 RC t  RC t  e RC 

t ue RC i

it ut h // 1

)(1

2

2)()( −− ==

π 

π (12-33)

This is just what we found earlier by the solution of a differential equation. Now

you know how to find h(t) and )(ω  H  by several methods.

We have spent a lot of time with this case study because it is simple and easy

to understand. Also, it saves a lot of printer's ink in equations. This is much moregeneral than it seems, because we have derived some universal results for anysystem that has an exponential decay for an impulse response.

12.4 Swiss Army Signal Processing

Like the Swiss army knife, the FFT in EXCEL is very versatile. It can be used in awide variety of ways, and we will demonstrate just a few of the many applica-

Page 12: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 12/40

Page 13: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 13/40

12.5 Convolution 12-13

How does it work?Convolution is simple to perform in the original data domain (usually time) andthe spreadsheet makes it easy to do. To convolve two data sequences just com- pute the overlap product . This product is obtained by sliding a reversed sequenceover another sequence and adding all of the overlapping products. For example,consider 

6 5 4 3 2 17 8 9 10 11 12 13 14

where the overlap product is 3×7 + 2×8 + 1×9 = 46. Now advance the top sequence to the right so that 1 is above 10 and calculate

the new overlap product. The convolution of the two sequences is the sequenceof overlap products.

Here, we are interested in convolving the impulse response with an input se-quence. For discrete data, convolution can be expressed as

)()(1

)(1

0

nt hn f  K 

t  f  N 

n

inout  −= ∑−

=

(12-34)

where  N is the number of data points. In Eq. (12-34)  K is a normalizing factor,the sum of the impulse response sequence values. Notice how this is done in theCONVOLTIME workbook. Figure 12-9 shows the operation described numeri-cally in Fig. 12-8. This Figure is in the CONVOLTIME workbook and it can beviewed better on your monitor where you can rotate the 3-D chart.

Figure 12-9. Discrete convolution: h(t), h(t)REV, input and convolved output.

1

3

5

7

9

11

13

15

   h   (   t   )

   h   (   t   )   R   E   V

I  n  p  u

   t O  u

   t  p  u

   t

00.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Page 14: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 14/40

12-14 Chapter 12. Analysis ToolPak: FFT Applications

Convolution in the frequency domainFor large data sets the operation is much simpler in the frequency domain whereconvolution is complex multiplication,

)()()( ω ω ω  inout  F  H  F  = . (12-35)

In this equation )(ω out  F  is the output spectrum, )(ω  H  is the system function,

and )(ω in F  is the input spectrum. Equation (12-35) is based on a fundamental

 property of the Fourier transform that you will learn about in other courses.You can interpret Eq. (12-35) in two ways.

•  A simple interpretation is that the system function is an operator  that trans-forms the input spectrum into the output spectrum.

•  The product of two different spectra is called a cross-spectrum or a cross- power spectral density. This is somewhat similar to the power spectral den-sity (PSD), but the cross-PSD is generally complex and the PSD is real. Fromthis perspective the output spectrum is simply the cross-power spectrum of the system function and the input spectrum.

What does it do?The process of convolution is everywhere. Human speech involves convolutionof the pulses from the vocal chords with the cavity resonances of the throat andhead; the sound is further convolved before reception. Vision and hearing areconvolutional processes with restricted bandwidths, complicated by nonlineari-ties. Transmission of electromagnetic signals through the atmosphere, the iono-

sphere, and fiber optics, signals in circuits, and other dispersive, absorptive me-dia are similar convolutions. When two probability densities are joined, theymust be joined by convolution instead of simple addition. (Why? A partial an-swer is that addition won’t work because probability can’t be greater than 1).

Let's summarize some facts that you will learn in other courses:

•  Convolution in time is equivalent to multiplication in fre-quency.

•  Convolution in frequency is equivalent to multiplication intime.

•  Convolution, in time, of a signal with a time-reversed im- pulse response is equivalent to the inverse Fourier transform

of the product of the signal spectrum with the system func-tion.

12.6 CONVOLVE, convolution workbook

Figure 12-10 shows the Home screen of this workbook which contains themethod of performing discrete convolution using the FFT and IFFT. Use your mouse to explore the cell formulas so you can see how they work.

Page 15: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 15/40

12.6 CONVOLVE, convolution workbook 12-15

D:\workbooks\ 

CONVOLVE.XLS

Random noise can be added to the input signal, and the worksheet in Fig. 12-10 reports the input and output variances (the squares of the standard deviations)in row 4. Note the variance reduction in the output. You can modify the impulseresponse in Row 9 to adjust the time constant or to change to another impulse

response. Replace the force F (t ) by )(t  F oδ  and observe the result.

With random noise added to the input signal, press Function Key F9 tochange the noise sample and recalculate. This Function Key retains the samenoise statistics but it uses a different noise sample. Change the noise statisticsusing RAND().

Don't forget to run the FFT on the input signal and the IFFT on the con-volved signal every time the signal changes. If you change the impulse response,

you will have to run the FFT on this to generate the new system function. Noticethat no checkerboarding is used on the input signal because we are not particu-larly interested in the spectra, only the input and output waveforms. Graphs of the uncentered spectra are available by clicking the appropriate tab on the bot-tom, as in Fig. 12-10. Click  D:\Workbooks\CONVOLVE.XLS  or double-click the icon to activate this workbook.

This workbook has a built-in test signal consisting of two pulses of differentlengths and a segment of a sine wave, Fig. 12-11. The pulses have differentspectral widths, but their spectra are broad-band. The sine wave is a relativelynarrow-band signal.

Change the impulse response using longer and shorter time constants. Ob-serve the effects on the input and output variances in cells D4 and G4. Long timeconstants produce more smoothing, but also more distortion.

Figure 12-10. Home screen of CONVOLVE workbook. Note variance reduction.

Page 16: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 16/40

12-16 Chapter 12. Analysis ToolPak: FFT Applications

Figure 12-11. Noiseless input (plain line) and convolved output (blue, markers).Note blurring and smoothing of pulses, and note phase and amplitude shifts inthe sine wave segment. Variances of input and output are reported in cells D4and G4.

Figure 12-12. Noisy input (plain line) and convolved output (blue, markers). Thenoise amplitude here is 0.25, and the noise has a uniform distribution. When youview this in the CONVOLTIME workbook, press Function Key F9 for new noise.

Input and Output Signals

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

0 20 40 60 80 100 120 140

Time

   A  m  p

   l   i   t  u   d  e

Input and Output Signals

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

0 20 40 60 80 100 120 140

Time

   A  m  p   l   i   t  u   d  e

Page 17: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 17/40

12.7 Deconvolution 12-17

Figure 12-12 shows the filtering effect on a noisy input signal. You canchange the noise amplitude in cell C34. Remember to perform the FFT on row 15with output in row 17. Next, perform the FFT on row 17 with output in row 19.Finally, perform the IFFT on row 19 with output in row 21. You may want torecord macros to handle these repetitive tasks.

Change the pulse widths and pulse spacing. Look in Help to see the differenttypes of noise you can add, such as uniform noise or Gaussian noise. All of theeffects you see are consistent with the shrink-and-turn frequency response (Fig.12-6).

TIP Linear convolution is the result of convolving non-periodic functions, shown inthe CONVOLTIME workbook. Circular convolution is the result of convolving periodic functions. Using the FFT results in circular convolution because the FFTimposes periodicity. If you perform the FFT operation on a data set, the FFTthinks the same data set came before and the same data set will come afterwards.

12.7 Deconvolution

What is it?

Deconvolution is the “undo” operation of convolution. It is often necessary anddesirable to remove unintentional distortion imposed on data by a system throughwhich the data passes. For example, a spectrograph may smear and blur spectrallines or an amplifier may distort sound. When you do an Internet search for  de-convolution; you’ll find thousands of items about this.

The basic idea of deconvolution is to use a known system function )(ω  H 

and a measured output to determine the original signal. This technique, which isanalogous to decoding a coded message, has many applications. You can think of the measured output as the coded message, and the known system function as thecode key. In other words, deconvolution enables you to reconstruct a distortedsignal. Examination of engineering and scientific data bases shows that hundredsof papers using deconvolution are published every year.

Deconvolution is used extensively in astronomy (Hubble space telescope, for example), geology, and petroleum exploration. The process has also been used toreconstruct old phonograph recordings of Enrico Caruso and to restore photosthat were blurred due to camera motion or improper focus.

What does it do?In telecommunications systems deconvolution is called equalization, whichmeans that the dispersive properties of the system are partially cancelled over a

Page 18: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 18/40

12-18 Chapter 12. Analysis ToolPak: FFT Applications

D:\workbooks\ 

DECONVOLVE.xls

 part of the spectrum. This is important in telecommunication and fiber optics.Deconvolution is easy to do in the frequency domain using complex division,

)(

)()(

ω 

ω ω 

 H 

 F  F  out 

in = . (12-36)

A problem that might arise involves possible zeros in )(ω  H  , which would make

the process blow up. A little noise would be helpful here. This is related to theoriginal problem addressed by Norbert Wiener. The Wiener inverse filter is

)()(

)()(

ω ω 

ω ω 

 N  H 

 F  F  out 

in += (12-37)

This works best if  )(ω  N  is the actual noise spectrum in the system at the time

that the output is measured. If this noise spectrum is updated for each measure-ment, then Eq. (12-37) behaves like an adaptive inverse filter.

When )(ω  H  >> )(ω  N  ordinary deconvolution is performed, but when

)(ω  H  << )(ω  N  the output is uniformly low for broadband noise.

The Home screen of DECONVOLVE is shown in Fig. 12-13. Note the vari-ance reports in cells C4, F4, and I4. Click D:\Workbooks\DECONVOLVE.xls toactivate this workbook. Figure 12-14 shows the original test signal, the con-volved signal, and the deconvolved signal. Figure 12-15 shows the errors in Fig.12-14. The accuracy of reconstruction is often astonishing.

Fig. 12-13. Home screen of  DECONVOLVE. This convolves a user-defined testsignal with a user-defined impulse response, and then deconvolves the signal.Note use of IMDIV for spectral deconvolution in row 19. Double click on the icon.

Page 19: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 19/40

12.7 Deconvolution 12-19

Fig. 12-14. Comparison of original test signal (top), convolved signal (middle),and deconvolved signal (bottom). Note blurring of convolved pulses, with themissing detail on the second pulse. (Traces are displaced vertically for graphicclarity.)

Fig. 12-15. Errors in the deconvolution shown in Fig. 12-14. These extremelysmall errors are typical of this operation using the FFT.

Deconvolution

-2.0

-1.0

0.0

1.0

2.0

3.0

4.0

0 10 20 30 40 50 60 70

Time

   A  m  p

   l   i   t  u   d  e Input

Convolved

Deconvolved

Error, Input minus Deconvolved

-1.2E-14

-1.0E-14

-8.0E-15

-6.0E-15

-4.0E-15

-2.0E-15

0.0E+00

2.0E-15

4.0E-15

6.0E-15

0 20 40 60

Time

   E  r  r  o  r

Page 20: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 20/40

12-20 Chapter 12. Analysis ToolPak: FFT Applications

12.8 Correlation function

What is it?The correlation function is a function of two data sets (cross-correlation function)or one data set (auto-correlation function). The cross-correlation function and thecross-power spectral density [see Eq. (12-53)] comprise a Fourier transform pair.

It is important to distinguish between the correlation function, which we arediscussing here, and the correlation coefficient , familiar in statistics (see page156). Recall that the correlation coefficient is a single number , related to covari-ance and standard deviations of two data sets. In contrast, the correlation function

is a function of time delay τ .

Analog correlators have been used for a long time. The lock-in amplifier andthe box-car integrator are typical correlation-based instruments used in the labo-ratory for measurements when the signal-to-noise ratio is low.

What does it do?The correlation function is sometimes called the  Elvis detector . It is typicallyused to detect the presence of a known signal in noise. For example, it can beused to detect the presence of a face (like Elvis) in a crowd, to compare finger- prints or retinal blood vessel patterns for personal identification, and to determinewhich gun fired a bullet even when the bullet is smashed or partially melted. It isalso used extensively in radar, the Global Positioning System (GPS) and DNAanalysis.

The cross-correlation function achieves its maximum value at a time delay

that corresponds to the time of arrival of a signal that resembles the stored rep-lica. The maximum value is a measure of the similarity of the received signal andthe stored replica. The maximum value is 1 when there is a perfect match.

How does the correlation function compare with convolution?Correlation looks much like convolution except that:

•  There is no time reversal of one of the functions. Recall thatin convolution the impulse response is time-reversed.

•  The integral (or sum) is over time so the correlation function

is a function of the time delay τ , not time t . Recall, convolu-tion produces a function of the original variable, usually t .

The same considerations apply when the correlation function is computed withother variables, such as spatial displacement and frequency. People often haveneed to perform correlation of spectra; in this case frequency is treated as theoriginal variable and the correlation function is a function of frequency shift.

How does it work?Correlation in the original data domain is as simple as convolution: both are op-erations that involve multiply, add, and shift. In the original data domain the cor-

Page 21: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 21/40

12.8 Correlation function 12-21

relation function )(, τ  sr  R can be computed as,

)()(1

)(1

0

, n f n f  K 

 R  s

 N 

n

r  sr  += ∑−

=

τ τ  (12-38)

where the subscript r refers to the received signal and the subscript s refers to thestored replica. Here, K is the normalization factor, the sum of the squares of thestored replica.

Compare Eq. (12-38) with Eq. (12-34). Other than the change in symbols, theonly differences is the + sign and the normalization factor. In the cross-correlation function there is no time reversal of either function; one just slidesover the other. This can be seen even more clearly in the CROSSCOR workbook.Equation (12-38) can be illustrated simply with the data sequences,

1 2 3 4 5 61 2 3 4 5 6

where the overlap product is 4×1 + 5×2 + 6×3 = 32. Here, we have not used thenormalization factor  K . Clearly, the maximum value of the overlap product oc-curs when one sequence is on top of the other, that is, they have the same shift tothe right. It is also clear that the cross-correlation function of a rectangular pulseis an isosceles triangle. (Try this with a noiseless pulse, 1 1 1 1 1 1.)

As the stored replica moves across the received signal, the overlap product iscalculated and plotted for each shift. Note that the maximum of the cross-correlation function occurs at the time delay corresponding to the time of arrivalof the leading edge of the received signal. The maximum value of the cross-correlation function is a measure of the similarity of the received signal and thestored replica.

This stored replica may not actually be that of the original signal if you donot have the original signal; it may be an estimate of what you think the originalsignal is, or a replica of a signal that you are looking for. Perhaps you have a li- brary of signal replicas in which you have an interest. This is the way some as-tronomers, cryptographers, and electronic surveillance wizards work.

The idea of correlation originated in antiquity when people compared pat-terns by sliding one pattern over another, which is exactly what the correlationsum or integral does.

In the frequency domain the cross-correlation function is based on the cross- power spectral density of two signals

)()( 2*

1 ω ω  F  F  XPSD = (12-39)

where )(*1 ω  F  is the complex conjugate of signal 1 and )(2 ω  F  is the spectrum of 

signal 2. Note that this form of the cross-power spectral density is completelyreal, like the power spectral density. As we mentioned above, the cross-

correlation function )(2,1 τ  R and the XPSD comprise a Fourier transform pair,

Page 22: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 22/40

12-22 Chapter 12. Analysis ToolPak: FFT Applications

)]([ 2,1 τ  R FT  XPSD = (12-40)

][)(2,1 XPSD IFT  R =τ  (12-41)

where  FT  is the Fourier transform and  IFT  is the inverse Fourier transform.Equations (12-40) and (12-41) briefly express the Wiener-Khintchine theorem.

12.9 Applications of cross-correlation

Signal recovery by ensemble averaging (Section 10.9) is not possible if the signalis not repetitive. However, for a single event, cross-correlation of the signal-plus-noise with a stored copy of an expected signal often produces astonishingly goodresults in detecting the existence of the known signal.

The cross-correlation function can be very useful in investigating character-istics of time delays and signal propagation paths in acoustics, optics, and elec-

tromagnetics. The correlation velocity corr v is defined as

maxτ 

d vcorr  = (12-42)

where d is the propagation distance between the source and detector and the time

delay parameter  maxτ  is that at which the cross-correlation function )(, τ t r  R

achieves its maximum value, A change in the dispersive properties of the system

can be detected through a change in the delay time parameter τ and the maximumvalue of the cross-correlation function.

The Wiener-Khintchine theorem shows explicitly that the information con-veyed by the cross-correlation function in the time domain is the same as thatconveyed by the XPSD in the frequency domain.

The noise reduction property of cross-correlation is of considerable impor-

tance. Consider a received signal )(t  f r  with additive random noise )(t  f n , so that

the composite signal at the detector is )()( t  f t  f  nr  + . Then the cross-correlation

function of the noisy received signal is given by

ω ω ω ω 

π 

τ  ω  d e F  F  F  R t ionr onr  )()]()([

2

1)( *

,, +=

∫ 

∞+

∞−

(12-43)

where )(ω r  F  , )(ω n F  , and )(ω o F  are the Fourier transforms of the received sig-

nal, the noise, and the original signal, respectively. Equation (12-43) is simply,

)()()()( ,,,,, τ τ τ τ  or onor onr  R R R R ≈+= . (12-44)

The cross-correlation function of the original signal with the random noise,

Page 23: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 23/40

Page 24: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 24/40

12-24 Chapter 12. Analysis ToolPak: FFT Applications

The peak detector in rows 31 and 32 require a little explanation.

•  Cell H31 contains the formula =MAX(E22:BM22). This

reads out the maximum value in this row.

•  Cell K31 contains the formula =MAX(E32:BM32). Thisreads the time at which the maximum value occurs.

•  Cell E32 contains the formula =IF(E22=$H$31,E17,0). This

is copied to cells E23:BM32. This formula searches for themaximum value found in cell H31, and writes the time atwhich the maximum value occurs.

A 3-D chart of the noiseless 3-point correlation is shown in Fig. 12-17. Ob-

served that the peak of the cross-correlation function occurs at the time of arrivalof the received signal.

Figure 12-18 shows a noiseless cross-correlation function of a more compli-cated signal, and Fig. 12-19 shows the same signal with noise added. Press Func-tion Key F9 repeatedly and observe the received signal and the cross-correlationfunction. Change the noise amplitude in cell D21 and observe how the cross-correlation peak is a stable marker even when the received signal is buried innoise. Change the form of the stored replica (this will automatically change thereceived signal). Use positive, negative, and zero values in the signal.

Figure 12-17. Stored replica, received signal, and cross-correlation function. Youcan rotate this Figure for better viewing when you open the CORRELTIME work-book.

1

3

5

7

9

11

13

15

   S   t  o  r  e   d   R  e  p   l   i  c  a

   R  e  c  e   i  v  e   d   S   i  g  n  a   l

   C  o  r  r  e   l  a   t   i  o  n

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Page 25: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 25/40

12.10 CORRELTIME workbook 12-25

Figure 12-18. Cross-correlation function of noiseless signals. This computation isdone without the FFT but note that the cross-correlation function has the appear-ance of a Fourier transform.

Figure 12-19. This is the same cross-correlation function as in Fig. 12-18, butnow the received signal is noisy. Cross-correlation function =0.652 at point 36.

Cross-correlation Function

(Press Function Key F9)

-2.0

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

2.0

2.5

3.0

0 10 20 30 40 50 60 70

Data Point

Stored replica

Received signal 

Cross-correlation function

Cross-correlation Function

(Press Function Key F9)

-2.5

-2.0

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

2.0

2.5

3.0

0 10 20 30 40 50 60 70

Data Point

Stored replica

Received signal 

Cross-correlation function

Page 26: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 26/40

Page 27: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 27/40

12.11 CROSSCOR workbook 12-27

Figure 12-21. Stored replica, noiseless received signal, and cross-correlationfunction. Note that the time of arrival of signal is marked by the peak in the cross-correlation function

Figure 12-22. Stored replica, noisy received signal, and cross-correlation func-tion. Note that the time of arrival of signal is marked by strong, stable peak incross-correlation function even when the actual signal is buried in noise.

Cross-Correlation Function via FFT

-1

0

1

2

3

4

5

6

7

0 20 40 60 80 100 120 140

Time Delay

   A  m  p

   l   i   t  u   d  e

Stored replica

Received signal 

Cross-correlation

Cross-Correlation Function via FFT

-1

0

1

2

3

4

5

6

7

0 20 40 60 80 100 120 140

Time Delay

   A  m  p

   l   i   t  u   d  e

Stored replica

Received signal 

Cross-correlation

Page 28: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 28/40

12-28 Chapter 12. Analysis ToolPak: FFT Applications

12.12 System identification

What is it?This is a way to determine the heart and soul of a linear system, that is, its systemfunction and impulse response. We introduced system identification earlier in Eq.(12-25), and we’ll re-write it here for convenience,

)(

)()(

ω 

ω ω 

in

out 

 F 

 F  H  = . (12-45)

 Now we are going to examine it in more detail. Equation (12-45) looks sim- ple enough, and it works in many cases. Send in a test signal of your own choos-

ing, so you know its complex spectrum )(ω in F  . Then you measure the complex

spectrum of the system's response )(ω out  F  , and perform the indicated complex

division to obtain )(ω  H  .

System identification is like safe cracking. A safe cracker twiddles the dialrandomly (test signal) while he or she listens for, and feels, the response of thelock (system output). Use system identification for good, not evil

What does it do?There is a potential difficulty with this simple process, because any zero in

the input spectrum will make Eq. (12-45) blow up. This would seem to eliminatethe use of pulses as test signals because they have many zeros. Even though theindicated division looks dangerous, the chance of hitting a perfect zero in the realworld is very small, considering discrete signals and the inevitable presence of noise. To be on the safe side, you can add a small amount of noise with a spec-trum )(ω  N  to the test signal,

)()(

)()(

ω ω 

ω ω 

 N  F 

 F  H 

in

out 

+= . (12-46)

This is basically the idea of the Wiener inverse filter, derived by NorbertWiener as the optimum deconvolution or inverse filter. Here, optimum is used inthe least-mean-square sense. Equation (12-46) seems to be a reasonable thing todo, but there is no indication here that this is optimum in any way. It's good to

know that such a simple idea is the best idea, at least in the LMS sense.So, if Equation (12-46) is so good, why do we need )(ω in F  ? Doesn't this just

look like a nonrandom addition to noise? The answer is, we do not need )(ω in F 

and we can use random noise as a perfectly good test signal. It's a good idea touse many noise samples, make many measurements, and average the ensemble. If 

no other problems are present, then the error in )(ω  H  will be proportional to the

square root of the number of measurements. The noise spectrum should have a

Page 29: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 29/40

12.13 System-I-D workbook 12-29

D:\Workbooks\ 

SYSTEM-I-D.xls

 bandwidth at least as great as the expected system function bandwidth.An alternative to Eq. (12-45) uses the power spectral density and the cross-

PSD. Multiply numerator and denominator of Eq. (12-45) by the complex conju-gate of the output spectrum, and you get

)()(

|)(|

)(

)(

)(

)()(

*

2

*

*

ω ω 

ω 

ω 

ω 

ω 

ω ω 

out in

out 

out 

out 

in

out 

 F  F 

 F 

 F 

 F 

 F 

 F  H  == . (12-47)

A noise power spectrum can be added to the denominator, or the denomina-tor could simply be the cross-PSD of the input noise and the output noise. Re-member, the numerator is real and the denominator is complex.

12.13 System-I-D workbook

Figure 12-23 shows the Home screen of the SYSTEM-I-D workbook for experi-menting with system identification using the FFT. The unknown system in theworkbook has an exponential impulse response, similar to the  RC  circuit (seeSection 12.1). Click D:\Workbooks\SYSTEM-I-D.xls to activate this workbook.The computed system function based on the unit impulse test signal is shown inFig. 12-24 and its associated impulse response is shown in Fig. 12-25. The dif-ference between the actual impulse response and the computed impulse responseis shown in Fig. 12-26.

Figure 12-23. Home screen of SYSTEM-I-D. Input test signal in row 6 is a deltafunction (impulse). Note use of IMDIV in row 10 to compute the system functionusing the method expressed in Eq. (12-45). Click on the icon to activate this file.

Page 30: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 30/40

12-30 Chapter 12. Analysis ToolPak: FFT Applications

Figure 12-24. Computed )(ω  H  using two pulses into the unknown system. The

result of using the FFT produces errors at both ends of the spectrum because of the FFT’s imposed periodicity. Note how phase goes to zero at the ends.

Figure 12-25. Computed h(t) from IFFT of data in Fig. 12-24; note excellent ex-ponential characteristic. See Fig. 12-26 for errors in this computation.

System Function (checkerboarded)

0.1

1

10

100

-80 -60 -40 -20 0 20 40 60 80

Frequency

   M

  a  g  n   i   t  u   d  e   (  n  o  m  a  r   k  e  r  s   )

-90

-75

-60

-45

-30

-15

0

15

30

45

60

75

90

   P   h  a  s  e   (   d  e  g  r  e  e  s   )

Impulse Response h(t)

0.01

0.1

1

0 20 40 60 80 100 120 140

Time

   I  m  p  u

   l  s  e

   R  e  s  p  o  n  s  e

Page 31: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 31/40

12.13 System-I-D workbook 12-31

Figure 12-26. Difference between actual impulse response and computed im-pulse response. With errors of a few parts in 10

15, these results are quite good,

considering all of the processing involved.

Figure 12-27. Exact system function. Compare shapes at ends of the spectrumwith the FFT results in Fig. 12-24 (FFT phases at the ends have large errors).

 Actual h(t) minus Computed h(t)

0

2E-16

4E-16

6E-16

8E-16

1E-15

1.2E-15

1.4E-15

1.6E-15

   1 5 9   1   3

   1   7

   2   1

   2   5

   2   9

   3   3

   3   7

   4   1

   4   5

   4   9

   5   3

   5   7

   6   1

   6   5

   6   9

   7   3

   7   7

   8   1

   8   5

   8   9

   9   3

   9   7

   1   0   1

   1   0   5

   1   0   9

   1   1   3

   1   1   7

   1   2   1

   1   2   5

Time

   D   i   f   f  e  r  e  n  c  e

Exact System Function of Exponential Impulse Response

0.01

0.1

1

-80 -60 -40 -20 0 20 40 60 80

Frequency

   M  a  g  n   i   t  u   d  e

-90

-75

-60

-45

-30

-15

0

15

30

45

60

75

90

   P   h  a  s  e   (   d  e  g  r  e  e  s   )

Page 32: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 32/40

12-32 Chapter 12. Analysis ToolPak: FFT Applications

12.14 Coherence function

What is it?The coherence function gives a quantitative measurement of the frequency rangesshared by two signals. In other words, the coherence function is large when twosignals have power at the same frequency, and the function is very small whenonly one signal has power at that frequency. This may sound familiar; the cross- power spectral density and the coherence function have similar properties. Thesquare of the magnitude of the coherence function is often the most useful form.

The coherence function is related to the power spectral density (PSD) andcross-power spectral density (see Section 11.17); the coherence function can be

obtained as a natural by-product of other computations based on spectra. Themagnitude-squared of the coherence function )(2 ω γ  is defined as

)()(

|)(|)(

2,21,1

22,12

ω ω 

ω ω γ 

 F  F 

 F = (12-48)

where )(2,1 ω  F  is the cross-power spectrum of two signals, and )(1,1 ω  F  and

)(2,2 ω  F  are the auto- or self-power spectra of signals 1 and 2. The coherence

function is readily computed along with the cross-correlation function. Noticethat Eq. (12-48) can blow up at a frequency where the denominator has a zerovalue; noise in signals usually prevents this. These things will become clear when

you explore the COHER-SNR worksheet.Equation (12-48) is often called the MSC function, for  magnitude-squared 

coherence. We will use this equation in the COHERENCE workbook (see Section12.16).

What does it do?The MSC function has a value that ranges from 0 to 1. If the output of a linear system is due only to the input, then MSC = 1. If the output of the system has nocausal relation with the input, then MSC = 0. A coherence function with a valueless than one and greater than zero indicates one or more of the following:

•   Noise from an unknown source, or jamming, is present.

•  The system connecting the input to the output involves non-

linearity.

•  The output is due to one or more inputs in addition to the

known input. This is important in measuring cross-coupling.

Occasionally, random errors may produce a value greater than 1. The MSC func-tion is used in computing the SNR (signal-to-noise ratio) function, defined as

)](1/[)()(SNR  22 ω γ ω γ ω  −= . This is used in the COHERENCE workbook.

Page 33: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 33/40

12.15 SNR function 12-33

12.15 SNR function

What is it?The SNR (signal-to-noise ratio) function is a simple extension of the MSC func-tion. The SNR function is a function of frequency, not the usual S/N expressed asa single number. The SNR function is defined as

)(1

)()(

2

2

ω γ 

ω γ ω 

−=SNR . (12-49)

 Notice that the SNR function can blow up when2γ  is close to 1. Usually this is

not a problem with real-world signals because of random noise that accompaniesmeasurements.

What does it do?The SNR function gives the signal/noise power ratio at each frequency. This can be a very useful parameter.

12.16 COHERENCE workbook

Figure 12-28 shows the Home screen for the COHERENCE workbook, whichcontains the MSC and SNR functions. For simplicity this example does not use adata window. You can use a data window (von Hann for example, see Section11.10) to enhance frequency resolution. The worksheet in Fig. 12-28 has several

tricks that you can use later in worksheets that you compose. Enter the signal fre-quencies in cells E4 and E5. Signal 1 is a noiseless exponentially decaying sineand signal 2 is a noisy sine. The noise amplitude in signal 2 is entered in cell E6;see the cell editing box for cell H12 to see how this is done. Reports are given incells J4:J7.

Figures 12-29 and 12-30 show the waveforms and spectra. Experiment withsignals without the data window, and compare the frequency resolution with thewindow in use. Always recalculate the FFT and IFFT using the Fourier Analysisdialog box, or write a macro to do this. Figures 12-31 and 12-32 show the corre-sponding MSC and SNR functions.

TIPBy pressing Function Key F9 you can change the noise sample, retaining thesame statistics,. If you want to retain the identical noise sample for all calcula-tions, convert random noise samples from the formula using RAND() to Values.To accomplish this, use [Copy][Paste Special][Values] for the entire sequence.

Page 34: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 34/40

12-34 Chapter 12. Analysis ToolPak: FFT Applications

D:\Workbooks\ COHERENCE.xls

Figure 12-28. Home screen of COHERENCE workbook. Note reports of SNR andMSC functions in cells D3:D4 and G3:G4. The formula shown for cell A37 com-putes the MSC function in row 37, using Eq. (12-48). The factor 1024 is for nor-malization of the MSC function which has 128 data points here. Use two left-clicks on the icon at the upper left, or click D:\Workbooks\COHERENCE.xls .

Figure 12-29. These two signals appear to have little or no coherence. Thick blueline: Signal 1. Thin black line: Signal 2, with noise (see Fig. 12-28, row 19).

Input Signals

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 20 40 60 80 100 120 140

Time

   A  m  p   l   i   t  u   d  e

Page 35: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 35/40

12.16 COHERENCE workbook 12-35

Figure 12-30. Spectrum of Signal 1, sine wave. Note the narrow bandwidth, asyou would expect for a sine wave. The von Hann window has reduced the spec-trum leakage. The signal parameters are shown in row 8 when you click on theicon at the left side of Fig. 12-28.

Figure 12-31. Spectrum of Signal 2, a sine wave with added noise. This signalhas the same frequency as Signal 1 but it is buried in noise and unobservable.This spectrum will change with every new noise sample. Signal parameters areshown in row 19 when you click on the icon at the left side of Fig. 12-28.

Spectrum, Signal #1

-200

-150

-100

-50

0

50

-80 -60 -40 -20 0 20 40 60 80

Frequency

   P  o  w  e  r   S  p  e  c   t  r  u  m

Spectrum, Signal #2

0

5

10

15

20

25

30

-80 -60 -40 -20 0 20 40 60 80

Frequency

   P  o  w  e  r   S  p  e  c   t  r  u  m

Page 36: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 36/40

12-36 Chapter 12. Analysis ToolPak: FFT Applications

Figure 12-32. MSC function for the signals in Figs. 12-30 and 12-31. This is goodevidence for the existence of narrow-band coherence.

Figure 12-33. SNR function for the signals in Figs. 12-30 and 12-31. SNR is largewhere signals share frequencies. Note that the SNR function is above 0 dB inthis narrow frequency band.

Coherence (MSC) Function

-0.10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

-80 -60 -40 -20 0 20 40 60 80

Frequency

   M   S   C   F  u  n  c   t   i  o  n

SNR Function

-120

-100

-80

-60

-40

-20

0

20

-80 -60 -40 -20 0 20 40 60 80

Frequency

   d   B

Page 37: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 37/40

Page 38: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 38/40

12-38 Chapter 12. Analysis ToolPak: FFT Applications

References

R. Bracewell, The Fourier Transform and Its Applications (McGraw-Hill, NewYork, 1965).

E. O. Brigham, The Fast Fourier Transform and Its Applications, (Prentice-Hall1988)

D. C. Champeney,  Fourier Transforms and Their Physical Applications (Aca-demic Press, New York, 1973).

P. R. Griffiths and G. Pariente, “Deconvolution,” Trends in Analytical Chemistry

5, No. 8, (1986).

F. J. Harris, “On the use of windows for harmonic analysis with the discrete Fou-rier transform,” Proc. IEEE 66, 51–83 (1978).

P. Jansson,  Deconvolution of Images and Spectra, (Academic Press, New York 1997).

A. V. Oppenheim and R.W. Schafer.  Discrete-Time Signal Processing (PrenticeHall, Englewood Cliffs, NJ, 1989).

The entertainment industry is a driving force in digital signal processing. One of 

the leading companies is Pixar Animation Studios. Their web site is:http://www.pixar.com/

Industrial Light and Magic was started by George Lucas (Star Wars). The website is:http://www.lucasfilm.com/

The Society of Motion Picture and Television Engineers (SMPTE) is on theleading edge of techniques used in this chapter, because of digital methods usedin movies. The web site ishttp://www.smpte.org/

The audio industry is a big user of digital signal processing techniques. For anexample, go to:http://www.digido.com/homepage.html

Digital Domain produced the digital effects in the movie Titanic. This companywas founded by James Cameron (director of  Titanic), Scott Ross, and StanWinston. The web site is: http://www.d2.com/

Page 39: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 39/40

What’s next? 12-39

Manex Visual Effects produced the digital wow stuff in the movie The Matrixand its sequel:http://www.mvfx.com/

B. Schwarzschild, “Adaptive optics at the new 8-meter Gemini Telescope,”Physics Today 52 (9), 23 (1999) September. This shows deconvolution used tosharpen an image of the planetary nebula  BD +30 3639 obtained with this tele-scope. The nebula is about 5000 light-years from Earth, and about one light-week in diameter. This telescope is on Mauna Kea in Hawaii. An identical telescope isin Chile. Additional references are given.

What’s next?

 Now that you have the basics, you can use EXCEL in your academic courses, andeven in your life. (Keep your checkbook balanced!) EXCEL is so powerful and soversatile that there is much more for you to learn, including Solver, Goal Seek,advanced statistical analysis, and Visual Basic for Applications. Who knowswhat the future versions of EXCEL will have?

Test your skills

1.  Modify the CONVOLVE workbook by changing the impulse response. (a)

Use the exponential decay with shorter and longer time constants. Observethe results using the rectangular pulse as an input signal. Repeat with two pulses, one long and one short.

2.  Modify the CONVOLTIME workbook (Fig. 12-8) by changing the input sig-nal. (a) Change the input signal to a sine wave. Observe the results on sinewaves of low frequency and high frequency.

3.  Modify the CONVOLTIME workbook (Fig. 12-8) by changing the impulseresponse to the values shown below:

(Note: this impulse response produces an output that is the derivative of the in- put. It is a high-pass filter or edge detector .4.  Central Limit Theorem. Modify the CONVOLVE or the CONVOLTIME

workbooks to perform five consecutive convolutions of a rectangular pulse

Page 40: Analysis Toolpak FFT App Chp 12

7/27/2019 Analysis Toolpak FFT App Chp 12

http://slidepdf.com/reader/full/analysis-toolpak-fft-app-chp-12 40/40

12-40 Chapter 12. Analysis ToolPak: FFT Applications

with itself. The first convolution of a rectangle with a rectangle should pro-duce a triangle. After that, the convolutions should look more and more like aGaussian function. (For a wide class of functions, the result of an infinitenumber of self-convolutions is a Gaussian function.)

5.  Central Limit Theorem, Part II. Modify the CONVOLVE workbook to per-form a convolution of a “sin(x)/x” function with itself. You should get an-other “sin(x)/x” function. (This function does not obey the Central LimitTheorem.) Why? (Hint: consider the Fourier transform of the “sin(x)/x”function, which is a rectangular function. Because convolution in the fre-quency domain is simply multiplication, and multiplying two rectanglesgives another rectangle, the inverse Fourier transform is another “sin(x)/x”function.)

6.  Modify the DECONVOLVE workbook to study the effects of deconvolutionwith errors in the system function. Use a rectangular pulse as the signal.Change the time constant in the exponential decay to shorter and longer thanthe actual impulse response. Notice the errors in deconvolution, typified bythe “tilt”, and the direction of the “tilt”, of the deconvolved pulse.

7.  Modify the CROSSCOR workbook by using a stored replica of your choice. Notice that the longer the duration of the replica, the better the cross-correlation works in the presence of noise. Change the time of arrival of thesignal and the noise level.

8.  Experiment with cross-correlation of noiseless signals that are not exactly thesame. Notice how the cross-correlation function decreases as the similaritydecreases.

9.  Modify the SYSTEM-I-D workbook by changing the input signal. For exam- ple, change the delta function to a rectangular or triangular pulse. What ef-fects do you observe on the computed system function?

10. Modify the SYSTEM-I-D workbook by changing the input signal to randomnoise. Use the RAND() spreadsheet function to generate the noise input. To prevent the noise from changing every time you recalculate, use these opera-tions on the noise signal: On the noise sequence use [Copy][Paste Spe-cial][Values] and copy the noise into the original cells. This will keep thenoise constant. Compare the computed system function with that obtainedusing a delta function input signal.

11. Modify the COHERENCE workbook to measure the coherence and SNR of anoiseless sine wave with an exponentially damped sine wave of the same

frequency. What do you observe about the bandwidth of the coherence func-tion and SNR functions as you change the damping of the sine wave?