CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

48
CHEE825 Fall 2 005 J. McLellan 1 Spectral Analysis and Input Signal Design

Transcript of CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

Page 1: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 1

Spectral Analysis and Input Signal Design

Page 2: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 2

Outline

• Fourier series• Fourier transforms

» continuous» discrete

• frequency spectrum• spectra and dynamic elements• input signal design in the frequency domain

Page 3: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 3

Projection of Vectors

Suppose we have a vector u, and we want to approximate it as the sum of two orthonormal vectors v and w -

- optimal solution in least squares sense

where < , > is an inner product (dot product)• residual is orthogonal to space spanned by v and w

wwuvvuu ><+>≈< ,,

Page 4: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 4

Projection of Vectors

Pictureu

v

w

space spanned by v and w

Page 5: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 5

Periodic Functions and Inner Products

Defn: A function f(t) is periodic if f(t+T) = f(t).

Suppose the period of the function is T, and define the following inner product for functions defined on [-T/2,T/2]:

• functions on this interval are now the vectors • this inner product maps vectors (functions on the

interval) into real numbers

∫>=<−

2/

2/)()(

1,

T

Tdttgtf

Tgf

Page 6: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 6

Orthogonal Bases of Periodic Functions

Example

{sin(kt), cos(kt)} form an orthogonal basis with respect to this inner product - with T= 2

Example

{ } form an orthonormal basis with respect to the following inner product

where overbar denotes complex conjugate, and

tjke ω

∫>=<−

2/

2/

___)()(

1,

T

Tdttggf

Tgf

ω2

=T

Page 7: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 7

Approximation of Periodic Functions

If we have a function with period T, choose sinusoids (or complex sinusoids) with frequencies that are multiples of

in order align basis with period of function.

The orthogonal basis is now { }

Fourier series can be developed in terms of sines and cosines, or in terms of exponentials

» exponentials are more succinct, and I will use these.

Tω 2

0 =

tjke 0ω

Page 8: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 8

Fourier Series

Given the orthogonal basis { }, we can approximate the periodic function f(t) with period T as

tjke 0ω

∫>==<=

∑≈

−∞=

2/

2/0

00

0

)(1

),(,2

)(

T

T

tjkk

k

tjkk

tjketf

Tetfcand

T

where

ectf

ωω

ω

πω

Page 9: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 9

Fourier Series

Conceptual analogy

wwuvvuu ><+>≈< ,,

v

w

space spanned by v and w

∫>==<

+≈

−2/

2/

221

00

00

)(1

),(

)(

T

T

tjkk

tjtj

tjketf

Tetfc

whereecectf

ωω

ωω

Page 10: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 10

Fourier Series

• Issues– convergence– functions that can be approximated– definition of integral

Page 11: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 11

What if f(t) is non-periodic?

Suppose f(t) is defined on an interval [-T/2, T/2] but is not periodic. To create a periodic function, define the periodic extension of f(t):

“cut and paste” to create periodic function defined on real line

⎩⎨⎧

±±=++−∈+−∈

=K,2,1],2/,2/[)(

]2/,2/[)()(*

llTTlTTtlTtf

TTttftf

Page 12: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 12

Fourier Series of Non-Periodic Functions

Work with periodic extension:

∫>==<

>=<=

∑≈

−∞=

2/

2/

*0

*

00

0

0

)(1

),(

),(,2

)(

T

T

tjk

tjkk

k

tjkk

tjketf

Tetf

etfcandT

where

ectf

ωω

ω

ω

πω

Page 13: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 13

Towards the Fourier Transform

Note that if the fundamental frequency is

then and we can write the Fourier series for f*(t) as

Tω 2

0 =

0

2ω=T

∑ ⎟⎟⎠

⎞⎜⎜⎝

⎛∫=

∑≈

−∞= −

−∞=

k

tjkT

T

k

tjkk

eetf

ectf

tjk00

0

2/

2/

0

*

)(2

)(

ω

ω

ω

πω

Page 14: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 14

Towards the Fourier Transform

What if we let ?

Now

∞→T

00 →⇒ ω

which is in the form of a Riemann sum

Page 15: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 15

Towards the Fourier Transform

Riemann sum

Now0ωδ =

∫ ⎟⎟⎠

⎞⎜⎜⎝

⎛∫=

∫=∑=

∑=

∞−

∞−

∞−

−∞=→

−∞=∞→

ω

ωω

ω

ωω

ωωω

ω

dedtetf

dee

etf

tjtj

tj

k

tjk

k

tjk

T

)(21

lim

lim)(

00

0

0

0

0

Page 16: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 16

Fourier Transform

Given function f(t), define F(w) as the Fourier transform of f(t):

∫=ℑ=

∫=ℑ=

∞−

∞−

ωωω

ω

ω

ω

deFFtf

dtetftfF

tj

tj

)()(()(

)(21

))(()(

1

Page 17: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 17

Fourier Transforms of Sampled Signals

Suppose that f(t) is sampled at a sampling period Ts, i.e., we have { f(kTs) }. In order to take the Fourier transform of the sampled signal, we can paste it back together using the impulse sampling representation:

∑ −=∞

−∞=kss kTtkTftf )()()(

paste together using“stick” functions - impulsefunction

Page 18: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 18

Towards the Discrete Fourier Transform

Now take the Fourier transform of the impulse-sampled function:

∑=

∫ ⎟⎟⎠

⎞⎜⎜⎝

⎛∑ −=

∫=

−∞=

∞−

−∞

−∞=

∞−

k

kTjs

tj

kss

tj

sekTf

dtekTtkTf

dtetfF

ω

ω

ω

π

δπ

πω

)(21

)()(21

)(~

21

)(

Page 19: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 19

Discrete Fourier Transform

Given a sampled signal { f(kTs) },

Note that because of sampling, we have periodicity on the interval so we need only consider F(w) on this interval.

∫=

∑=

∞−

−∞=

ωω

ω

ω

ω

deFkTf

ekTfF

s

s

kTjs

k

kTjs

)()(

)(21

)(

],[ −

Page 20: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 20

Energy in a Signal

Given a continuous signal f(t) defined on [-T/2,T/2], the squared magnitude (norm) of the signal can be defined in terms of the inner product:

In terms of the Fourier series representation of f(t), this yields

dttftfT

tftftfT

T∫>==<

− 2/

____2 )()(1)(),()(

∑=

>∑∑=<∞

−∞=kk

ktjk

ktjk

c

ecectf

2

2 00 ,)( ωω

where__

2kkk ccc =

Parseval’s Relation

Page 21: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 21

Energy in a Signal

The Fourier coefficients describe the breakout of energy in the signal by frequency. We can plot them as a function of frequency.

E.g., for the sawtooth wave expansion -

Energy is distributedat low frequencies

Page 22: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 22

Energy in a Signal - via Fourier Transform

We can examine the frequency content in a signal via the Fourier transform by plotting versus frequency.

We can follow a similar approach using the Discrete Fourier Transform (DFT) to analyze the energy distribution by frequency in a sampled signal.

2)(ωF

Page 23: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 23

The Spectrum of a Stochastic Signal

The spectrum (spectral density) of a stochastic signal is defined as the discrete Fourier transform of its autocovariance function:

∑=

−∞=

k

kjy

yy

ek

kDFT

ωγπ

γω

)(21

))(()(

Page 24: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 24

Properties of the Spectrum

1. Since the autocovariance is an even function

the spectrum is a real-valued function.

Why? - next slide

2. Since cos is an even function, the spectrum is symmetric about the origin.

)()( kk yy −=γγ

Page 25: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 25

Why?

)}0())(cos((2{21

)}0())sin())(cos(())sin())(cos(({21

)}0())sin())(cos(())sin())(cos(({21

)(21

)(

1

1

1

1

1

yk

y

yk

yk

y

yk

yk

y

k

kjyy

ktk

ktjktkktjktk

ktjktkktjktk

ek

γωγ

γωωγωωγ

γωωγωωγ

γ

ω ω

+∑=

+−∑++∑=

++∑++∑=

∑=Φ

=

−∞=

=

−∞=

=

−∞=

Page 26: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 26

Example - Spectrum of an MA(1) Disturbance

The MA(1) model is:

with autocovariance function:

)1()()( −−= tataty θ

⎪⎩

⎪⎨

>=−

=+=

10

1

0)1(

)( 2

22

kfor

kfor

kfor

k a

a

y θσ

σθ

γ

Page 27: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 27

Example - Spectrum of MA(1) Disturbance

Taking the DFT:

Maple demo

Page 28: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 28

Variance and the Spectrum

We can recover the variance of the signal from the spectrum.

Since we have the Fourier transform pair,

then

∫Φ=

∑==Φ

∞−

−∞=

ωωγ

γ

γω

ω

ω

dek

ekkDFT

kjyy

k

kjyyy

)()(

)(21

))(()(

∫Φ=∫Φ==∞

∞−

∞−ωωωωσγ ω dde y

jyyy )()()0( 02

The variance is the area under the spectrum.

Page 29: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 29

Spectra and Transfer Functions

For single-input single-output transfer functions, we have the following:

where

)()()(

)()()(2

ωω ωu

jy eG

tuqGty

Φ=Φ

=

)()()()()(______

2 ωωωωω jjjjj eGeGeGeGeG −==

Page 30: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 30

Check - MA(1) Disturbance

Starting from the transfer function, we have

Since

we have

)cos(21

)1)(1()(

2

2

ωθθ

θθ ωωω

−+=

−−= −jjj eeeG

σωθθω2

))cos(21()(2

2 ay −+=Φ

σω2

)(2a

a =Φ

Page 31: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 31

Sample Spectrum

The spectrum can be estimated from sample autocovariance functions - “sample spectrum”.

Note that the Fourier transform is taken over a finite record length– sample spectrum is an asymptotically unbiased estimator for

the spectrum, in part because the sample autocovariance is an asymptotically unbiased estimator for the autocovariance

Smoothing can be applied to the sample spectrum– involves weighting sample spectra values

∑=−

−−=

−1

)1()(ˆ

21

)(ˆn

nk

kjekf ωγπ

ω

Page 32: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 32

Periodograms

… are direct analyses of the frequency content in a signal

» compute directly from data, instead of via the sample autocovariance function

• compute Fourier series over the finite data record length – requires inner product over the finite data record length, and

different complex exponential basis functions that are orthogonal over the data record

– basis functions are t

nk

je

2

Page 33: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 33

Periodograms

Fourier series coefficients are computed for the series in terms these basis functions

• squared magnitudes of coefficients vs. frequency (term number)

• indicates frequency breakdown in data

Page 34: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 34

The Cross-Spectrum

… is defined in a manner similar to the (auto)spectrum. Given the cross-covariance function between stochastic signals y and u,

Transfer function relationship:

kj

kyuyuyu ekkDFT ωγ

γω −∞

−∞=∑==Φ )(

21))(()(

)()()(

)()()(

ωω ωu

jyu eG

tuqGty

Φ=Φ

=

Page 35: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 35

The Cross-Spectrum

Note - Since the cross-covariance function is not necessarily even (symmetric about the origin), in general the cross-spectrum will be complex-valued

Consider - • Co-spectrum - real component• Quadrature spectrum - imaginary component

OR…• Amplitude spectrum - magnitude• Phase spectrum - phase angle

Page 36: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 36

Input Signal Design

Recall our general process+disturbance model:

and the prediction error formulation:

If our model structure is correct, then with perfect knowledge of the parameters, {e(t)} would be the random shocks driving the disturbance.

What happens if there are differences in model structure?

)()()()()( teqHtuqGty +=

))()()(()(

1)( tuqGty

qHte −=

Page 37: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 37

Input Signal Design

Model Bias Case:

True plant -

where {a(t)} is an iid random shock sequence.

Examining the prediction errors under this scenario,

)()()()()( 00 taqHtuqGty +=

Page 38: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 38

Input Signal Design

The spectrum of the residuals {e(t)} is related to that of the input and random shocks:

We can express the variance of the residuals as:

)()(

)()(

)(

))()(()(

20

20 ωωω ω

ω

ω

ωωaj

j

uj

jj

eeH

eH

eH

eGeG Φ+Φ−=Φ

ωωω ω

ω

ω

ωωd

eH

eH

eH

eGeGteVar aj

j

uj

jj

∫⎟⎟⎟

⎜⎜⎜

⎛Φ+Φ

−=

∞−)(

)(

)()(

)(

))()(())((

20

20

Page 39: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 39

Input Signal Design

Expanding

The impact of the input signal design on residual variance due to model bias is

∫+∫ Φ−=

∫ Φ+∫ Φ−=

∞−

∞−

∞−

∞−

ω

σωω

ωωωω

ω

ω

ω

ωω

ω

ω

ω

ωω

deH

eHd

eH

eGeG

deH

eHd

eH

eGeGteVar

j

ja

uj

jj

aj

j

uj

jj

20

220

20

20

)(

)(2

)()(

))()((

)()(

)()(

)(

))()(())((

ωωω

ωωd

eH

eGeGteVar uj

jj

∫ Φ−

=∞

∞−)(

)(

))()(())((

20

Page 40: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 40

Bias-Oriented Designs

If we choose a low frequency test signal, we are penalizing the prediction of low frequency process behaviour the greatest

» bias will be reduced in low frequency range

Recall our design cost function discussion earlier ...

Page 41: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 41

Experimental Design Objective

Design input sequence to minimize the following:

design

cost

error in

predicted frequency response

importance

function

our designobjectives

difference in predicted vs.true behaviour- function of frequency, andthe input signal used

Page 42: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 42

Accounting for Model Error - Interpretation

Optimal solution in terms of frequency content:

spectral density

frequencyerror in model vs.true process

spectral density

frequency

importance to ourapplication

low

highvery important

not important*J=

Page 43: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 43

Accounting for Model Error

Consider frequency content matching

Goal - best model for final application is obtained by minimizing J

J G e G e C j dj T j T

frequencyrange

∫ $( ) ( ) ( )ω ω ω ω2}

bias in frequencycontent modeling

}

importanceof matching- weightingfunction

Page 44: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 44

Example - Importance Function for Model Predictive Control

spectral density

frequency

high frequency disturbance rejectionperformed by base-levelcontrollers- > accuracy not importantin this range

require good estimateof steady state gain,slower dynamics

Page 45: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 45

Bias-Oriented Designs in Closed-Loop ID

Recall from earlier that in the case of a dither signal w(t) introduced in closed-loop experimentation, our input is effectively

The model is estimated between u(t) and y(t) pretending that it is open-loop:

and the prediction error expression is again

)()()(1

1)( tw

qGqGtu

c+=

)()()()()( teqHtuqGty +=

))()()(()(

1)( tuqGty

qHte −=

Page 46: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 46

Bias-Oriented Designs in Closed-Loop ID

Now the output in this instance is

and this leads to

which can be simplified to:

)()()(1

)()(

)()(1)(

)(0

0

0

0 taqGqG

qHtw

qGqGqG

tycc +

++

=

)()()(1

)()(

1)()()(

)()(1)(

)(1

)(0

0

0

0 taqGqG

qHqH

tuqGtwqGqG

qGqH

tecc

⎟⎟⎠

⎞⎜⎜⎝

⎛+

+⎟⎟⎠

⎞⎜⎜⎝

⎛−

+=

)()()(1

)()(

1)(

)()(1)()(

)(1

)(0

0

0

0 taqGqG

qHqH

twqGqG

qGqGqH

tecc

⎟⎟⎠

⎞⎜⎜⎝

⎛+

+⎟⎟⎠

⎞⎜⎜⎝

⎛+

−=

Page 47: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 47

Bias-Oriented Designs in Closed-Loop ID

The variance of the residuals is:

The imposition of closed-loop experimentation essentially introduces additional weighting by the “sensitivity function” of the true plant:

∫+

+

∫ Φ+

−=

∞−

∞−

ω

σ

ωω

ωωω

ω

ωωω

ωω

deGeGeH

eH

deGeGeH

eGeGteVar

jc

jj

ja

wjc

jj

jj

2

0

02

2

0

0

))()(1)((

)(2

)())()(1)((

))()(())((

)()(11

0 qGqG c+

Page 48: CHEE825 Fall 2005J. McLellan1 Spectral Analysis and Input Signal Design.

CHEE825 Fall 2005 J. McLellan 48

Bias-Oriented Designs in Closed-Loop ID

Running the experiment in closed-loop introduces a component in the “importance function” that weights frequency prediction in the range associated with disturbance rejection / setpoint tracking.