ModuleIII Lab

Signaland noise: coherenceanalysis

The coerehncemeasures the energy in the measured output caused by the

input. It is a measure of the SNR as a function of the frequency. It is

determined using average spectra for an ensemble of signals.

Two cases:

1. noise out of the range of frequency of the signal

2. noise in of the range of frequency of the signal

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

noise out of the range of frequency of the signal

demo_17

High SNRlow SNR

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

amplitude

d

i segnali, low SNR (high noise)

0

0.5

1

amplitude

0

0.5

1

amplitude

0

0.5

1

time [s]

amplitude

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

amplitude

u

ples, high SNR (low noise)

0

0.5

1

amplitude

0

0.5

1

amplitude

0

0.5

1

time [s]

amplitude

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

noise out of the range of frequency of the signal (2)

The noisedoesnotinfluence

the signalcoherencyin the

rangeoffrequencieswhere

the signalisstrong

Thismeansthatwherethe

coherenceiscloseto1 the

output isrepresentativeof

the system and the noise

doesnotdisturbevenifthe

SNR islow

0

50

100

150

200

0

0.2

0.4

0.6

0.8

1

coherence

signal coherence high SNR (low noise)

0

50

100

150

200

0

0.2

0.4

0.6

0.8

1

frequency [Hz]

coherence

signal coherence low SNR (high noise)

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

noise in the range of frequency of the signal

The SNR islow, and the noiseiswithinthe rangeoffrequencyofthe system

demo_18

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

0

0.5

1

amplitude

0

0.5

1

amplitude

0

0.5

1

amplitude

signals

0

0.5

1

time [s]

amplitude

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

0

0.5

1

time [s]

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

0

50

100

150

200

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

frequency [Hz]

coherence

signal coherence low SNR (high noise)

noise in the range of frequency of the signal (2)

The coherenceisclose(butlower)

than1 in a smallerrangeof

frequencies, wherethe output can

stillbeconsideredrepresentative

ofthe system, butthe noiseisnow

disturbingin the rangeof

frequenciesofthe system

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

A filterin the frequencydomain isa windowW thatpassesselectedfrequency

componentsX

n, rejectingthe others. Itisa pointbypointmultiplication

The trasformedY isconvertedback tothe timedomain intoy(t).

Filterscan alter the amplitudespectrum, the phasespectrumor both,

dependingon the filtercoefficientsW

n.

Filters

nnn

WXY

=

×

=

frequency

frequency

frequency

1

Y(f)

X(f)

W(f)

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

Filters(2)

A filterisasa matteroffacta LTI system, and can beimplementedin the time

domain throughitsh(t) function.

Unfortunately, the anti-transformofa box windowisa sincfunction:

Whichwouldimplytoconvolvethe originalsignalwitha veryhighlyoscillating

function(sync)

*

=

time

time

x(t)

w(t)

y(t)

time

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

Filters(3)

In ordertoavoidsuchoscillationsin the filteredsignal, smootherwindows are

usedtofilter, e.g.:

1. Hamming

2. Hanning

3. Butterworth

4. Blackmann-Harris

5. etc…

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

FilterTypes

Accordingtothe rejectedrangesoffrequencies, filtersmaybe:

1. Low pass

2. High pass

3. band-pass

4. band-reject(e.g. notch)

5. all-pass(effectsonlyon the phases)

The transitionregion“pass”to“reject”maybemore or lessgradual.

The “cutoff”frequencycorrespondstoa reductionin the signalmagnitudeof

-3dB, i.e. aboutofthe 70%.

Anotherclassificationis:

1. IIR filters(Infinite ImpulseResponseFilter): cause a nonlinearphase

distorsion

2. FIR filters(Finite ImpulseResponseFilter): cause a linearphasedistorsion

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

Zero-phasefilterimplementation

In order to eliminate phase distortion in the filtering process,special

algorithms are implemented.

E.g. the matlab“filtfilt”function uses the information in the signal at points

before and after the current point, in essence “looking into the future,”to

eliminate phase distortion.

The function filtfiltperforms zero-phase digital filtering by processing the input

data in both the forward and reverse directions. After filteringthe data in the

forward direction, filtfiltreverses the filtered sequence and runs it back

through the filter.

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

DigitalFilterTransfer Function

The transfer function is a frequency domain representation of a digital filter,

expressing the filter as a ratio of two polynomials. It is the principal

discrete-time model for filter implementation:

The constants bi

and ai

are the filter coefficients, and the ORDER OF THE

FILTER is the maximum of na

and nb.

()()()

()

zX

zazaa

zbzbb

zXzHzY

a

a

b

b

n

n

n

n

−

+

−

−

+

−

+++

+++

==

1

1

21

1

1

21

...

...

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

DigitalFilterTransfer Function(2)

When constructing a filter of given transfer function, some filter requirements

traditionally include passbandripple (Rp, in decibels), stopbandattenuation

(Rs, in decibels), and transition width (Ws-Wp, in Hertz).

This means find filter coefficients fitting specified requirements

NOTE:when constructing a filter very strict requirements, ALWAYS check

the filter response, in order to avoid unexpected filter response due to non-

convergence of parameters

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ClassicalIIR filterTypes

BUTTERWORTH FILTER

provides the best Taylor Series

approximation to the ideal lowpass

filter. Response is monotonic overall,

decreasing smoothly.

CHEBYSHEV TYPE I FILTER

minimizes the absolute difference btw

the ideal and actual frequency

response over the entire passband

by incorporating an equal ripple of

RpdB in the passband. Stopband

response is maximally flat.

The transition from passbandto

stopbandis more rapid than for the

butterworth.

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

CHEBYSHEV TYPE II FILTER

minimizes the absolute difference btw the

ideal and actual frequency response

over the entire stopband, by

incorporating an equal ripple of RsdB in

the stopband. Passbandresponse is

maximally flat.

The stopbanddoes not approach zero as

quickly as the type I filter. The absence

of ripple in the passband, however, is

often an important advantage.

ELLIPTIC FILTERS

are equiripplein both the passbandand

stopband. They generally meet filter

requirements with the lowest order of

many other filter types.

Given a filter order n, passbandripple Rpin

decibels, and stopbandripple Rsin

decibels, elliptic filters minimize

transition width.

ClassicalIIR filterTypes(2)

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

FIR Filters

have both advantages and disadvantages compared to IIR filters.

FIR filters have the following primary advantages:

1. They can have exactly linear phase.

2. They are always stable.

3. The design methods are generally linear.

4. They can be realized efficiently in hardware.

5. The filter startup transients have finite duration.

The primary disadvantage of FIR filters is that they often require a much

higher filter order than IIR filters to achieve a given level ofperformance.

Correspondingly, the delay of these filters is often much greater than for an

equal performance IIR filter.

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Filteringtoeliminate noise

demo_19

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-10

-5

0

5

10

filtered signal

time [s]

amplitude

original

filtered

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-10

-5

0

5

10

noisy signal

time [s]

amplitude

0

50

100

150

200

0

0.2

0.4

0.6

0.8

1

1.2

FFT signal

frequency [Hz]

amplitude

0

50

100

150

200

0

0.2

0.4

0.6

0.8

1

FFT ideal filter

frequency [Hz]

amplitude

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Filterimplementation

demo_20

NOTE: when constructing a filter very strict requirements, ALWAYS check the

filter response, in order to avoid unexpected filter response due to non-

convergence of parameters

Compare FIR1 and Butterworth

Filter response for different

Lowpassfrequencies

FIR filter are always stable

0

10

20

30

0

0.5

1

1.5

frequency [Hz]

Amplitude Response

Filter Frequency Response - lp=10Hz

Butterworth

FIR1

0

20

40

0

0.5

1

1.5

2

frequency [Hz]

Amplitude Response

Filter Frequency Response - lp=16Hz

Butterworth

FIR1

0

20

40

0

0.5

1

1.5

frequency [Hz]

Amplitude Response

Filter Frequency Response - lp=18Hz

Butterworth

FIR1

0

20

40

60

0

0.5

1

1.5

frequency [Hz]

Amplitude Response

Filter Frequency Response - lp=25Hz

Butterworth

FIR1

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Oftenthe filterresponseis

visualizedin the DB scale:

0 dBresponse=1

(passband)

-100 dBresponse10

-5

(stopband)

Note

FIR1 linearphase

Butterworthnonlinearphase

0

10

20

30

40

50

60

70

-2000

-1500

-1000

-500

0

Frequency (Hz)

Phase (degrees)

0

10

20

30

40

50

60

70

-150

-100

-50

0

Frequency (Hz)

Magnitude (dB)

Filter Frequency Response - lp=25Hz

Butterworth

FIR1

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

TimeVariationand Nonlinearity

The DFT doesnotgiveanytiming-relatedinformation drawbackfor

Nonlinear-timevariantsystems, wheretime-varying

frequency/amplitudecontent, and/or abruptchangesin the system

responsecan beencountered.

Techniquesforthe analysisofnonstationarysignalsinclude:

1. Short-TimeFourier Transform

2. band-pass filters

3. Waveletanalysis

Suchtechniquesconvertthe 1D array

in time-domainintoa 2D arrayin the

time-frequencyspacein ordertocapture

the time-varyingnature ofthe signal

numero d'onda [rad/m]

frequenza [Hz]

0

0.5

1

1.5

2

2.5

3

0

5

10

15

20

25

30

35

40

45

50

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

Samplingat 40000 Hz itispossibleto

seethe frequencyincreasing

Samplingat 10000 Hz, after5000 Hz

(fnyq), fakefrequenciesare seen,

due tothe undersamplingofthe

signal(aliasingeffect)

time [s]

frequency [Hz]

0

1

2

3

4

0

0.5

1

1.5

2

x 10

4

time [s]

frequency [Hz]

0

1

2

3

4

0

0.5

1

1.5

2

x 10

4

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

STFT (Gabor, 1946)

Drawbacks in the global DFT (computed along the entire NL-TV signal) can be

decreased by extracting time windows of the original signal and analysing

each window in the frequency domain.

the k-thDFT of the k-thwindowed signal defines a matrix of

SHORT-TIME FOURIER TRANSFORMS (STFT)of the original signal

a 3D plot is obtained in which time-frequency and DFTsare plotted on the

three axes, also called SPECTROGRAM

∫

+∞

∞−

−−=dtftjtgtxfSTFTx

)2exp()()(),(

*

πττ

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

STFT (2)

The STFT:

1. Map the signal in a 2D space time-frequency

2. Gives information on the evolution of the signal frequency content

3. Care should be done in selecting the time window length and overlapping

Windowlength: M Δt

Windowseparationq Δt

FrequencyresolutionΔfres

>≅1/M Δt

Longerwindows enhancethe frequencyresolutionbutcompriselongertime

segments, worseningthe timeresolutionand leadingtoinaccuracy.

TimeresolutionΔtres

> M Δt/2

A goodtradeoff betweentimeand frequencyresolutionissuchthat:

Δfres

Δtres

> 1/2

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Time-frequencyanalysis

demo_21

Whenthe frequencycontentofa signalvarieswithtime(nonstationary

signals, nonlinearsystems, etc…), anothertypeofrepresentationis

needed.

Letsconsider3

Harmoniccomponents

0

0.2

0.4

0.6

0.8

1

-1

0

1

time [Hz]

amplitude

s

1, f=5Hz (stationary periodic signal)

0

0.2

0.4

0.6

0.8

1

-1

0

1

time [Hz]

amplitude

s

2

, f=20Hz (stationary periodic signal)

0

0.2

0.4

0.6

0.8

1

-1

0

1

time [Hz]

amplitude

s

3

, f=50Hz (stationary periodic signal)

0

1

2

3

4

5

0

0.5

1

time [s]

s

1

amplitude

signals windowing components

nonstationary

stationary

0

1

2

3

4

5

0

0.5

1

time [s]

s

2

amplitude

0

1

2

3

4

5

0

0.5

1

time [s]

s

3

amplitude

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Time-frequencyanalysis(2)

1. Stationarysignal, frequency

contentconstantin time

2. Nonstationarysignal, frequency

contentvaryingwithtime

0

1

2

3

4

5

-2

-1

0

1

2

time [Hz]

amplitude

s1

s2

s

3

s2

nonstationary

0

1

2

3

4

5

-2

-1

0

1

2

time [Hz]

amplitude

(2/5)*s

1

+(2/5)*s

2+(1/5)*s

3

signals in time domain

stationary

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Time-frequencyanalysis(3)

FFT withequalfrequencycontent

The frequencyanalysisdoesnotgive

anytiming information!!!

0

20

40

60

80

100

0

0.2

0.4

frequency [Hz]

amplitude

nonstationary

0

20

40

60

80

100

0

0.2

0.4

frequency [Hz]

amplitude

FFT

stationary

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

ModuleIII Lab

Time-frequencyanalysis: STFT

The STFT is able to detect the

variation of the frequency content

with time

1. Stationary signal, frequency

content constant in time

2. Nonstationarysignal, frequency

content varying with time

time [s]

frequency [Hz]

0

1

2

3

4

0

20

40

60

80

0.2

0.4

0.6

0.8

time [s]

frequency [Hz]

time-frequency analysis

0

1

2

3

4

0

20

40

60

80

0.1

0.2

0.3

SEISMIC ENGINEERING RESEARCH INFRASTRUCTURES FOR EUROPEAN SYNERGIES

Preparatory Course: experimental testing and theoretical background –17/19 March 2010

References

J. C. Santamarina, D. Fratta, 2005. Discrete Signals and Inverse Problems:

An Introduction for Engineers and Scientists. Wiley

L. Lo Presti, F. Neri, 1992. L'analisideisegnali. CLUT

The Mathworks, 2007. Signal processing Toolbox, User’s Guide

R.W. Clough, J. Penzien, 1993. Dynamics of Structures

J. Shao, 2003. Mathematical Statistics