You are on page 1of 56

System Identification

Lecture Week 4

Dr. Mian Ilyas Ahmad

Associate Professor,
RCMS, NUST Pakistan
m.ilyas@rcms.nust.edu.pk

M.I.Ahmad (RCMS) 1 / 13
Last Week

Response identification
Impulse response identification
Step response identification
Sine wave response identification
Correlation Methods

M.I.Ahmad (RCMS) 2 / 13
Current Week

Impulse response identification using Weiner Hopf Equation

M.I.Ahmad (RCMS) 3 / 13
Current Week

Impulse response identification using Weiner Hopf Equation


Filter properties of Weiner Hopf Equation

M.I.Ahmad (RCMS) 3 / 13
Current Week

Impulse response identification using Weiner Hopf Equation


Filter properties of Weiner Hopf Equation
MATLAB Implementation

M.I.Ahmad (RCMS) 3 / 13
Current Week

Impulse response identification using Weiner Hopf Equation


Filter properties of Weiner Hopf Equation
MATLAB Implementation
Frequency Response Identification using Correlations

M.I.Ahmad (RCMS) 3 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

M.I.Ahmad (RCMS) 4 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

Impulse Response Identification using Weiner Hopf Equation


Assume that the first s elements of g (k) are enough to determine the
response of a stable system

M.I.Ahmad (RCMS) 4 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

Impulse Response Identification using Weiner Hopf Equation


Assume that the first s elements of g (k) are enough to determine the
response of a stable system
s
X
ruy (l) = g (k)ruu (l − k)
k=0

M.I.Ahmad (RCMS) 4 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

Impulse Response Identification using Weiner Hopf Equation


Assume that the first s elements of g (k) are enough to determine the
response of a stable system
s
X
ruy (l) = g (k)ruu (l − k)
k=0

If input and output measurements are given from 0 to N, we need to


compute ruy (l) and ruu (l).

M.I.Ahmad (RCMS) 4 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

Impulse Response Identification using Weiner Hopf Equation


Assume that the first s elements of g (k) are enough to determine the
response of a stable system
s
X
ruy (l) = g (k)ruu (l − k)
k=0

If input and output measurements are given from 0 to N, we need to


compute ruy (l) and ruu (l).
To ignore the effect of initial condition, the first M measurements are
often removed.

M.I.Ahmad (RCMS) 4 / 13
Nonparametric Identification - LTI Systems
Weiner Hopf Equation

X
ruy (l) = g (k)ruu (l − k)
k=0

Impulse Response Identification using Weiner Hopf Equation


Assume that the first s elements of g (k) are enough to determine the
response of a stable system
s
X
ruy (l) = g (k)ruu (l − k)
k=0

If input and output measurements are given from 0 to N, we need to


compute ruy (l) and ruu (l).
To ignore the effect of initial condition, the first M measurements are
often removed.
Knowing that we have (u(M), y (M)), . . . , (u(N), y (N))
measurements, the correlations are written as
N−l
M.I.Ahmad (RCMS) 1 X
4 / 13
r (l) ≈ u(i)u(i + l)
Nonparametric Identification - LTI Systems
Impulse Response Identification using Weiner Hopf Equation

Then using the Weiner Hopf equation, we have

M.I.Ahmad (RCMS) 5 / 13
Nonparametric Identification - LTI Systems
Impulse Response Identification using Weiner Hopf Equation

Then using the Weiner Hopf equation, we have


ruy (0) = g (0)ruu (0) + g (1)ruu (−1) + . . . + g (s)ruu (−s)

.
.
.
ruy (s) = g (0)ruu (s) + g (1)ruu (s − 1) + . . . + g (s)ruu (0)

M.I.Ahmad (RCMS) 5 / 13
Nonparametric Identification - LTI Systems
Impulse Response Identification using Weiner Hopf Equation

Then using the Weiner Hopf equation, we have


ruy (0) = g (0)ruu (0) + g (1)ruu (−1) + . . . + g (s)ruu (−s)

.
.
.
ruy (s) = g (0)ruu (s) + g (1)ruu (s − 1) + . . . + g (s)ruu (0)

In matrix form, we can write

M.I.Ahmad (RCMS) 5 / 13
Nonparametric Identification - LTI Systems
Impulse Response Identification using Weiner Hopf Equation

Then using the Weiner Hopf equation, we have


ruy (0) = g (0)ruu (0) + g (1)ruu (−1) + . . . + g (s)ruu (−s)

.
.
.
ruy (s) = g (0)ruu (s) + g (1)ruu (s − 1) + . . . + g (s)ruu (0)

In matrix form, we can write


ruu (0) ruu (−1) ··· ruu (−s)
 
ruy (0) g (0)
   
ruu (1) ruu (0) ··· ruu (1 − s)
 .. 
    . 
=  .
 . . . .   .. 
  
 . 
 . . .. .
. . 
ruy (s) g (s)
ruu (s) ruu (s − 1) ··· ruu (0)
ruy = Ruu g

M.I.Ahmad (RCMS) 5 / 13
Nonparametric Identification - LTI Systems
Impulse Response Identification using Weiner Hopf Equation

Then using the Weiner Hopf equation, we have


ruy (0) = g (0)ruu (0) + g (1)ruu (−1) + . . . + g (s)ruu (−s)

.
.
.
ruy (s) = g (0)ruu (s) + g (1)ruu (s − 1) + . . . + g (s)ruu (0)

In matrix form, we can write


ruu (0) ruu (−1) ··· ruu (−s)
 
ruy (0) g (0)
   
ruu (1) ruu (0) ··· ruu (1 − s)
 .. 
    . 
=  .
 . . . .   .. 
  
 . 
 . . .. .
. . 
ruy (s) g (s)
ruu (s) ruu (s − 1) ··· ruu (0)
ruy = Ruu g

This can be solved for g using any linear solver.


M.I.Ahmad (RCMS) 5 / 13
Nonparametric Identification - LTI Systems

Impulse Response Identification using Weiner Hopf Equation

1 Ruu matrix is symmetric as ruu (l) = ruu (−l), if l  N

M.I.Ahmad (RCMS) 6 / 13
Nonparametric Identification - LTI Systems

Impulse Response Identification using Weiner Hopf Equation

1 Ruu matrix is symmetric as ruu (l) = ruu (−l), if l  N


N−l
1 X
ruu (l) = u(i)u(i + l)
N − l i=1

M.I.Ahmad (RCMS) 6 / 13
Nonparametric Identification - LTI Systems

Impulse Response Identification using Weiner Hopf Equation

1 Ruu matrix is symmetric as ruu (l) = ruu (−l), if l  N


N−l
1 X
ruu (l) = u(i)u(i + l)
N − l i=1
N−l N−2l
1 X 1 X
ruu (−l) = u(i)u(i − l) = u(j + l)u(j)
N − l i=1 N − l j=1−l

M.I.Ahmad (RCMS) 6 / 13
Nonparametric Identification - LTI Systems

Impulse Response Identification using Weiner Hopf Equation

1 Ruu matrix is symmetric as ruu (l) = ruu (−l), if l  N


N−l
1 X
ruu (l) = u(i)u(i + l)
N − l i=1
N−l N−2l
1 X 1 X
ruu (−l) = u(i)u(i − l) = u(j + l)u(j)
N − l i=1 N − l j=1−l

N−l
1 X
ruu (−l) = u(j)u(j + l) [l  N]
N − l j=1

M.I.Ahmad (RCMS) 6 / 13
Nonparametric Identification - LTI Systems

Impulse Response Identification using Weiner Hopf Equation

1 Ruu matrix is symmetric as ruu (l) = ruu (−l), if l  N


N−l
1 X
ruu (l) = u(i)u(i + l)
N − l i=1
N−l N−2l
1 X 1 X
ruu (−l) = u(i)u(i − l) = u(j + l)u(j)
N − l i=1 N − l j=1−l

N−l
1 X
ruu (−l) = u(j)u(j + l) [l  N]
N − l j=1

2 If u(t) is equal to a unit impulse, than ruu (0) = 1 and ruu (l) = 0 for
l 6= 0. This means that Ruu is identity matrix and ruy = g

M.I.Ahmad (RCMS) 6 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate an arbitrary input u(t), t = 1, . . . , N

M.I.Ahmad (RCMS) 7 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate an arbitrary input u(t), t = 1, . . . , N


Measure u(t) and corresponding y (t).

M.I.Ahmad (RCMS) 7 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate an arbitrary input u(t), t = 1, . . . , N


Measure u(t) and corresponding y (t).
Calculate sampled auto and cross-correlations for l = 0, . . . , s

M.I.Ahmad (RCMS) 7 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate an arbitrary input u(t), t = 1, . . . , N


Measure u(t) and corresponding y (t).
Calculate sampled auto and cross-correlations for l = 0, . . . , s
Form ruy and Ruu from the sampled correlations.

M.I.Ahmad (RCMS) 7 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate an arbitrary input u(t), t = 1, . . . , N


Measure u(t) and corresponding y (t).
Calculate sampled auto and cross-correlations for l = 0, . . . , s
Form ruy and Ruu from the sampled correlations.
−1 r
Find g from g = Ruu uy

M.I.Ahmad (RCMS) 7 / 13
Nonparametric Identification - LTI Systems
Filter Properties of Weiner Hopf Equation

Why correlation and then identification of g. Why not direct


identification using u and y measurements.

M.I.Ahmad (RCMS) 8 / 13
Nonparametric Identification - LTI Systems
Filter Properties of Weiner Hopf Equation

Why correlation and then identification of g. Why not direct


identification using u and y measurements.
Suppose

y (t) = ȳ (t) + e(t)

M.I.Ahmad (RCMS) 8 / 13
Nonparametric Identification - LTI Systems
Filter Properties of Weiner Hopf Equation

Why correlation and then identification of g. Why not direct


identification using u and y measurements.
Suppose

y (t) = ȳ (t) + e(t)


N−l
1 X
ruy (l) ≈ u(i)(ȳ (i + l) + e(i + l))
N −M −l
i=M

M.I.Ahmad (RCMS) 8 / 13
Nonparametric Identification - LTI Systems
Filter Properties of Weiner Hopf Equation

Why correlation and then identification of g. Why not direct


identification using u and y measurements.
Suppose

y (t) = ȳ (t) + e(t)


N−l
1 X
ruy (l) ≈ u(i)(ȳ (i + l) + e(i + l))
N −M −l
i=M
ruy (l) ≈ ruȳ (l) + rue (l)

M.I.Ahmad (RCMS) 8 / 13
Nonparametric Identification - LTI Systems
Filter Properties of Weiner Hopf Equation

Why correlation and then identification of g. Why not direct


identification using u and y measurements.
Suppose

y (t) = ȳ (t) + e(t)


N−l
1 X
ruy (l) ≈ u(i)(ȳ (i + l) + e(i + l))
N −M −l
i=M
ruy (l) ≈ ruȳ (l) + rue (l)

As long as e is unrelated to u and has zero mean, the long term


average of u(i)e(i + l) is very likely to be close to zero.
M.I.Ahmad (RCMS) 8 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

M.I.Ahmad (RCMS) 9 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

We know that
u(t) = αsinwt → LTI Sys → y (t) = α|G (e jw )|sin(wt + φ)

M.I.Ahmad (RCMS) 9 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

We know that
u(t) = αsinwt → LTI Sys → y (t) = α|G (e jw )|sin(wt + φ)
Actual response is y (t) = α|G (e jw )|sin(wt + φ) + e(t) and it is
possible to correlate ȳ (t) out from the noise e(t)

M.I.Ahmad (RCMS) 9 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

We know that
u(t) = αsinwt → LTI Sys → y (t) = α|G (e jw )|sin(wt + φ)
Actual response is y (t) = α|G (e jw )|sin(wt + φ) + e(t) and it is
possible to correlate ȳ (t) out from the noise e(t)
We define
NT
1 X
Ys (N) = y (t)sinwt
NT + 1
t=0

M.I.Ahmad (RCMS) 9 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

We know that
u(t) = αsinwt → LTI Sys → y (t) = α|G (e jw )|sin(wt + φ)
Actual response is y (t) = α|G (e jw )|sin(wt + φ) + e(t) and it is
possible to correlate ȳ (t) out from the noise e(t)
We define
NT
1 X
Ys (N) = y (t)sinwt
NT + 1
t=0
NT
1 X
Yc (N) = y (t)coswt
NT + 1
t=0

M.I.Ahmad (RCMS) 9 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Expanding Ys (N) as
NT
1 X jw
Ys (N) = (α|G (e )|sin(wt + φ)sinwt + e(t)sinwt)
NT + 1 t=0

M.I.Ahmad (RCMS) 10 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Expanding Ys (N) as
NT
1 X jw
Ys (N) = (α|G (e )|sin(wt + φ)sinwt + e(t)sinwt)
NT + 1 t=0
NT
1 jw (cos(φ) − cos(2wt + φ))
X
Ys (N) = (α|G (e )| + e(t)sinwt)
NT + 1 t=0 2

M.I.Ahmad (RCMS) 10 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Expanding Ys (N) as
NT
1 X jw
Ys (N) = (α|G (e )|sin(wt + φ)sinwt + e(t)sinwt)
NT + 1 t=0
NT
1 jw (cos(φ) − cos(2wt + φ))
X
Ys (N) = (α|G (e )| + e(t)sinwt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Ys (N) = α|G (e )|cos(φ) − cos(2wt + φ))
NT + 1 2 NT + 1 2 t=0
NT
1 X
+ e(t)sinwt
NT + 1 t=0

M.I.Ahmad (RCMS) 10 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Expanding Ys (N) as
NT
1 X jw
Ys (N) = (α|G (e )|sin(wt + φ)sinwt + e(t)sinwt)
NT + 1 t=0
NT
1 jw (cos(φ) − cos(2wt + φ))
X
Ys (N) = (α|G (e )| + e(t)sinwt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Ys (N) = α|G (e )|cos(φ) − cos(2wt + φ))
NT + 1 2 NT + 1 2 t=0
NT
1 X
+ e(t)sinwt
NT + 1 t=0
1 jw
Ys (N) = α|G (e )|cos(φ)
2

M.I.Ahmad (RCMS) 10 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Expanding Ys (N) as
NT
1 X jw
Ys (N) = (α|G (e )|sin(wt + φ)sinwt + e(t)sinwt)
NT + 1 t=0
NT
1 jw (cos(φ) − cos(2wt + φ))
X
Ys (N) = (α|G (e )| + e(t)sinwt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Ys (N) = α|G (e )|cos(φ) − cos(2wt + φ))
NT + 1 2 NT + 1 2 t=0
NT
1 X
+ e(t)sinwt
NT + 1 t=0
1 jw
Ys (N) = α|G (e )|cos(φ)
2

Where in the 2nd last equation, the last two terms approaches zero as
N approaches infinity
M.I.Ahmad (RCMS) 10 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Similarly expanding Yc (N) as


NT
1 X jw
Yc (N) = (α|G (e )|sin(wt + φ)coswt + e(t)coswt)
NT + 1 t=0

M.I.Ahmad (RCMS) 11 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Similarly expanding Yc (N) as


NT
1 X jw
Yc (N) = (α|G (e )|sin(wt + φ)coswt + e(t)coswt)
NT + 1 t=0
NT
1 X jw (sin(2wt + φ) + sin(φ))
Yc (N) = (α|G (e )| + e(t)coswt)
NT + 1 t=0 2

M.I.Ahmad (RCMS) 11 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Similarly expanding Yc (N) as


NT
1 X jw
Yc (N) = (α|G (e )|sin(wt + φ)coswt + e(t)coswt)
NT + 1 t=0
NT
1 X jw (sin(2wt + φ) + sin(φ))
Yc (N) = (α|G (e )| + e(t)coswt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Yc (N) = α|G (e )|sin(φ) + sin(2wt + φ))
NT + 1 2 NT + 1 2 t=0

M.I.Ahmad (RCMS) 11 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Similarly expanding Yc (N) as


NT
1 X jw
Yc (N) = (α|G (e )|sin(wt + φ)coswt + e(t)coswt)
NT + 1 t=0
NT
1 X jw (sin(2wt + φ) + sin(φ))
Yc (N) = (α|G (e )| + e(t)coswt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Yc (N) = α|G (e )|sin(φ) + sin(2wt + φ))
NT + 1 2 NT + 1 2 t=0
NT
1 X
+ e(t)coswt
NT + 1 t=0
1 jw
Yc (N) = α|G (e )|sin(φ)
2

M.I.Ahmad (RCMS) 11 / 13
Nonparametric Identification - LTI Systems
Frequency Analysis Using Correlation Techniques

Similarly expanding Yc (N) as


NT
1 X jw
Yc (N) = (α|G (e )|sin(wt + φ)coswt + e(t)coswt)
NT + 1 t=0
NT
1 X jw (sin(2wt + φ) + sin(φ))
Yc (N) = (α|G (e )| + e(t)coswt)
NT + 1 t=0 2
NT
1 (NT + 1) jw 1 α|G (e jw )| X
Yc (N) = α|G (e )|sin(φ) + sin(2wt + φ))
NT + 1 2 NT + 1 2 t=0
NT
1 X
+ e(t)coswt
NT + 1 t=0
1 jw
Yc (N) = α|G (e )|sin(φ)
2

Where in the 2nd last equation, the last two terms approaches zero as
N approaches infinity
M.I.Ahmad (RCMS) 11 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

Using Ys (N) and Yc (N), we get

M.I.Ahmad (RCMS) 12 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

Using Ys (N) and Yc (N), we get

2
q
|G (e jw )| = Ys2 (N) + Yc2 (N)
α

M.I.Ahmad (RCMS) 12 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

Using Ys (N) and Yc (N), we get

2
q
|G (e jw )| = Ys2 (N) + Yc2 (N)
α
Yc (N)
φ = arc tan ( )
Ys (N)

M.I.Ahmad (RCMS) 12 / 13
Nonparametric Identification - LTI Systems

Frequency Analysis Using Correlation Techniques

Using Ys (N) and Yc (N), we get

2
q
|G (e jw )| = Ys2 (N) + Yc2 (N)
α
Yc (N)
φ = arc tan ( )
Ys (N)

Frequency transfer function can be identified from the correlation


function Ys (N) and Yc (N)

M.I.Ahmad (RCMS) 12 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate sine wave with max. allowable magnitude α.

M.I.Ahmad (RCMS) 13 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate sine wave with max. allowable magnitude α.


Apply this to the system and measure the resulting sine wave
response.

M.I.Ahmad (RCMS) 13 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate sine wave with max. allowable magnitude α.


Apply this to the system and measure the resulting sine wave
response.
Determine from N cycles of the output, Yc (N) and Ys (N).

M.I.Ahmad (RCMS) 13 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate sine wave with max. allowable magnitude α.


Apply this to the system and measure the resulting sine wave
response.
Determine from N cycles of the output, Yc (N) and Ys (N).
Calculate magnitude and phase shift of G (e jw ) using Yc (N) and
Ys (N).

M.I.Ahmad (RCMS) 13 / 13
Nonparametric Identification - LTI Systems

Algorithm

Generate sine wave with max. allowable magnitude α.


Apply this to the system and measure the resulting sine wave
response.
Determine from N cycles of the output, Yc (N) and Ys (N).
Calculate magnitude and phase shift of G (e jw ) using Yc (N) and
Ys (N).
Repeat this for a number of different frequencies w ∈ w1 , w2 , w3 , . . .

M.I.Ahmad (RCMS) 13 / 13

You might also like