Sunteți pe pagina 1din 103

LabVIEW

TM

System Identification Toolkit Algorithm References


System Identification Toolkit User Manual

June 2008

Support
Worldwide Technical Support and Product Information
ni.com
National Instruments Corporate Headquarters
11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100
Worldwide Offices
Australia 1800 300 800, Austria 43 662 457990-0, Belgium 32 (0) 2 757 0020, Brazil 55 11 3262 3599,
Canada 800 433 3488, China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00,
Finland 358 (0) 9 725 72511, France 01 57 66 24 24, Germany 49 89 7413130, India 91 80 41190000,
Israel 972 3 6393737, Italy 39 02 41309227, Japan 0120-527196, Korea 82 02 3451 3400,
Lebanon 961 (0) 1 33 28 28, Malaysia 1800 887710, Mexico 01 800 010 0793, Netherlands 31 (0) 348 433 466,
New Zealand 0800 553 322, Norway 47 (0) 66 90 76 60, Poland 48 22 3390150, Portugal 351 210 311 210,
Russia 7 495 783 6851, Singapore 1800 226 5886, Slovenia 386 3 425 42 00, South Africa 27 0 11 805 8197,
Spain 34 91 640 0085, Sweden 46 (0) 8 587 895 00, Switzerland 41 56 2005151, Taiwan 886 02 2377 2222,
Thailand 662 278 6777, Turkey 90 212 279 3031, United Kingdom 44 (0) 1635 523545
For further support information, refer to the Technical Support and Professional Services appendix. To comment
on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter
the info code feedback.
20042008 National Instruments Corporation. All rights reserved.

Important Information
Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects
in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National
Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives
notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be
uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before
any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are
covered by warranty.
National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical
accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent
editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected.
In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. C USTOMERS RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF
NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR
DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY
THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including
negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments
shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover
damages, defects, malfunctions, or service failures caused by owners failure to follow the National Instruments installation, operation, or
maintenance instructions; owners modification of the product; owners abuse, misuse, or negligent acts; and power failure or surges, fire,
flood, accident, actions of third parties, or other events outside reasonable control.

Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying,
recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National
Instruments Corporation.
National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other
intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only
to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction.

Trademarks
National Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments Corporation. Refer to the Terms of Use section
on ni.com/legal for more information about National Instruments trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency,
partnership, or joint-venture relationship with National Instruments.

Patents
For patents covering National Instruments products, refer to the appropriate location: HelpPatents in your software, the patents.txt file
on your CD, or ni.com/patents.

WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS


(1) NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF
RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN
ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT
INJURY TO A HUMAN.
(2) IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE
IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY,
COMPUTER HARDWARE MALFUNCTIONS, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILERS
AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND
HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL
DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR
MISUSES, OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER (ADVERSE FACTORS SUCH AS THESE ARE
HEREAFTER COLLECTIVELY TERMED SYSTEM FAILURES). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD
CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY AND DEATH) SHOULD
NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID
DAMAGE, INJURY, OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO
PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS.
BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING
PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN
COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL
INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING
THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE
INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN,
PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.

Algorithm References

This document describes the VIs used to implement the algorithms in the LabVIEW System
Identification Toolkit.
Refer to the LabVIEW Help, available in LabVIEW by selecting HelpSearch the LabVIEW Help,
for more information about the main steps in the system identification process and about how to use the
System Identification Toolkit to create applications that can accomplish the various tasks in the process.

Contents
System Identification Palettes, VIs, and SubVIs ...................................................................................... 2
si_Piecewise Linear Fitting.vi .................................................................................................................. 3
SI Detect Feedback (Array).vi .................................................................................................................. 5
si_AR (FB, LS, YW and PC).vi ............................................................................................................... 6
si_AR Burg Method.vi ............................................................................................................................. 8
si_Est ARX Model (SISO).vi ................................................................................................................. 10
si_Est ARX Model (MISO).vi ................................................................................................................ 12
si_Est ARX Model (MIMO).vi .............................................................................................................. 13
si_Est ARMAX Model (SISO).vi ........................................................................................................... 14
si_Est ARMAX Model (MISO).vi ......................................................................................................... 16
si_Est OE Model (SISO).vi .................................................................................................................... 17
si_Est OE Model (MISO).vi ................................................................................................................... 19
si_Est BJ Model (SISO).vi ..................................................................................................................... 21
si_Est BJ Model (MISO).vi .................................................................................................................... 23
si_Est GL Model (SISO).vi .................................................................................................................... 26
si_Est GL Model (MISO).vi ................................................................................................................... 28
SI Estimate Continuous Transfer Function Model (SISO Array).vi ....................................................... 31
SI Estimate Discrete Transfer Function Model (SISO Array).vi ............................................................ 33
SI Estimate User-Defined Model (MIMO Array).vi .............................................................................. 34
si_Impulse Realization (MIMO).vi ........................................................................................................ 35
Subspace Identification Method via Principal Component Analysis (SIMPCA) ................................... 37
si_Correlation Analysis.vi ...................................................................................................................... 41
SI Estimate Impulse Response (Least Squares Array).vi ....................................................................... 43
si_Frequency Analysis.vi ....................................................................................................................... 45
SI Estimate Partially Known Continuous Transfer Function Model (General SISO Array).vi .............. 47
SI Estimate Partially Known State-Space Model (MIMO Array).vi ...................................................... 49
Recursive Model Estimation VIs ............................................................................................................ 50
SI Model Simulation VIs ........................................................................................................................ 58
SI Model Prediction VIs ......................................................................................................................... 65
si_Residual Analysis.vi .......................................................................................................................... 70
si_Convert to Transfer Function Model.vi ............................................................................................. 72
si_Convert to State Space Model.vi........................................................................................................ 74
si_Convert to Pole-Zero Model.vi .......................................................................................................... 76
si_Std Freq.vi.......................................................................................................................................... 77
si_Std Root to Polynomial.vi .................................................................................................................. 80
si_Polynomial Root Derivative.vi .......................................................................................................... 82
si_Variance of Real and Imaginary of Roots.vi ...................................................................................... 84
si_Confidence Region of Polynomial.vi ................................................................................................. 85
SI Average Theta and Covariance.vi ...................................................................................................... 87
SI Generate Pseudo-Random Binary Sequence.vi .................................................................................. 88
Gauss-Newton Minimization Method .................................................................................................... 89
Instrumental Variable Method ................................................................................................................ 92
SI Estimate Discrete Transfer Function Model from FRF (SISO arbitrary).vi ....................................... 93
SI Estimate Continuous Transfer Function Model from FRF (SISO arbitrary).vi ................................. 96
SI Estimate State-Space Model from FRF.vi ......................................................................................... 97

National Instruments Corporation

System Identification Toolkit

Algorithm References

System Identification Palettes, VIs, and SubVIs


The following table lists the System Identification VIs and the corresponding subVIs that implement
the algorithms.
Palette
Data
Preprocessing
Nonparametric
Model
Estimation
FrequencyDomain Model
Estimation

Parametric
Model
Estimation

VI
SI Remove Trend
SI Detect Feedback
SI Estimate Impulse Response

SubVI
si_Piecewise Linear Fitting.vi
SI Detect Feedback (Array).vi
si_Correlation Analysis.vi
SI Estimate Impulse Response (Least Squares
Array).vi
si_Frequency Analysis.vi

SI Estimate Frequency
Response
SI Estimate Transfer Function
Model from FRF

SI Estimate Discrete Transfer Function Model


from FRF (SISO arbitrary).vi
SI Estimate Continuous Transfer Function
Model from FRF (SISO arbitrary).vi
SI Estimate State-Space Model from FRF.vi

SI Estimate State-Space Model


from FRF
SI Estimate AR Model

si_AR (FB, LS, YW and PC).vi


si_AR Burg Method.vi
si_Est ARX Model (SISO).vi
si_Est ARX Model (MISO).vi
si_Est ARX Model (MIMO).vi
si_Est ARMAX Model (SISO).vi
si_Est ARMAX Model (MISO).vi
si_Est OE Model (SISO).vi
si_Est OE Model (MISO).vi
si_Est BJ Model (SISO).vi
si_Est BJ Model (MISO).vi
si_Est GL Model (SISO).vi
si_Est GL Model (MISO).vi
SIMPCA
si_Impulse Realization (MIMO).vi
SI Estimate Continuous Transfer Function
Model (SISO Array).vi
SI Estimate Discrete Transfer Function Model
(SISO Array).vi
SI Estimate User-Defined Model (MIMO
Array).vi
SI Estimate Partially Known Continuous
Transfer Function Model (General SISO
Array).vi
SI Estimate Partially Known State-Space Model
(MIMO Array).vi
Recursive model estimation

SI Estimate ARX Model


SI Estimate ARMAX Model
SI Estimate OE Model
SI Estimate BJ Model
SI Estimate GL Model
SI Estimate State-Space Model
SI Estimate Transfer Function
Model

Partially Known
Model
Estimation
Recursive
Model
Estimation

Model

SI Estimate User-Defined
Model
SI Estimate Partially Known
Continuous Transfer Function
Model
SI Estimate Partially Known
State-Space Model
SI Recursively Estimate AR
Model
SI Recursively Estimate ARX
Model
SI Recursively Estimate
ARMAX Model
SI Recursively Estimate OE
Model
SI Recursively Estimate BJ
Mode
SI Recursively Estimate StateSpace Model
SI Model Conversion

System Identification Toolkit

si_Convert to Transfer Function Model.vi

ni.com

Algorithm References

Conversion

SI Convert to Models of CDT

Model Analysis

SI Bode Plot
SI Nyquist Plot
SI Pole-Zero Plot

Model
Validation

si_Convert to State Space.Model.vi


si_Convert to Pole-Zero Model.vi
si_Std Freq.vi
si_Std Root to Polynomial.vi
si_Polynomial Root Derivative.vi
si_Variance of Real and Imaginary of Roots.vi
si_Confidence Region of Polynomial.vi
si_GL Model Sim (MISO).vi
si_Std Response To Model.vi
si_ARX Model Sim (MIMO).vi
si_State-Space (MIMO) core.vi
si_Transfer Function Sim Core.vi
si_GL Model Predict (MISO).vi
si_SS Model Predict vi
si_SS State Response.vi
si_Residual Analysis.vi
SI Average Theta and Covariance.vi
SI Generate Pseudo-Random Binary
Sequence.vi

SI Model Simulation

SI Model Prediction

Utilities

SI Model Residual Analysis


SI Merge Models
SI Generate Pseudo-Random
Binary Sequence

si_Piecewise Linear Fitting.vi


1.

Introduction
This section includes the algorithms and references used by the si_Piecewise Linear Fitting.vi. The
si_Piecewise Linear Fitting.vi is the core VI used to remove a piecewise linear trend from the
input-output data of a system.

2.

Function Description
The purpose of this function is to find the piecewise linear trend of a signal. A signal with a
piecewise linear trend is represented by

s0 sN 1 .

The piecewise points include 0, x1, , xL,

N-1.

3.

APIs
Para Name
signal with

In/Out

Type

Description

In

1D DBL Array

The signal to be fitted

In

1D I32 Array

The piecewise points of the linear fitting

Out

1D DBL Array

Fitted signal

Out

1D DBL Array

The best fit piecewise linear signal

trend
piecewise
points
Signal
(without
trend)
best fit

National Instruments Corporation

System Identification Toolkit

Algorithm References

4.

slopes

Out

1D DBL Array

The piecewise slope

intercepts

Out

1D DBL Array

The piecewise intercept

error

Out

I32

Algorithms
If

y0, y1 yL , yN 1 are the best fit signal values at the piecewise points0, x1, , xL, N-1,

respectively, the best fit value of

sk

between

xi

and

xi 1

is:

x k
k xi

sk yi i 1
yi 1
, xi k xi 1
xi 1 xi
xi 1 xi

(1)

Therefore, you can obtain the piecewise linear trend, or the best fit values, of the signal if you
know y0, y1 yL , yN 1 . Using the least square criterion, you can obtain

y0, y1 yL , yN 1

by

solving the following linear equations:

AY S
where

Y [ y0, y1 yL , y N 1 ]T , S [s0, s1 , s N 1 ]T , and

a00

a0m0

0
0
A
0

0
0

0
0

where

xi

(2)

aik

and

xi 1

xi1 k
xi 1 xi

that satisfies

bik

b00

b0m0

0
0
0

0
0
0

a10

a1m1

b10

b1m1

0
0
0

0
0
0
0

0
0
0

k xi
xi1 xi

0
0

0
bL1,0


bL1,mL1
0
0
0

aL1,0

aL1,mL1

(3)

and mi represents the number of signals between

m0 ... mL1 N . x0 0

and

xN 1 N 1 .

By solving Equation 2, you can calculate the best fit value at the piecewise points,

y0, y1 yL , yN 1 . Then, by multiplying the matrix A by the vector Y, you can calculate the best
fit signal.

System Identification Toolkit

ni.com

Algorithm References

SI Detect Feedback (Array).vi


1.

Introduction
This section includes the algorithms and references used by the SI Detect Feedback (Array).vi. The
SI Detect Feedback (Array).vi is the core VI used to detect feedback in a system. The SI Detect
Feedback (Array).vi is located in the labview\vi.lib\addons\System Identification\Data
Preprocess.llb directory.

2.

Function Description
The purpose of this VI is to determine whether data is collected from a closed-loop system using
estimated impulse responses. The SI Detect Feedback (Array).vi uses the least squares method to
estimate impulse responses. Refer to the SI Estimate Impulse Response (Least Squares Array).vi
for more information about estimating impulse responses.

3.

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

impulse response

In

Cluster

The number of points for which t<0 and

length

t>=0, represented as

N t 0

and N t 0 ,

respectively.
confidence level

In

Numeric

Determines the upper and lower limits of

(%)

the impulse response

feedback exists?

Out

Boolean

impulse response

Out

XY graph

graph

4.

Algorithms
1)

Estimate the impulse responses, h(k), as well as the standard deviation, std(k), of the impulse
responses.

2)

In an open-loop system, the current input signal, u(k), and the previous output signal, y(k+j),
j<0, do not correlate with each other. Thus, the impulse response h(j) at negative lags (j<0) is
zero. In a closed-loop system, the previous output signal correlates with the current input
signal because of the feedback path in the system. Hence, some values of the impulse
response at negative lags are nonzero. In other words, when the impulse responses of a
system are nonzero at negative lags, feedback exists in the system.
However, signals might contain noise, so the estimated impulse responses at negative lags
might not be zero even in an open-loop system. When h(j) lies in the range from - N*std(-j)

National Instruments Corporation

System Identification Toolkit

Algorithm References

to N*std(-j), where N is determined by the confidence level, h(j) is considered to be zero. If


h(j) does not lie in this range, h(j) is considered to be nonzero, or significant.

si_AR (FB, LS, YW and PC).vi


1.

Introduction
This section includes the algorithms and references used by the si_AR (FB, LS, YW and PC).vi. The
si_AR (FB, LS, YW and PC).vi is the core VI used to estimate AR models. The si_AR (FB, LS,
YW and PC).vi implements the forward-backward, least-square, Yule-Walker, and principle
components methods for AR model estimation.

2.

Function Description
The Auto-Regression (AR) model is defined as:

A(q) y(n) e(n)


where

Na

A(q) 1 ai q i , e(n) is

(1)

white noise, and y(n) is the signal. q is the backward shift

i 1

operator, which means:

q i y(n) y(n i)
The purpose of this VI is to estimate A(q) given the signal y(t) so that Equation 1 holds.
3.

APIs
Para Name

In/Out

Type

Description

signal

In

1D DBL Array

The signal to be fitted with Equation 1

AR order

In

I32

Number of auto-regression coefficients, Na

method

In

U16 Text Ring

Select the method to estimate the AR model.


The methods include:
(1) Forward-Backward (FB)
(2) Least-Square (LS)
(3) Yule-Walker (YW)
(4) Principal Component (PC)

AR

Out

1D DBL Array

[1, a1, a2 ,....,aNa ]

std

Out

1D DBL Array

Standard deviations of

covariance

Out

2D DBL Array

Covariance matrix of

noise

Out

1D DBL Array

e(n)

noise

Out

DBL

Variance of e(n)

coefficients

[1, a1, a2 ,....,aNa ]

[a1 , a2 ,....,aNa ]

variance

System Identification Toolkit

ni.com

Algorithm References

error

4.

Out

I32

Error code

Algorithms

Forward-Backward Method
The AR coefficients can be estimated by solving the following linear equations:

M f
m f
a
M b
mb

(2)

where

y(0)
y(na 1) y(na 2)

y (n )

y(na 1)
y(1)
a

Mf

y( N 2) y( N 3) y( N na 1)
y(2)
y(na )
y(1)
y(2)
y(3)
y(na 1)

Mb

y( N na ) y( N na 1) y( N 1)
y(0)
a1

y(na )
a

y(n 1)
y(1)
2
a

mf
, mb
, a

y( N 1)
y( N na 1)
ana
Least Squares Method
The AR coefficients can be estimated by solving the following linear equations:

y(0)
y(na 1) y(na 2)
a1
y(na )
a
y (n )

y(na 1)
y(1)
a

2 y(na 1)


y( N 1)
y( N 2) y( N 3) y( N na 1) na

(1)

where N is the signal length.


Yule-Walker Method
The AR coefficients can be estimated by solving the following linear equations:

M f
m f
a
M b
mb

(3)

where

National Instruments Corporation

System Identification Toolkit

Algorithm References

0
y(0)
y(1)
y(0)

0
Mf

y( N na ) y( N na 1) y( N 1)
y(2) y(na )
y(1)
y(2)
y(3) y(na 1)
Mb

0
y( N 1) 0

a1
y(1)
y(0)
a
y(2)
y(1)
2

mf
, mb
, a


ana
y( N 1)
y( N 2)
5.

References
[1] Signal Processing Toolkit User Manual, National Instruments
[2] Guangshu Hu, Digital Signal Processing, Tsing Hua University Press.

si_AR Burg Method.vi


1.

Introduction
This section includes the algorithms and references used by the si_AR Burg Method.vi. The si_AR
Burg Method.vi is the core VI used to estimate an AR model using the Burg method. The si_AR
Burg Method.vi is located in the labview\vi.lib\addons\System Identification\Parametric
Estimation Subs.llb directory.

2.

Function Description
The Auto-Regression (AR) model is defined as:

A(q) y(n) e(n)


where

(1)

Na

A(q) 1 ai q i , e(n) is white noise, and y(n) is the signal. q is the backward shift
i 1

operator, which means:

q i y(n) y(n i)
The purpose of this VI is to estimate A(q) given the signal y(t) so that Equation 1 holds.

3.

APIs

System Identification Toolkit

ni.com

Algorithm References

Para Name

In/Out

Type

Description

stimulus

In

2D DBL Array

The input signals of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing A

A order, B order, and delay are

signal
response
signal
model
parameters

order, B order, and

Na

[N1b, N2b,...., NNb] , and [k1, k2,...., kN ] ,

delay. A order is

respectively.

I32. B order and


delay are 1D I32.
ARX model

Out

Cluster
-

std

Out

Cluster

The standard deviations of coefficients A and B

Out

DBL

Variance of e(n)

Out

2D DBL Array

Out

1D DBL Array

deviations
noise
variance
covariance

matrix
noise

4.

e(n)

Algorithms
Burg Method [Ref 1, page 363]
According to the definition of AR model, you can define:
Na

x f (n) akf (k ) x(n k )


k 1

e f (n) = x(n) - x f (n)


2

r f = E{ e f (n) }
where

x f (n) is the forward prediction vector, e f (n) is the error vector, and a f k are the

coefficients of an AR model.
Correspondingly, you can define:
Na

x b (n na ) akb (k ) x(n na k )
k 1

eb (n) = x(n - na ) - xb (n - na )
2

r b = E{ eb (n) }

National Instruments Corporation

System Identification Toolkit

Algorithm References

The coefficients

a(k ) of an AR model can be computed by following the Levinson recursive

algorithm, where

am (k ) = am- 1 (k ) + kmam- 1 (m - k ), k = 1,..., m - 1

(2)

am (m) = km

(3)

rm = (1- km2 )rm- 1

(4)

N 1

km

2 emf 1 (i)emb 1 (i 1)

, m 1,2,....,na

i m

N 1

| e
i m

f
m1

N 1

(i) | | e
2

i m

b
m1

(i 1) |

(5)

em f (n) = em- 1 f (n) + kmem- 1b (n - 1)


emb (n) = em- 1b (n) + kmem- 1 f (n)
f

(6)

b
0

e0 (n) = e (n) = x(n), m = 1,..., na


5.

References
[1] Guangshu Hu, Digital Signal Processing, Tsing Hua University Press.

si_Est ARX Model (SISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est ARX Model (SISO).vi,
which is the core VI to estimate the coefficients of an ARX (SISO) model using the input-output
data of a system. The si_Est ARX Model (SISO).vi is located in the labview\vi.lib\addons\System
Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
The ARX (SISO) model is described as

A(q) y(n) B(q)u(n k ) e(n)

where A(q) 1

Na

Nb 1

i 1

i 0

(1)

ai qi , B(q) bi qi , k is the delay of the system, and u(n), y(n), and

e(n) are the input, output, and disturbance of a system, respectively. q is the backward shift
operator, which means

q i y(n) y(n i)
The purpose of this VI is to estimate the coefficients

[a1 , a2 ,....,aNa ] and [b0 , b1 ,....,bNb 1 ]

using the input-output data of a system.

System Identification Toolkit

10

ni.com

Algorithm References

3.

APIs

Para Name

In/Out

Type

Description

stimulus

In

1D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing A

A order, B order, and delay are Na ,

signal
response
signal
model
parameters

order, B order, and

Nb ,

and k,

respectively

delay. A order, B
order, and delay are
I32.
ARX model

Out

Cluster

std

Out

Cluster

The standard deviations of A coefficients and B

deviations
noise

coefficients
Out

DBL

Variance of e(n)

Out

2D DBL Array

Out

1D DBL Array

variance
covariance

matrix
noises

4.

e(n)

Algorithms
The least square solution for the ARX model estimation is [Equation 7.34, Ref 1]:

NLS [

N
1 N
T
1 1

(
t
)

(
t
)
]

(t) y(t)
N t 1
N t 1

(2)

where

(t) [ y(t 1) y(t 2).... y(t Na ) u(t) u(t 1)...u(t Nb 1)]T


You can rewrite Equation 2 as the solution of the linear equations:

AX Y

(3)

where

a1

T ( p)
y ( p)

y( p 1)
aNa
( p 1)

A
, X b0 , and Y

y( N )
( N )

bNb 1
5.

References

National Instruments Corporation

11

System Identification Toolkit

Algorithm References

[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est ARX Model (MISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est ARX Model (MISO).vi,
which is the core VI to estimate the coefficients of an ARX (MISO) model based on the inputoutput data of a system. The si_Est ARX Model (MISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
An ARX (MISO) model is described as

A(q) y(n) B(q)u(n k ) e(n)


where A(q) 1

(1)

Na

ai qi , B(q) [B1 (q), B2 (q),....,BN (q)] and Bi (q)


i 1

Nib 1

b q
j 0

ij

u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T , N is the number of input channels,


and q is the backward shift operator, which means

q i y(n) y(n i) .
k is the delay of the system.

3.

APIs
Para Name

In/Out

Type

Description

stimulus

In

2D DBL Array

The input signals of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing A

A order, B order, and delay are

signal
response
signal
model
parameters

order, B order, and

Na

[N1b, N2b,...., NNb] , and [k1, k2,...., kN ] ,

delay. A order is

respectively.

I32. B order and


delay are 1D I32.
ARX model

Out

Cluster

std

Out

Cluster

The standard deviations of coefficients A and B

Out

DBL

Variance of e(n)

Out

2D DBL Array

deviations
noise
variance
covariance

System Identification Toolkit

12

ni.com

Algorithm References

matrix
noise

4.

Out

1D DBL Array

e(n)

Algorithms
Similar to the algorithm of the si_Est ARX Model (SISO).vi.

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est ARX Model (MIMO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est ARX Model (MIMO).vi,
which is the core VI to estimate the coefficients of the an ARX (MIMO) model based on the inputoutput data of a system. The si_Est ARX Model (MIMO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
The ARX (MIMO) model is described as

A(q) y(n) B(q)u(n k ) e(n)


where

Na

A(q) I Ai q
i 1

Nb 1

B(q) Bi q i

i 0

u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T

(1)

y(n) [ y1 (n), y2 (n),....,yM (n)]T


, I is the unity matrix.

Ai

and

Bi

are

matrices, N is the number of input channels, M is the number of output channels, k is the delay of
the system, and q is the backward shift operator, which means

q i y(n) y(n i) .
3.

APIs
Para Name

In/Out

Type

Description

stimulus

In

2D DBL Array

The input signals of a system

In

2D DBL Array

The output signals of a system

In

Cluster containing A

A order, B order, and delay are

signal
response
signal
model
parameters

order, B order, and

[ N1b , N 2 b ,....,N Nb ] ,

delay. A order is

and [k1, k2,...., kN ] ,

respectively.

I32. B order and

National Instruments Corporation

[ N 1a , N 2 a ,....,N Na ] ,

13

System Identification Toolkit

Algorithm References

delay are ID I32.


ARX model

Out

Cluster

std

Out

Cluster

The standard deviations of coefficients A and B

Out

2D DBL Array

Variance of e(n)

Out

3D DBL Array

Out

2D DBL Array

deviations
noise
variance
covariance

matrix
noise

4.

e(n)

Algorithms
Similar to the algorithm of the si_Est ARX Model (SISO).vi.

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est ARMAX Model (SISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est ARMAX Model (SISO).vi,
which is the core VI to estimate the coefficients of an ARMAX (SISO) model based on the inputoutput data of a system. The si_Est ARMAX Model (SISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
The ARMAX (SISO) model is described as

A(q) y(n) B(q)u(n k ) c(q)e(n)


where

(1)

Na

Nb 1

Nc

i 1

i 0

i 1

A(q) 1 ai q i , B(q) bi q i , C(q) 1 ci q i

, u(n), y(n) and e(n) are

the input, output, and disturbance of a system, respectively. q is the backward shift operator, which
means

q i y(n) y(n i) .
k is the delay of the system. The purpose of this VI is to estimate the coefficients [a1, a2,....,aN ] ,
a
[b0, b1,....,bN 1] and [c1, c2,....,cN ] based on the input-output data of a system.
b
c

3.

APIs
Para Name

System Identification Toolkit

In/Out

Type

Description

14

ni.com

Algorithm References

stimulus

In

1D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing A

A order, B order, C order and delay are Na ,

signal
response
signal
model
parameters

order, B order, C

Nb , Nc , and k, respectively.

order and delay. A


order, B order, C
order and delay are
I32.
ARMAX

Out

Cluster

Out

Cluster

model
std

The standard deviations of coefficients A, B,

deviations
noise

and C
Out

DBL

Variance of e(n)

Out

2D DBL Array

Out

1D DBL Array

variance
covariance

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for A(q), B(q), and C(q), and
then the Gauss-Newton minimization method is applied to refine the results of A(q), B(q), and
C(q).

Multi-Stage coarse estimation


This method is generally described on page 337 of Ref 1. Here is the deduction specific for an
ARMAX model.
Let
v(t) = c(q)e(t)

(2)

Then Equation 1 becomes


(3)

A(q)y(t)=B(q)u(t-k)+ v(t)

Since v(t) here is not white Gaussian noise, the System Identification Toolkit applies the
instrumental variable (IV) method to estimate A(q) and B(q). You then can have

v(t) A (q) y(t) B (q)u(t k) C(q)e(t)


Here, as elsewhere,

denotes the estimation of

1
v(t ) e(t )
C(q)
National Instruments Corporation

15

(4)

. Thus, Equation 4 can be rewritten as


(5)

System Identification Toolkit

Algorithm References

Equation 4 can be treated as a high order AR model, though theoretically, it represents an AR


model with infinite orders. However, in practice, this kind of AR model is selected as the
dimension of the system Na + Nb + Nc . With the AR model estimation, we have an estimation
for e(t). Since the

v(t ) and e(t ) are known now, Equation 4 can be rewritten as

v(t) (C(q) 1)e(t) e(t)

(6)

Equation 5 represents one form of ARX model. C(q) can be estimated by using ARX model

v(t ) and e(t ) as the output and input, respectively.

estimation methods with

Standard Deviations of A(q), B(q) and C(q)


Refer to the equations (9.18) and (9.19) on Page 284 of Ref 1.
5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est ARMAX Model (MISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est ARMAX Model (MISO).vi,
which is the core VI to estimate the coefficients of an ARMAX (MISO) model based on the inputoutput data of a system. The si_Est ARMAX Model (MISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
The ARMAX (MISO) model is described as

A(q) y(n) B(q)u(n k ) c(q)e(n)


where A(q) 1

Na

a q
i 1

(1)

B(q) [B1 (q), B2 (q),....,BN (q)] and Bi (q)

Nib 1

b q
j 0

ij

Nc

C(q) 1 ci q i , u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T , N is the


i 1

number of input channels, and q is the backward shift operator, which means

q i y(n) y(n i) .

ki

is the delay of the i-th input of the system. The purpose of this VI is to estimate the coefficients

[a1 , a2 ,....,aNa ] , [bij ]


3.

and

[c1 , c2 ,....,cNc ] based on the input-output data of a system.

APIs
Para Name

System Identification Toolkit

In/Out

Type

Description

16

ni.com

Algorithm References

stimulus signal

In

2D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

model

In

Cluster containing A

A order, B order, C order and delay are

parameters

order, B order, C order


and delay. A order, C
order and delay are I32.

Na

[ N1b , N 2 b ,....,N Nb ] , N c ,

and k,

respectively.

B order is 1D I32.
ARMAX model

Out

Cluster

std deviations

Out

Cluster

The standard deviations of coefficients A,


B, and C

noise variance

Out

DBL

Variance of e(n)

covariance

Out

2D DBL Array

Out

1D DBL Array

matrix
noise

4.

e(n)

Algorithms
Similar to the algorithm of the si_Est ARMAX Model (SISO).vi.

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est OE Model (SISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est OE Model (SISO).vi, which
is the core VI to estimate the coefficients of an output-error (OE) (SISO) model based on the
input-output data of a system. The si_Est OE Model (SISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
An OE (SISO) model is described as

y(n)
where,

Nb 1

B(q) bi q
i 0

B(q)
u(n k ) e(n)
F (q)

, F (q) 1

Nf

fq
i 1

(1)

, u(n), y(n) and e(n) are the input, output, and

disturbance of a system respectively. q is the backward shift operator, which means

q i y(n) y(n i) .

National Instruments Corporation

17

System Identification Toolkit

Algorithm References

k is the delay of the system. The purpose of this VI is to estimate the coefficients

[b0 , b1 ,....,bNb 1 ] and [ f1 , f 2 ,...., f N f ] based on the input-output data of a system.

3.

APIs
Para Name

In/Out

Type

Description

stimulus

In

1D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing B order,

B order, F order and delay are

signal
response
signal
model
parameters

F order and delay. They are


I32.

OE model

Out

Cluster

Nb , N f

and k respectively.
B is [0,...0, b0 , b1 ,....,bNb 1 ] , The
number of zeros at the beginning
equals k. F is

std

Out

Cluster

The standard deviations of

deviations
noise

[1, f1 , f 2 ,...., f N f ]

coefficients B and F
Out

DBL

Variance of e(n)

Out

2D DBL Array

Out

1D DBL Array

variance
covariance

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for B(q) and F(q), and then the
Gauss-Newton minimization method is applied to refine the results of B(q) and F(q).

Multi-Stage Coarse Estimation


This method is generally described on page 337 of Ref 1. Here is the deduction specific for OE
model.
Let
v(t) = F(q)e(t)

(2)

Then Equation 1 becomes


F(q)y(t)=B(q)u(t-k)+ v(t)

(3)

Equation 3 is in the form of ARX model. Since v(t) here is not white Gaussian noise, the System
Identification Toolkit applies the instrumental variable (IV) method to estimate F(q) and B(q).

Standard Deviations of B(q) and F(q)

System Identification Toolkit

18

ni.com

Algorithm References

Refer to the equations (9.18) and (9.19) on Page 284 of Ref 1.


5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est OE Model (MISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est OE Model (MISO).vi,
which is the core VI to estimate the coefficients of an output-error (OE) (MISO) model based on
the input-output data of a system. The si_Est OE Model (MISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
An OE (MISO) model is described as

y(n)

B(q)
u(n k ) e(n)
F (q)

(1)

where

B(q) [B1 (q), B2 (q),....,BN (q)] and Bi (q)


F (q) [F1 (q), F2 (q),....,FN (q)]

Nib 1

b q
j 0

ij

Nif

and

Fi (q) 1 f ij q j

j 1

B (q)
B(q) B1 (q) B2 (q)
[
,
,..., N ] ,
F (q) F1 (q) F2 (q)
FN (q)

u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T , N is the number of input channels and q
is the backward shift operator, which means:

q i y(n) y(n i) .

ki

is the delay of the i-th input of the system. The purpose of this VI is to estimate the coefficients

[bij ] and [ fij ]


3.

based on the input-output data of a system.

APIs
Para Name
stimulus

In/Out

Type

Description

In

2D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

signal
response

National Instruments Corporation

19

System Identification Toolkit

Algorithm References

signal
model

In

parameters

Cluster containing B order,

B order, F order and delay

F order and delay. They

are [ N1b , N 2b ,....,N Nb ] ,

are 1D I32.
OE model

Out

[ N1 f , N 2 f ,....,N Nf ] ,

and k, respectively.

Cluster

B is a matrix as

0,...0, b10 , b11,....,b1( N1b 1)

0,...0, b20 , b21,....,b2( N2b 1) . The


...

0,...0, bN 0 , bN1 ,....,bN ( N Nb 1)


number of zeros at the beginning of ith
row equals

ki

F is a matrix as

1, f11, f12 ,...., f1N1 f

1, f 21, f 22 ,...., f 2 N2 f

...

1, f N1 , f N 2 ,...., f NN
Nf

std deviations

Out

Cluster

The standard deviations of


coefficients B and F

noise variance

Out

DBL

Variance of e(n)

covariance

Out

2D DBL Array

Out

1D DBL Array

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for B(q) and F(q), and then the GaussNewton minimization method is applied to refine the results of B(q) and F(q).
Multi-Stage Coarse Estimation
This method is generally described on page 337 of Ref 1. Here is the deduction specific for the OE
model.
By multiplying

F max(q)

on both side of Equation 1, this equation is approximated as

F max(q) y(n) B(q)u(n k ) (n)

(2)

where

(n) F max(q)e(n)
Here

F max(q)

is the polynomial with maximum order in all

(3)

Fi (q) . Then Equation 2 can be

considered as an ARX (MISO) model. With the ARX (MISO) model estimation, you can have an

System Identification Toolkit

20

ni.com

Algorithm References

estimation for

F max(q)

and B(q). Using

F max(q)

and B(q) as filter N(q) and M(q), you can apply

the instrumental variable method to estimate B(q) and F(q) of Equation 1.


Standard Deviations of B(q) and F(q)
Refer to the Equations (9.18) and (9.19) on Page 284 of Ref 1.

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est BJ Model (SISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est BJ Model (SISO).vi, which
is the core VI to estimate the coefficients of a Box-Jenkins (BJ) (SISO) model based on the inputoutput data of a system. The si_Est BJ Model (SISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
A BJ (SISO) model is described as

y(n)
where

B(q)
C(q)
u(n k )
e(n)
F (q)
D(q)

(1)

Nb 1

Nf

Nc

Nd

i 0

i 1

i 1

i 1

B(q) bi q i , F (q) 1 f i q i , C(q) 1 ci q i , D(q) 1 di q i

and q is the backward shift operator, which means:

q i y(n) y(n i) .
k is the delay of the system. The purpose of this function is to estimate the coefficients

[b0 , b1 ,....,bNb 1 ] , [ f1 , f 2 ,...., f N f ] , [c1 , c2 ,....,cNc ]

and

[d1, d2 ,....,dNd ]

based on the

input-output data of a system.


3.

APIs
Para Name
stimulus

In/Out

Type

Description

In

1D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster

B order, F order, C order, D order and

signal
response
signal
model
parameters

National Instruments Corporation

delay are
21

Nb

Nf

Nc , Nd

and k,

System Identification Toolkit

Algorithm References

respectively.
BJ model

Out

Cluster

B is [0,...0, b0 , b1 ,....,bN

b 1

] , The

number of zeros at the beginning


equals k. F is
is

[1, f1 , f 2 ,...., f N f ] .

[1, c1, c2 ,....,cNc ] and D is

[1, d1, d2 ,....,d Nd ]


std deviations

Out

Cluster

The standard deviations of


coefficients B, F, C, and D

noise variance

Out

DBL

Variance of e(n)

covariance

Out

2D DBL Array

Out

1D DBL Array

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for B(q), F(q), C(q) and D(q), and
then the Gauss-Newton minimization method is applied to refine the results of B(q), F(q), C(q)
and D(q).
Multi-Stage Coarse Estimation
This method is generally described on page 337 of Ref 1. Here is the deduction specific for BJ
model.
Let

(n) F (q)

C(q)
e(n)
D(q)

(2)

Then Equation 1 becomes

F (q) y(n) B(q)u(n k ) (n)

(3)

You then apply the instrumental variable (IV) method to estimate B(q) and F(q) and have the
following equation:

v(n) y(n)
Here, as elsewhere,

B (q)
C(q)
u(n k )
e(n)

D(q)
F (q)

denotes the estimation of

. If

Nc 0 ,

(4)

Equation 4 can be re-written as

D(q)v(n) e(n)

(5)

Equation 5 can be treated as an AR model. With the AR model estimation, you have an
estimation for D(q). If

Nc 0 ,

Equation 4 is rewritten as

D(q)
v(n) e(n)
C(q)

System Identification Toolkit

22

(6)

ni.com

Algorithm References

Then a high order AR model is applied to estimate

e(n) .

Since the

v(n) and e(n) are known

now, Equation 6 can be rewritten as

D(q)v(n) (C(q) 1)e(n) e(n)

(7)

Equation 7 is one form of the ARX model. C(q) and D(q) can be estimated by using ARX model
estimation methods with

v(n)

e(n) as the output and input, respectively.

and

Standard Deviations of B(q), F(q), C(q) and D(q)


Refer to the equations (9.18) and (9.19) on Page 284 of Ref 1.
5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est BJ Model (MISO).vi


1.

Introduction
This document includes the algorithms and references used by the si_Est BJ Model (MISO).vi,
which is the core VI to estimate the coefficients of a Box-Jenkins (BJ) (MISO) model based on the
input-output data of a system. The si_Est BJ Model (MISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
A BJ (MISO) model is described as:

B(q)
C(q)
u(n k )
e(n)
F (q)
D(q)

y(n)

(1)

where

B(q) [B1 (q), B2 (q),....,BN (q)] and Bi (q)


F (q) [F1 (q), F2 (q),....,FN (q)]

Nib 1

b q
j 0

ij

Nif

and

Fi (q) 1 f ij q j

j 1

B (q)
B(q) B1 (q) B2 (q)
[
,
,..., N ] ,
F (q) F1 (q) F2 (q)
FN (q)

u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T , N is the number of input channels,


Nc

C(q) 1 ci q

i 1

Nd

D(q) 1 di q i

i 1

and q is the backward shift operator, which means:

National Instruments Corporation

23

System Identification Toolkit

Algorithm References

q i y(n) y(n i) .

ki

is the delay of the i-th input of the system. The purpose of this VI is to estimate the coefficients

[bij ] , [ fij ] , [c1 , c2 ,....,cNc ] , and [d1, d2 ,....,d Nd ] based on the input-output data of a system.
3.

APIs
Para Name
stimulus

In/Out

Type

Description

In

2D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster

B order, F order, C order, D order and

signal
response
signal
model
parameters

delay are

[ N1b , N 2 b ,....,N Nb ] ,

[ N1 f , N 2 f ,....,N Nf ] , N c , N d
[ k1 , k 2 ,....,k N ] ,

BJ model

Out

Cluster

and

respectively.

B is a matrix as

0,...0, b10 , b11,....,b1( N1b 1)

0,...0, b20 , b21,....,b2( N2b 1) . The


...

0,...0, bN 0 , bN1 ,....,bN ( N Nb 1)


number of zeros at the beginning of ith
row equals

ki

F is a matrix as

1, f11, f12 ,...., f1N1 f

1, f 21, f 22 ,...., f 2 N2 f

...

1, f N1 , f N 2 ,...., f NN
Nf

C is

[1, c1, c2 ,....,cNc ] and D is

[1, d1, d2 ,....,d Nd ]


std deviations

Out

Cluster

The standard deviations of


coefficients B, F, C, and D

noise variance

Out

DBL

covariance

Out

2D DBL Array

Out

1D DBL Array

Variance of e(n)
-

matrix
noise

System Identification Toolkit

e(n)

24

ni.com

Algorithm References

4.

Algorithms
The multi-stage method is applied to have a coarse estimation for B(q), F(q), C(q) and D(q), and
then the Gauss-Newton minimization method is applied to refine the results of B(q), F(q), C(q) and
D(q).
Multi-Stage Coarse Estimation
This method is generally described on page 337 of Ref 1. Here is the deduction specific for BJ
model.
By multiplying

F max(q)

on both side of Equation 1, Equation 1 is approximated as

F max(q) y(n) B(q)u(n k ) (n)

(2)

where

(n) F max(q)
Here

F max(q)

C(q)
e(n)
D(q)

is the polynomial with maximum order in all

Fi (q) . Then Equation 2 can be

considered as an ARX (MISO) model. With the ARX (MISO) model estimation, you can have an
estimation for

F max(q)

and B(q). Using

F max(q)

and B(q) as filter N(q) and M(q), then you

can apply the Instrumental Variable method to estimate B(q) and F(q) of Equation 1 and have:

v(n) y(n)
Here, as elsewhere,

B (q)
C(q)
u(n k )
e(n)
D(q)
F (q)

denotes the estimation of

. If

Nc 0 ,

(3)

Equation 3 can be re-written as

D(q)v(n) e(n)

(4)

Equation 4 can be treated as an AR model. With the AR model estimation, you have an estimation
for D(q). If

Nc 0 ,

Equation 3 is rewritten as

D(q)
v(n) e(n)
C(q)
Then a high order AR model is applied to estimate

e(n) .

Since

(5)

v(n) and e(n) are known now,

Equation 5 can be rewritten as

D(q)v(n) (C(q) 1)e(n) e(n)

(6)

Equation 6 is one form of ARX model. Then C(q) and D(q) can be estimated by using ARX model
estimation methods with

v(n)

and

e(n) as the output and input, respectively.

Standard Deviations of B(q), F(q), C(q) and D(q)


Refer to the Equation (9.18) and (9.19) on Page 284 of Ref 1.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

National Instruments Corporation

25

System Identification Toolkit

Algorithm References

si_Est GL Model (SISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est GL Model (SISO).vi, which
is the core VI to estimate the coefficients of a general-linear (GL) (SISO) model based on the
input-output data of a system. The si_Est GL Model (SISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb.

2.

Function Description
A GL (SISO) model is described as:

A(q) y(n)
where

B(q)
C(q)
u(n k )
e(n)
F (q)
D(q)

(1)

Na

Nb 1

Nf

Nc

i 1

i 0

i 1

i 1

A(q) 1 ai q i , B(q) bi q i , F (q) 1 f i q i , C(q) 1 ci q i


Nd

D(q) 1 di q i

and q is the backward shift operator, which means:

i 1

q i y(n) y(n i) .
k is the delay of the system. The purpose of this VI is to estimate the coefficients
,

[a1 , a2 ,....,aNa ]

[b0 , b1 ,....,bNb 1 ]

[ f1 , f 2 ,...., f N f ]

and

[c1 , c2 ,....,cNc ]

[d1, d2 ,....,dNd ] based on the input-output data of a system.


3.

APIs
Para Name
stimulus

In/Out

Type

Description

In

1D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster

A order, B order, F order, C order, D

signal
response
signal
model
parameters

order and delay are


Nd

GL model

Out

Cluster

Na

Nb

Nf

Nc ,

and k, respectively.

A is

[1, a1 , a2 ,....,aNa ] . B

is [0,...0, b0 , b1 ,....,bNb 1 ] , The


number of zeros at the beginning
equals k. F is

System Identification Toolkit

26

[1, f1 , f 2 ,...., f N f ] .

ni.com

Algorithm References

is

[1, c1, c2 ,....,cNc ] and D is

[1, d1, d2 ,....,d Nd ]


std deviations

Out

Cluster

The standard deviations of


coefficients A, B, F, C, and D

noise variance

Out

DBL

Variance of e(n)

covariance

Out

2D DBL Array

Out

1D DBL Array

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for A(q), B(q), F(q), C(q) and D(q),
and then the Gauss-Newton minimization method is applied to refine the results of A(q), B(q), F(q),
C(q) and D(q).
Multi-Stage coarse estimation
This method is generally described on page 337 of Ref 1. Here is the deduction specific for GL
model.
Let

(n) F (q)

C(q)
e(n)
D(q)

(2)

Then Equation 1 becomes

A(q)F (q) y(n) B(q)u(n k ) (n)

(3)

You then can apply the instrumental variable (IV) method to estimate B(q) and A(q)F(q). Let

(n)

C(q)
e(n) , then Equation 1 becomes
D(q)

A(q) y(n)

B(q)
u(n k ) (n)
F (q)

(4)

You can approximately consider Equation 4 as an ARX model, whose B order is high
(

Nb

Nf

Nc

+ N d ). Then by applying the instrumental variable method, you get A(q). Since

A(q)F(q) and A(q) are known now, you can compute F(q) (=A(q)F(q)/A(q)). So far you already
have estimation for A(q), B(q), and F(q). Substituting them into Equation 1, you have

B (q)
C(q)
v(n) A(q) y(n)
u (n k )
e(n)

D(q)
F (q)
Here, as elsewhere,

denotes the estimation of

. If

Nc 0 ,

Equation 4 can be rewritten as

D(q)v(n) e(n)

National Instruments Corporation

27

(5)

(6)

System Identification Toolkit

Algorithm References

Equation 6 can be treated as an AR model. With the AR model estimation, you can have an
estimation for D(q). If

Nc 0 ,

Equation 5 is rewritten as

D(q)
v(n) e(n)
C(q)
Then a high order AR model is applied to estimate

e(n) .

Since

(7)

v(n) and e(n) are known now,

Equation 7 can be rewritten as

D(q)v(n) (C(q) 1)e(n) e(n)

(8)

Equation 8 is one form of ARX model. C(q) and D(q) can be estimated by using ARX model
estimation methods with

v(n)

and

e(n) as the output and input, respectively.

Standard Deviations of A(q), B(q), F(q), C(q) and D(q)


Refer to Equations (9.18) and (9.19) on Page 284 of Ref 1.

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Est GL Model (MISO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Est GL Model (MISO).vi,
which is the core VI to estimate the coefficients of a general-linear (GL) (MISO) model based on
the input-output data of a system. The si_Est GL Model (MISO).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
A GL (MISO) model is described as:

A(q) y(n)
where

Na

A(q) 1 ai q i

B(q)
C(q)
u(n k )
e(n)
F (q)
D(q)

(1)

i 1

B(q) [B1 (q), B2 (q),....,BN (q)] and Bi (q)


F (q) [F1 (q), F2 (q),....,FN (q)]

Nib 1

b q
j 0

ij

Nif

and

Fi (q) 1 f ij q j

j 1

B (q)
B(q) B1 (q) B2 (q)
[
,
,..., N ] ,
F (q) F1 (q) F2 (q)
FN (q)

System Identification Toolkit

28

ni.com

Algorithm References

u(n k) [u1 (n k1 ),u2 (n k2 ),....,uN (n kN )]T , N is the number of input channels,


Nc

Nd

i 1

i 1

C(q) 1 ci q i , D(q) 1 di q i

and q is the backward shift operator, which means:

q i y(n) y(n i) .

ki

is the delay of the i-th input of the system. The purpose of this VI is to estimate the coefficients

[a1 , a2 ,....,aNa ] , [bij ] , [ fij ] , [c1 , c2 ,....,cNc ] ,

and

[d1 , d2 ,....,d Nd ]

based on the input-

output data of a system.


3.

APIs

Para Name
stimulus

In/Out

Type

Description

In

2D DBL Array

The input signal of a system

In

1D DBL Array

The output signal of a system

In

Cluster containing A order,

A order, B order, F order, C order, D

B order, F order, C order, D

order and delay are

signal
response
signal
model
parameters

order and delay. B order and


F order are 1D I32. A order ,
C order, D order and delay

Na

[ N1b , N 2 b ,....,N Nb ] , [ N1 f , N 2 f ,....,N Nf ] , N c ,


Nd

and

[ k 1 , k 2 ,....,k N ] ,

respectively.

are I32.
GL model

Out

Cluster

A is

[1, a1 , a2 ,....,aNa ] .

B is a matrix as

0,...0, b10 , b11,....,b1( N1b 1)

0,...0, b20 , b21,....,b2( N2b 1) . The


...

0,...0, bN 0 , bN1 ,....,bN ( N Nb 1)


number of zeros at the beginning of ith
row equals

ki

F is a matrix as

1, f11, f12 ,...., f1N1 f

1, f 21, f 22 ,...., f 2 N2 f

...

1, f N1 , f N 2 ,...., f NN
Nf

C is

National Instruments Corporation

29

[1, c1, c2 ,....,cNc ] and D is


System Identification Toolkit

Algorithm References

[1, d1, d2 ,....,d Nd ]


std

Out

Cluster

The standard deviations of coefficients

deviations
noise

A, B, F, C, and D
Out

DBL

Variance of e(n)

Out

2D DBL Array

Out

1D DBL Array

variance
covariance

matrix
noise

4.

e(n)

Algorithms
The multi-stage method is applied to have a coarse estimation for A(q), B(q), F(q), C(q) and D(q),
and then the Gauss-Newton minimization method is applied to refine the results of A(q), B(q), F(q),
C(q) and D(q).
Multi-Stage Coarse Estimation
This method is generally described on page 337 of Ref 1. Here is the deduction specific for GL
(MISO) model.
Let

(n) F (q)
and set

C(q)
e(n)
D(q)

Fi (q) 1, then Equation 1 becomes


A(q)F max(q) y(n) B(q)u(n k ) (n)

where

(2)

F max(q)

is the polynomial with maximum order in all

estimation methods to estimate B(q) and

A(q)F max(q) .

(3)

Fi (q) . You can apply ARX model

Since you can approximately consider

Fi (q) 1 in this initial estimation step, Equation 1 can be rewritten as


A(q) y(n) B(q)u(n k ) (n)
Using

(4)

A(q)F max(q) and B(q) as filter and then applying the Instrumental Variable method, you

have the estimation for

A(q)

and

B(q) . Substituting them into Equation 1, you can have

B (q)
C(q)
v(n) A(q) y(n)
u (n k )
e(n)
D(q)
F (q)
Here, as elsewhere,

denote the estimation of

. If

Nc 0 ,

(5)

Equation 4 can be rewritten as

D(q)v(n) e(n)

(6)

Equation 6 can be treated as an AR model. With the AR model estimation, you have an estimation
for D(q). If

Nc 0 ,

Equation 5 is re-written as

D(q)
v(n) e(n)
C(q)
System Identification Toolkit

30

(7)

ni.com

Algorithm References

Then a high order AR model is applied to estimate

e(n) .

Since the

v(n) and e(n) are known now,

Equation 7 can be rewritten as

D(q)v(n) (C(q) 1)e(n) e(n)

(8)

Equation 8 is one form of ARX model. Then C(q) and D(q) can be estimated by using ARX model
estimation methods with

v(n)

and

e(n) as the output and input, respectively.

Standard Deviations of A(q), B(q), F(q), C(q) and D(q)


Refer to Equations (9.18) and (9.19) on Page 284 of Ref 1.
5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

SI Estimate Continuous Transfer Function Model


(SISO Array).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Continuous Transfer
Function Model (SISO Array).vi. The SI Estimate Continuous Transfer Function Model (SISO
Array).vi is the core VI used to estimate continuous transfer functions. The SI Estimate
Continuous Transfer Function Model (SISO Array).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation.llb directory.

2.

Function Description
The continuous transfer function model can be represented as

y(k ) H (s)u(k ) e(k )

(1)

where u(k) and y(k) are the input and output of a system, e(k) is the additive noise, and H(s) is
represented by the following equation.

H ( s)

b0 b1s... b j s j ... bm s m sTd


e , mn
a0 a1s... ai s i ... an s n

where m is the numerator order, n is the denominator order, and

Td

(2)
is the time delay. The purpose

of this VI is to estimate the transfer function H(s).


3.

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

orders of

In

Cluster

m is the numerator order and n is the

National Instruments Corporation

31

System Identification Toolkit

Algorithm References

transfer function

denominator order

model
delay initial

In

DBL

The initial guess of

sampling rate

In

DBL

system model

Out

Object containing

guess (s)

out

information about this

model
coefficients of

Out

Cluster

Numerator is b0, b1,...,bm ,

transfer function

Denominator is a0 , a1,...,an

model
delay (s)

4.

Td

Out

DBL

The estimated

Td

Algorithms
This VI uses three steps to estimate the continuous transfer function H(s).
1)

Estimate an equivalent discrete transfer function.

Using the zero-order-hold method, the continuous transfer function

H(s) can be converted to the

following discrete transfer function.

H ' z z Td / dtGz

(3)

v0 v1 z .... vn z n
Gz
u0 u1 z ... un z n

(4)

where

dt is the sampling interval of the stimulus and response signals.

vn

might be zero when

m n.

Equation 4 uses a slightly higher numerator order to include all the possible cases.
The first step is to estimate the discrete transfer function

Gz . Refer to the SI Estimate Discrete

Transfer Function Model (SISO Array).vi for more information about estimating the discrete
transfer function model.
2)

Convert the estimated discrete transfer function to a continuous transfer function.

Using the zero-order-hold method, you can convert

Gz to a continuous transfer function. The

converted model might have a higher numerator order than m. The SI Estimate Continuous
Transfer Function Model (SISO Array).vi truncates unnecessarily high order coefficients, and the
coefficients you obtain are the initial estimates for minimization in step 3.
3)

Use the Gauss-Newton minimization method to refine the initial estimation.

The initial guess of

Td

and the initial estimates of

ai and bj

are tuned by the Gauss-Newton

optimization method to minimize the following cost function:

System Identification Toolkit

32

ni.com

Algorithm References

VN

1 N 1 2
e (k )
N k 1 2

(5)

SI Estimate Discrete Transfer Function Model (SISO


Array).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Discrete Transfer
Function Model (SISO Array).vi. The SI Estimate Discrete Transfer Function Model (SISO
Array).vi is the core VI used to estimate discrete transfer functions with the direct identification
approach. The SI Estimate Discrete Transfer Function Model (SISO Array).vi is located in the
labview\vi.lib\addons\System Identification\Parametric Estimation.llb directory.

2.

Function Description
The discrete transfer function model can be represented as

y(k ) H ( z)u(k ) e(k ) ,

(1)

where u(k) and y(k) are the stimulus and response signals, e(k) is the additive noise, and H(z) is
represented by the following equation.

b0 b1 z... bm z m
H ( z)
, m n
a0 a1 z... an z n

(2)

where m is the numerator order and n is the denominator order. The purpose of this VI is to
estimate the transfer function H(z) using the stimulus and response signals of a system.

3.

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

orders of

In

Cluster

m is the numerator order and n is the

transfer function

denominator order

model
sampling rate

In

DBL

system model

Out

Object containing

out

information about this


model

coefficients of

Out

b0 ,b1,...,bm ,
Denominator is a0 , a1 ,...,an

Cluster

Numerator is

transfer function
model

National Instruments Corporation

33

System Identification Toolkit

Algorithm References

4.

Algorithm
The model shown in Equation 1 is one type of output-error (OE) model. Therefore, you can
estimate the transfer function H(z) by estimating an equivalent OE model. You can obtain the
order of this OE model by expressing H(z) in terms of the negative power of z. The following
equation shows the relationship between the discrete transfer function and an OE model.

H z 1 z ( nm)

bm ... b1 z1m b0 z m
an ... a1 z1n a0 z n

(3)

Using Equation 3, you can find that the B order, F order, and delay of this equivalent OE model
are m+1, n, and n-m, respectively.
You also can apply the indirect identification and joint input-output identification approaches to
estimate a transfer function model. Refer to the LabVIEW System Identification Toolkit User
Manual for information about the indirect identification and joint input-output identification
approaches. With the joint input-output identification approach, any open-loop model estimation
method can be used to estimate the transfer function between the reference signal and the stimulus
signal. The System Identification Toolkit uses a long FIR model to estimate this transfer function.
[Ref 1]

5.

References
[1] Paul M.J.Van Den Hof, Ruud J.P.Schrama: An Indirect Method for Transfer Function
Estimation from Closed Loop Data, Automatica, Vol. 29, No. 6, 1993, pp. 1523-1527.

SI Estimate User-Defined Model (MIMO Array).vi


1.

Introduction
This section includes the algorithms and references used by the SI Estimate User-Defined Model
(MIMO Array).vi. The SI Estimate User-Defined Model (MIMO Array).vi is the core VI used to
estimate user-defined models. The SI Estimate User-Defined Model (MIMO Array).vi is located in
the labview\vi.lib\addons\System Identification\Parametric Estimation.llb directory.

2.

Function Description
The purpose of this VI is to estimate a user-defined model. You can use a template VI to define a
linear or nonlinear model and then use the SI Estimate User-Defined Model (MIMO Array).vi to
estimate this defined model.

3.

APIs

Para Name
stimulus signal

System Identification Toolkit

In/Out
In

Type

Description

2D DBL Array

The input signal of a system

34

ni.com

Algorithm References

response signal

In

2D DBL Array

The output signal of a system

user defined

In

Path

The file path of the VI that defines the

model

model to be estimated

variables

In

1D Cluster Array

The names and initial guesses of the


variables

data

In

Variant

The static data that the user-defined


function needs at run time

termination

In

Cluster

The stop conditions for model


estimation

response

Out

2D DBL Array

The simulated response signal from

obtained by

the estimated model

estimated model
optimized

Out

1D Cluster Array

variables
number of

The name and optimized value of


each variable

Out

Numeric

The number of times this VI calls the

function calls

user-defined model subVI during the


estimation process

4.

Algorithm
You can estimate a user-defined model by refining the initial estimates using Gauss-Newton
optimization routines. The purpose of optimization is to minimize the following cost function:

1 N 1
1 N 1
VN e 2 (k , ) yk , yk
N k 1 2
N k 1 2

where
and

is the variable vector,

(1)

yk , is the response the user-defined model subVI calculates,

yk is the measured response.

si_Impulse Realization (MIMO).vi


1.

Introduction
This section includes the algorithms and references used by the si_Impulse Realization
(MIMO).vi. The si_Impulse Realization (MIMO).vi is the core VI used to estimate state-space
models from the impulse response of a system. The si_Impulse Realization (MIMO).vi is located
in the labview\vi.lib\addons\System Identification\ Parametric Estimation Subs.llb directory.

2.

Function Description
State-space models in this VI are defined as:

National Instruments Corporation

35

System Identification Toolkit

Algorithm References

xt 1 Axt But
yt Cxt Dut

(1)

The goal of this VI is to estimate the system matrixes A, B, C, and D using the impulse response

hk , where k>=0.
3.

APIs
Para Name

In/Out

Type

Description

impulse response

In

Cluster

The impulse response of this system

model order

In

I32

The number of states

length

In

I32

The length of the impulse response used to


estimate the model

coefficients of state-

Out

Cluster

The A, B, C, and D matrixes of the state-

space model

4.

space model

Algorithms
The impulse response of this system can be computed as

h0 D , hk CAk 1B ,

k>0

(2)

The Hankel matrix is defined as

hk 1 hk 2 ... hk j 1 hk j
h
...
k 2 hk 3 ...
...
H ij k hk 3

...

hk i ... ... ... hk i j

(3)

Hij k Oi Ak Fj
where

Oi

and

Fj

are the extended observability and controllability matrixes, respectively.

Oi C CA ... CAi1

, F B
T

AB ... A j 1B

From the above equations, you can deduce:

Hij 0 Oi Fj ,

(4)

Hij 1 Oi AFj

(5)

Oi B Hi,1 0 , CFj H1, j 0

(6)

The SVD of

Hij 0 is

H ij 0 U1 U 2 1

System Identification Toolkit

V1T
T
T U1 1V1
V2

36

(7)

ni.com

Algorithm References

where

contains the n largest singular values, n is the model order, or number of states, and

U1 and V1 are orthogonal matrixes. [Equation 3-7, Ref 1]


From Equations 4 and 7, you can deduce:
1

Oi U1 12 , Fi 12 V1T

[Ref 2]

(8)

From Equations 5, 6, and 8, you can deduce:


1

11 2
A 1 2 U1T Hi, j 1V

B 1 2 U1T Hi,1 0

C H1, j 0V1 1

1
2

The above three equations are the Zeiger-McEwen approximate realization algorithm. [Ref 2]
5.

References
[1] Xmath System Identification Module, Part 1
[2] H.P. Zeiger and A.J.McEwen, Approximate Linear Realization of Given Dimension via Hos
Algorithm, IEEE Transactions on Automatic Control, Volume 19, Issue 2, Apr 1974 Page: 153

Subspace Identification Method via Principal


Component Analysis (SIMPCA)
1.

Introduction
This section includes the algorithms and references used by the si_State Space Model Estimation
(SISO).vi and the si_State Space Model Estimation (MIMO).vi. They are the core VIs to estimate
the coefficients of a state-space model based on the input-output data of a system. The si_State
Space Model Estimation (SISO).vi and the si_State Space Model Estimation (MIMO).vi are
located in the labview\vi.lib\addons\System Identification\Parametric Estimation Subs.llb directory.

2.

Function Description
The state space model in the System Identification Toolkit is defined as

qxt Axt But Ket


yt Cxt Dut et
The goal of this VI is to find an estimate for the system matrix A, B, C, D, disturbance dynamics
Kalman gain K, and the initial states X0 , based on the stimulus and response data sequence
and

ut

yt .

National Instruments Corporation

37

System Identification Toolkit

Algorithm References

3.

API
For SISO Case
Para Name

In/Out

Type

Description

stimulus

In

1D DBL Array

The stimulus signal into the system

response

In

1D DBL Array

The response output from the system

# of states

In

I32

Number of states

# p,f

In

I32

Estimation horizon

structure

In

Cluster

Information about the D matrix, K matrix and

selector
SS coef

initial state
Out

Cluster

The coefficients of state space model, A, B, C,


and D

Out

1D DBL Array

Kalman gain

X0

Out

1D DBL Array

Initial States

For MIMO Case


Para Name

In/Out

Type

Description

stimulus

In

2D DBL Array

The stimulus signal into the system

response

In

2D DBL Array

The response output from the system

# of states

In

I32

Number of states

# p,f

In

I32

Estimation horizon

structure

In

Cluster

Information about the D matrix, K matrix and

selector
coefficients

initial state
Out

Cluster

The coefficients of state space model system

of state-

matrix, A, B, C, and D

space

4.

Out

2D DBL Array

Kalman gain

X0

Out

1D DBL Array

Initial States

Algorithm
A state space model in linear regression form can be represented as

qxt A B xt K
y C D u I et
t
t
Using the least squares criterion and you get the following equation to solve the parameter matrix:

qX t A B X t qX t T T
A B
C D min Y C D U Y X t ,U t

t t
t

Where

Xt T T
X t ,U t
U
t

(1)

denotes the pseudo inverse.

From the above equation, you can see that you can estimate the system matrix if you can estimate
the state sequence

System Identification Toolkit

Xt .
38

ni.com

Algorithm References

A.

Estimation of System Matrix


The System Identification Toolkit defines the past and future Hankel data matrices in the following
way:

yt
qy
t
Yf

f 1
q yt

yt 1
qyt 1

f 1
q y y1

q 1 yt


q p y
Z p 1 t
q ut

p
q ut

q 1 yt 1

p
q yt 1
q 1ut 1

p
q ut 1

yt N 1
ut

, U qut
f

f 1
q f 1 yt N 1
q uu

ut 1
qut 1

f 1
q ut 1

ut N 1

f 1
q ut N 1

q 1 yt N 2 q 1 yt N 1

q p yt N 2 q p yt N 1

q 1ut N 2 q 1ut N 1

q p ut N 2 q p ut N 1

(2)

Where p is the past horizon, f is the future horizon. By iterating the system equations, you can get
the extended model, represented by the following equation:

Yf f X H f U f Gf E f
Where f is the extended system observability matrix.

0 0 0
D
C
CB
D 0 0
CA

, H CAB CB D 0
f
f

f 1

CA
f

2
CA B CB
0 0 0
I
CK
I
0 0

G f CAK CK I
0

2
CA K CK

0
0
0,

0
D

0
0
0

0
I

The Kalman state X is unknown, but that any Kalman state is estimated from past input and output
data is known, i.e.

U p
X Lu , Ly Lz Z p
Yp

Then you can have

Yf f Lz Z p H f U f Gf E f
Project out

Uf

by multiplying

National Instruments Corporation

U f

and remove noise

39

E f by multiplying Z Tp , you get

System Identification Toolkit

Algorithm References

Yf U f Z Tp z Z p U f Z Tp
Where

z f Lz

and

p is the extended system controllability matrix. z

using the QR decomposition equivalents for

can be estimated

[U Tf , Z Tp ,Y fT ] .

R11 R12 R13


U , Z , Y Q1, Q2 , Q3 0 R22 R23
0 0 R33

T
T
z R23
R22 R22
R22

T
f

T
p

T
f

After obtaining the z , you can estimate

(3)

by performing SVD decomposition on

(4)

weighted

with Z p .

SVD

z Z p USV T
f U1

Because you already obtained the estimation of

Xt

by solving z Z p

z and f , then you can estimate the state sequence

f X t . That is

X t Tf f
And also the
With the

B.

qXt

(5)

pT z Z p

(6)

can be estimated similarly.

Yt U t X t and qXt

you can solve the equation 1 to obtain A, B, C, and D.

Estimation of Kalman Gain K

Yf Z G f E f

From

U f

T
R33
Q3T G f E f

You can get


Where

T
R33
Q3T comes from equation (3).

Transform the innovation process into unit variance white sequence, e1 , i.e.

e(t) Fe1 (t)

G f E f G f F E1 f Gf E1 f
T
Gf E1 f R33
Q3T

Because

Q3T

is an orthonormal matrix, you can choose E1 f

System Identification Toolkit

40

Q3T , then

ni.com

Algorithm References

T
Gf R33

Then the Kalman gain K, actually KF, can be identified from the first block column of
as

G f , denoted

Gf 1 ,
F
CKF I
0 F

mm
Gf 1
0 1:m f 1,: KF
f 2
CA F

KF and F can be estimated using least squares, which then leads to

K KF F 1

C.

(7)

Estimation of Initial States X0


To write the equation

Yf f X H f U f Gf E f

at t = 0,

Y f 0 f X 0 H f U f 0 Gf E1 f 0
You can first compute Yf 0 for zero initial states to obtain
through the estimated system with X 0
By removing

H f U f 0 by processing the stimulus

0, , 0.

H f U f 0 from the double sides of the above equation you have:

G Y
1
f

f0

H f U f 0 Gf

f X 0 E1 f 0

(8)

You can estimate the X0 using least squares.

5.

Reference
[1]. Jin Wang and S. Joe Qin. A New Deterministic-Stochastic Subspace Identification Method
Using Principal Component Analysis. TWMCC Technical Report TWMCC-2004-01.
[2]. Peter Van Overschee and Bart De Moor. N4SID : Subspace Algorithms for the Identification of
Combined Deterministic-Stochastic Systems. Automatica, Special Issue on Statistical Signal
Processing & Control, Vol.30, No.1, pp.75-93, 1994.
[3]. Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Correlation Analysis.vi
1.

Introduction
This section includes the algorithms and references used by the si_Correlation Analysis.vi, which
is the core VI to estimate impulse responses of a system. The si_Correlation Analysis.vi is located
in the labview\vi.lib\addons\System Identification\Nonparametric Estimation Subs.llb directory.

National Instruments Corporation

41

System Identification Toolkit

Algorithm References

2.

Function Description
A discrete-time description of the system with an additive disturbance v(t ) can be represented as:

y(t ) g (k )u(t k ) v(t ) ,

t 0,1,2,

(1)

k 0

where u(t) and y(t) are the input and output of a system, and v(t) is the disturbance of the system.
g(k) is the impulse response of the system.
The purpose of this VI is to estimate the impulse response, g(k), of the system based on the input
and output of the system.

3.

Function API
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response

In

1D DBL Array

The output signal of a system

AR Order

In

I32

Order of the prewhitening filter

num of points

In

DBL

Length of impulse response sequence g(k)

Impulse

Out

1D DBL Array

Estimated impulse response

whiteness test

Out

XY Graph

Plot to indicated the effect of the prewhitening

rejected

Out

Boolean

Whether or not the estimated impulse response is

signal

Response

reliable
confidence

Out

DBL

Confidence level of the impulse response

level

4.

Algorithms [Page 169, Correlation Analysis, Ref 1]


According to Equation 1, the autocorrelation of the inputs,
input and output,

Ru , and cross-correlation between

Ryu , are related with

Ryu ( ) g (k )Ru (k )

(2)

k 0

If the input signal u(t) is white noise sequence, then

Ru ( ) E[u(t )u(t )] ( )
where

is the variance of u(t). Substituting Equation 3 to 1 yields


R ( )
g ( ) yu

(3)

(4)

Input Pre-Whitening

System Identification Toolkit

42

ni.com

Algorithm References

If the input sequence is not exactly random white noise, large errors exist in the impulse response
calculated from the above correlation analysis method. A pre-whitening FIR filter is applied to
both the input and output sequences to whiten the input sequence. The coefficients of the prewhitening filter are exactly the coefficients of the AR model of the input sequence.

Whiteness Test
The stimulus signal after prewhitening is considered to be white noise. However, if the AR order is
not selected properly, this prewhitening might not be as good as expected. Therefore, you need to
test the whiteness of the prewhitened stimulus signal by computing and plotting the autocorrelation

and 99% confidence level with the System Identification Toolkit. If all Ru ( ),

are within

the confidence region, you have 99% confidence to say that the signal has been prewhitened.

( ) , where is the variance of the


~
~
signal. In other words, all Ru ( ), 0 are exactly zeros, while Ru (0) equals to the variance of
~
the white noise. Because of the limit length of the signal to compute Ru ( ) , each point of
~
Ru ( ), 0 is usually considered as zero mean Gaussian distribution with variance
Theoretically, the autocorrelation of a white noise is

2 / N [Page 512. Whiteness Test, Ref 1]. So the 99% confidence level of each point of
~
Ru ( ), 0 is computed by 2.576 ( 2.576 / N ) . The constant 2.576 is computed as
the following diagram:

5.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

SI Estimate Impulse Response (Least Squares


Array).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Impulse Response
(Least Squares Array).vi. The SI Estimate Impulse Response (Least Squares Array).vi is the core
VI used to calculate an impulse response using the least squares method. The SI Estimate Impulse
Response (Least Squares Array).vi is located in the labview\vi.lib\addons\System
Identification\Nonparametric Estimation.llb directory.

National Instruments Corporation

43

System Identification Toolkit

Algorithm References

2.

Function Description
A discrete-time description of a system with an additive noise e(n) can be represented as:

yn

hk un k en ,

where u(n) and y(n) are the input and output of a system, and h(k) is the impulse response of the
system. The purpose of this VI is to estimate the impulse response, h(k), using the input and output
signals of the system.
3.

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

impulse

In

Cluster

Number of points for which t<0 and t>=0,

response length
impulse

represented as

N t 0

and

N t 0

, respectively

Out

Cluster

The estimated impulse response

Out

Cluster

The standard deviation of the estimated

response
standard
deviation

4.

impulse response

Algorithms
Using Equation 1, you can calculate the following linear equations by truncating the impulse
response to a limited length.

AH E Y

(2)

where

h Nt 0
T ( p)
e( p Nt 0 )
h N 1
T

0
e( p 1 N )

( p 1)
t 0

, E
A
, H
, and

h( Nt 0 1)
(L 1)
e( L 1 Nt 0 )
hNt 0

y( p Nt 0 )
y ( p 1 N )
t 0
Y

y( L 1 Nt 0 )

(t ) u(t ) u(t 1)...u(t Nt 0 Nt0 1)T


p Nt 0 Nt 0 1
L is the length of the signals.
By finding the optimal H, you can minimize the following cost function:

System Identification Toolkit

44

ni.com

Algorithm References

L1 Nt 0
2

e n

(3)

n p Nt 0

You then can deduce that the optimal solution for the above cost function is

H AT A AT Y

(4)

Equation 4 also is known as the least squares method. The covariance matrix of the estimated
impulse response is:

C e AT A

(5)
where C is the covariance matrix and e is the variance of the noise e(n). [Ref 1]

5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall, Page 284,
Equation 9.18.

si_Frequency Analysis.vi
1.

Introduction
This section includes the algorithms and references used by the si_Frequency Analysis.vi, which is
the core VI to estimate frequency response of a system. The si_ Frequency Analysis.vi is located in
the labview\vi.lib\addons\System Identification\Nonparametric Estimation Subs.llb directory.

2.

Function Description
The discrete-time description of a system can be represented as

Ryu ( ) g (k )Ru (k )

(1)

k 0

where

Ru

is the autocorrelation of the input of a system, and

Ryu

is the cross-correlation between

the input and output of a system. g(k) is the impulse response of the system. By using the Fourier
transform on both sides of Equation 1, you obtain

yu (e j ) G(e j )u (e j )
G(e j ) is known as the frequency response of the system.

(2)

The purpose of this VI is to estimate

the frequency response of a system based on its measured input and output signal. Refer to the
si_Correlation Analysis.vi for more information about the discrete-time description of a system.
3.

Function API
Para Name
stimulus signal

In/Out
In

National Instruments Corporation

Type
1D DBL Array

Description
The input signal of a system
45

System Identification Toolkit

Algorithm References

response

In

1D DBL Array

The output signal of a system

In

I32

Order of the prewhitening filter

In

I32

Number of points of the frequency response

signal
Window
length
num of freq
bins

sequence

freq in log?

In

Boolean

Boolean to select whether the frequency points are


distributed linearly or logarithmically

amplitude in

In

Boolean

dB?

Boolean to determine whether the amplitude of the


frequency response is in dB unit

sampling rate

In

DBL

Amplitude

Out

XY Graph

Amplitude of the frequency response

Out

XY Graph

Phase of the frequency response

Out

Cluster

The standard deviation of the amplitude and phase

Response
Phase
Response
Std deviations

response

4.

Algorithms [Page 178, Spectral Analysis, Ref 1]


From Equation 2, the frequency response of the linear system can be computed by[Equation 6.51,
Ref 1]:

Nyu ()

G(e ) N
u ()

(3)

where
N 1
Nyu () 1 Ryu ( )e j

N 0
N 1
uN() 1 Ru ( )e j

N 0

(4)

(5)

However, due to the limit length of the signal to compute Equation 4 and 5, the frequency leakage
of the Fourier transform may corrupt the estimation of frequency response. So normally the
following window is applied to reduce the leakage of the Fourier transform.

yu (e j )

1 N 1
Ryu ( )w( )e j

N 0

u (e j )
w( )

1 N 1
Ru ( )w( )e j

N 0

(6)

(7)

is known as the lag window. The lag window controls the trade-off of the variance and bias

of the frequency response estimation. The narrower the lag window, which is applied on the

System Identification Toolkit

46

ni.com

Algorithm References

correlation function in time domain, the more different frequencies will be weighted and then the
estimated frequency response is smooth. However, the estimation may be biased considerably.
Residual Spectrum
The spectrum of the residual of a system can be computed with [Equation 6.78, Ref 1]:

Nyu ()

N
N

v () y () N
u ()

(8)

Standard Deviation of Frequency Response


The standard deviation of the frequency response estimation can be estimated with [Equation 6.59,
Ref 1]:

E | G N (e j ) EG N (e j ) |2
where N is the signal length and

W ( ) 0.75

()
1
W ( ) v
N
u ()

(9)

because a Hanning window is used.

is the

window length. [Equation 6.57, Ref 1]


5.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

SI Estimate Partially Known Continuous Transfer


Function Model (General SISO Array).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Partially Known
Continuous Transfer Function Model (General SISO Array).vi. The SI Estimate Partially Known
Continuous Transfer Function Model (General SISO Array).vi is the core VI used to estimate a
partially known state-space model. The SI Estimate Partially Known Continuous Transfer
Function Model (General SISO Array).vi is located in the labview\vi.lib\addons\System
Identification\Partially Known Model Estimation.llb directory.

2.

Function Description
The partially known transfer function model is represented by the following two equations:

K p (1 a1s ... al sl )

1 T s1 2r s / s / w
i
p

j 2

1 T s1 2r s / s / w
i
p

National Instruments Corporation

(1)

sh K p (1 a1s ... al sl )

e sTd

j 2

e sTd

(2)

47

System Identification Toolkit

Algorithm References

Where

K p is the static gain


Td is the time delay

Tpi is the first-order time constant

is the natural frequency

r j is the damping ratio


In Equation 1, h is the number of poles at the origin in the model:

h i 2 j n , where n

is the denominator order

l m , where m is the numerator order


In Equation 2, h is the number of zeros at the origin in the model:

i 2 j n , where n is the denominator order

h l m , where m is the numerator order


st

The special 1 order model is represented as:

K p sTd
e
1 Tp s

(3)

The special 2nd order model is represented as:

Kp
e sTd
1 2rs / s 2 / 2
3.

(4)

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

1D DBL Array

The input signal of a system

response signal

In

1D DBL Array

The output signal of a system

system model in

In

Object containing the


partially known

information about a
system model
sampling rate

In

DBL

system model

Out

Object containing

out

information about this

model
coefficients of

Out

Cluster

transfer function

model
delay (s)

Out

Numeric

The estimated

den info

Out

Cluster

The estimated denominator

Td

information

System Identification Toolkit

48

ni.com

Algorithm References

static gain

4.

Out

Numeric

The estimated

Kp

Algorithm
You can estimate a partially known continuous transfer function model by refining initial estimates
with Gauss-Newton optimization routines. The purpose of optimization is to minimize the
following cost function:

VN
where

1 N 1 2
1 N 1
e
(
k
,

yk, yk
N k 1 2
N k 1 2
is the variable vector,

(5)

yk , is the predicted response, and yk is the measured

response.
If you have prior knowledge about

K p , Td , Tpi , j , and r j ,

you can specify these variables

using the SI Create Partially Known Continuous Transfer Function Model VI. If you do not
specify these variables using the SI Create Partially Known Continuous Transfer Function Model
VI, the SI Estimate Partially Known Continuous Transfer Function Model VI can find the initial
estimates for these variables. Refer to the SI Estimate Continuous Transfer Function Model (SISO
Array).vi for more information about finding the initial estimates for the coefficients of a
continuous transfer function model.

SI Estimate Partially Known State-Space Model (MIMO


Array).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Partially Known StateSpace Model (MIMO Array).vi. The SI Estimate Partially Known State-Space Model (MIMO
Array).vi is the core VI used to estimate partially known state-space models. The SI Estimate
Partially Known State-Space Model (MIMO Array).vi is located in the
labview\vi.lib\addons\System Identification\Partially Known Model Estimation.llb directory.

2.

Function Description
Discrete state-space models can be represented as:

xt 1 Axt But Ket


yt Cxt Dut et
Continuous state-space models can be represented as:

dxt
Axt But Ket
dt
National Instruments Corporation

49

System Identification Toolkit

Algorithm References

yt Cxt Dut et
The goal of this VI is to estimate a user-defined state-space model.
3.

APIs
Para Name

In/Out

Type

Description

stimulus signal

In

2D DBL Array

The input signal of a system

response signal

In

2D DBL Array

The output signal of a system

system model in

In

Object containing the


partially known
information about a
system model

sampling rate

In

DBL

system model out

Out

Object containing
information about this
model

coefficients of

Out

Cluster

The estimated values for A, B, C, and

state-space model
variables

D.
Out

1D Cluster Array

The name and optimized value of


each variable

4.

Kalman gain

Out

2D DBL Array

The estimated K matrix

initial states

Out

1D DBL Array

The estimated initial states

Algorithm

You can estimate a partially known state-space model by refining initial estimates using Gauss-Newton
optimization routines. The purpose of optimization is to minimize the following cost function:

1 N 1
1 N 1
VN e2 (k , ) yk , yk
N k 1 2
N k 1 2

where

is the variable vector,

(1)

yk , is the predicted response, and yk is the measured

response.
You can specify the initial estimates for the variables of a model using the SI Create Partially
Known State-Space Model VI.

Recursive Model Estimation VIs


1.

Introduction
This section includes the algorithms and references used by the si_Recursive ARMAX Model
(SISO).vi, si_Recursive OE Model (SISO).vi, si_Recursive BJ Model (SISO).vi, and si_Recursive

System Identification Toolkit

50

ni.com

Algorithm References

GL Model (MISO).vi. These VIs are located in the labview\vi.lib\addons\System


Identification\Online Estimation Subs.llb directory.
2.

Algorithms
Recursively parametric model estimation is generally divided into two steps. The first step is to
construct and update the state vector of a system. The second step is to optimize parameter values
by using different update methods.
The generalized model can be rewritten as
where

y(t | ) T (t, ) in a linear regression form.

T (n) is the data vector constructed from the past input-output data u(n) and y(n) .

is

the parametric vector with model parameters.


The RLS recursive schema is [11.12a, b, c, 1, page 365, Ref 1]
^

(t 1) L(t ) (t )
^

(t ) y(t ) y(t )
L(t )

P(t 1) (t )
(t ) (t )T P(t 1) (t )

1
P(t 1) (t ) (t )T P(t 1)
P(t )
P(t 1)
(t )
(t ) (t )T P(t 1) (t )
t

If you select

R(t ) (k ) T (k )

[10.40, 1, page 328, Ref 1], (k ) is a gradient vector [9.6,

k 1

page 281, Ref 1], and the recursive schema changes into
^

(t 1) L(t ) (t )
^

(t ) y(t ) y(t )
L(t )

P(t 1) (t )
(t ) (t )T P(t 1) (t )

P(t )

1
P(t 1) (t ) (t )T P(t 1)
P
(
t

1)

(t )
(t ) (t )T P(t 1) (t )

For different model structures, you need to compute different gradient vector (k )

si_Recursive ARMAX Model (SISO).vi


This VI is the core VI to recursively estimate the response of ARMAX (SISO) model based on the
input stimulus. The ARMAX (SISO) model is described as

A(q) y(n) B(q)u(n k ) C(q)e(n)

National Instruments Corporation

51

System Identification Toolkit

Algorithm References

where A(q) 1

Na

a q
i 1

Nb

B(q) bj q

, C(q) 1

j 0

Nc

c q
i 1

and q is the shift operator,

which means

q i y(n) y(n i) .
k is the delay of the system.
The general ARMAX (SISO) can be reform as the following linear regressions structure

y(n) T (n)
where

T (n) is the data vector constructed from the past input-output data u(n) and y(n) :

(n) [ y(n 1),..., y(n Na ), u(n k ),..., u(n k N1,b ), (n 1),..., (n Nc )]T .

is the parametric vector with model parameters:

[a1,..., aNa , b0 ,..., bNb , c1,..., cNc ]T

Algorithm Reference
^

(t, ) is the gradient vector of y(t ) as

(t, ) [

^
^
^
^
^
^
y(t ),..,
y(t ),
y(t ),...,
y(t ),
y(t )
y(t )]
a1
aNa
b0
bNb
c1
cNc

where

C(q)

^
y(t ) qi y(t ), i 1,..., Na
ai

C(q)

^
y(t ) qiu(t ), i 0,..., Nb
bi

C(q)

^
y(t ) qi (t ), i 0,..., Nc
ci

According to the definition of regression vector (t , ) , you can have

C(q) (t, ai ) (t, ai ) , (t k, ai ) (t, aik )


That is

(t, ai ) (t, ai ) c1 (t 1, ai ),,, cN (t Nc , ai )


(t, ai ) c1 (t, ai 1 ),,, cN (t, ai N )
c

C(q) (t, bi ) (t, bi ) , (t k, bi ) (t, bik )


That is

(t, bi ) (t, bi ) c1 (t 1, bi ),,, cN (t Nc , bi )


(t, bi ) c1 (t, bi 1 ),,, cN (t, bi N )
c

System Identification Toolkit

52

ni.com

Algorithm References

C(q) (t, ci ) (t, ci ) , (t k, ci ) (t, cik )


That is

(t, ci ) (t, ci ) c1 (t 1, ci ),,, cN (t Nc , ci )


(t, ci ) c1 (t, ci 1 ),,, cN (t, ci N )
c

si_Recursive OE Model (SISO).vi


This VI is the core VI to recursively estimate the response of OE (SISO) model based on the input
stimulus. An OE (SISO) model is described as

y(n)
where

B(q)
u(n k ) e(n)
F (q)

Nb

Nf

j 0

i 1

B(q) bj q j , F (q) 1 fi qi and q is the shift operator, which means


q i y(n) y(n i) .

k is the delay of the system.


The general OE(SISO) can be reform as the following linear regressions structure:

y(n) T (n)
where

T (n) is the data vector constructed from the past input-output data u(n) and y(n) :

(n) [u(n k ),..., u(n k Nb )1(n 1), w(n 1),..., w(n N f )]T
where

w(t ) f1w(t 1) f2 w(t 2) ... f N f w(t N f )


b0u(t k ) b1u(t k 1) ... b Nb u(t k Nb )

is the parametric vector with model parameters:

[b0 ,..., bNb , f1,..., f N f ]T

Algorithm Reference
^

(t, ) is the gradient vector of y(t ) defined as

(t, ) [

^
^
^
^
y(t ),...,
y(t ), y(t ),...,
y(t )]
b0
bNb
f1
f N f

where

F (q)

^
y(t ) qiu(t ), i 0,..., Nb
bi

National Instruments Corporation

53

System Identification Toolkit

Algorithm References

F (q)

^
y(t ) qi w(t ), i 1,..., N f
fi

According to the definition of regression vector (t , ) , you can have

F (q) (t, bi ) (t, bi ) , (t k, bi ) (t, bik )


That is

(t, ai ) (t, bi ) f1 (t 1, bi ),,, f N (t N f , bi )


f

(t, bi ) f1 (t, bi 1 ),,, f N f (t, bi N f )


F (q) (t, fi ) (t, fi ) , (t k, fi ) (t, fi k )
That is

(t, fi ) (t, fi ) f1 (t 1, fi ),,, f N (t N f , fi )


f

(t, fi ) f1 (t, fi 1 ),,, f N f (t, fi N f )


si_Recursive BJ Model (SISO).vi
This VI is the core VI to recursively estimate the response of BJ (SISO) model based on the input
stimulus. A BJ (SISO) model is described as

y(n)

B(q)
C(q)
u(n k )
e(n)
F (q)
D(q)

where
Nb

Nf

Nc

Nd

j 0

i 1

i 1

i 1

B(q) bj q j , F (q) 1 fi qi , C(q) 1 ci qi , D(q) 1 di qi and

q is

the shift operator, which means

q i y(n) y(n i) .
k is the delay of the system.
The general OE(SISO) can be reformed as the following linear regressions structure:

y(n) T (n)
where

T (n) is the data vector constructed from the past input-output data u(n) and y(n) :

(n) [u(n k ),..., u(n k Nb )1(n 1), w(n 1),..., w(n N f ),


(n 1),..., (n Nc ), v(n 1),..., v(t Nd )]T
where

w(t ) f1w(t 1) f2 w(t 2) ... f N f w(t N f )


b0u(t k ) b1u(t k 1) ... b Nb u(t k Nb )

System Identification Toolkit

54

ni.com

Algorithm References

v(t ) d1v(t 1) d2v(t 1) ... dnd v(t Nd )


e(t ) c1e(t ) c2e(t 2) ... cnc e(t Nc )

is the parametric vector with model parameters:

[b0 ,..., bNb , f1,..., f N f , c1,..., cNc , d1,..., dNd ]T


Algorithm Reference
^

(t, ) is the gradient vector of y(t ) defined as:

(t, ) [

^
^
^
^
^
^
^
^
y(t ),...,
y(t ), y(t ),...,
y(t ),
y(t ),...,
y(t ),
y(t ),...,
y(t )]
b0
bNb
f1
f N f
c1
cNc
d1
dNd

where

C(q)F (q)

^
y(t ) D(q)qiu(t ), i 0,..., Nb
bi

C(q)F (q)

^
y(t ) D(q)qi w(t ), i 1,..., N f
fi

C(q)

^
y(t ) qi (t ), i 1,..., Nc
ci

C(q)

^
y(t ) qi v(t ), i 0,..., Nd
di

According to the definition of regression vector

(t, ) , you can have

C(q)F (q) (t, bi ) D(q)(t, bi ) , (t k, bi ) (t, bik ) ,


If you define C(q) F (q) G(q) , that is

(t, bi ) (t, bi ) d1 (t 1, bi ),..., d N (t Nd , bi ) g1 (t 1, bi ),,, g N (t N g , bi )


d

(t, bi ) d1 (t, bi 1 ),..., d Nd (t, bi Nd ) g1 (t, bi 1 ),,, g Ng (t, bi Ng )


C(q)F (q) (t, fi ) D(q)(t, fi ) , (t k, fi ) (t, fi k )
If you define C(q) F (q) G(q) , that is

(t, fi ) (t, fi ) d1 (t 1, fi ),..., d N (t Nd , fi ) g1 (t 1, fi ),,, g N (t N g , fi )


d

(t, fi ) d1 (t, fi 1 ),..., d Nd (t, fi Nd ) g1 (t, fi 1 ),,, g Ng (t, fi Ng )


C(q) (t, ci ) (t, ci ) , (t k, ci ) (t, cik )
That is

(t, ci ) (t, ci ) c1 (t 1, ci ),,, cN (t Nc , ci )


(t, ci ) c1 (t, ci 1 ),,, cN (t, ci N )
c

National Instruments Corporation

55

System Identification Toolkit

Algorithm References

C(q) (t, di ) (t, di ) , (t k, di ) (t, dik )


That is

(t, di ) (t, di ) c1 (t 1, di ),,, cN (t Nc , di )


(t, di ) c1 (t, di 1 ),,, cN (t, di N )
c

si_Recursive GL Model (MISO).vi


This VI is the core VI to recursively estimate the response of general linear (SISO) model based on
the input stimulus. A BJ (SISO) model is described as
nu

A(q) y(n)
i 1

Bi (q)
C(q)
ui (n k )
e(n)
Fi (q)
D(q)
Na

A(q) 1 ai q i

where

i 1

Bi (q)

Ni ,b 1

i, j

j 0

, C(q) 1

Nc

c q
i 1

, D(q) 1

Nd

d q
i 1

Ni , f

F (q) 1 fi, j q j and


j 1

q is the shift operator, which means

q i y(n) y(n i) .
k is the delay of the system.

Na , Ni,b , Nc , Nd , Ni, f are A order, B orders, C order, D order and F

orders of the general linear model.


The general linear model can be reformed into the following linear regressions structure:

y(n) T (n)
where

T (n) is the data vector constructed from the past input-output data u(n) and y(n) :

(n) [ y(n 1),..., y(n Na ),


u1 (n k ),..., u1 (n k N1,b ),..., unu (n k ),..., unu (n k Nnu ,b ),
w1 (n 1),..., w1 (n N1, f ),..., wnu (n 1),..., wnu (n Nnu , f ),

(n 1),..., (n Nc ), v(n 1),..., v(t Nd )]T


where

wi (t ) fi ,1wi (t 1) fi ,2 wi (t 1) ... fi ,n f 1 wi (t Ni , f )
bi,1ui (t ki ) bi,2ui (t ki 1) ... bi,nb1 ui (t ki Ni,b 1)

v(t ) d1v(t 1) d2v(t 1) ... dnd v(t Nd )


e(t ) c1e(t ) c2e(t 2) ... cnc e(t Nc )

System Identification Toolkit

56

ni.com

Algorithm References

is the parametric vector with model parameters:

[a1,..., aNa , b1,0 ,..., b1, N1,b ,..., bnu ,0 ,..., bnu , Nnu ,b , f1,1,..., f1, N1, f ,..., fnu ,1,..., fnu , Nnu , f , c1,..., cNc , d1 ,..., dNd ]T
Algorithm Reference
^

(t, ) is the gradient vector of y(t ) as:

(t, ) [

^
^
y(t ),...,
y(t ),
a1
aNa

^
^
^
^

y(t ),...,
y(t ),...,
y(t ),...,
y(t ),
b1,0
b1, Nb
bnu ,0
bnu , Nnu ,b
^
^
^
^

y(t ),...,
y(t ),...,
y(t ),...,
y(t ),
f1,1
f1, N f
fnu ,1
fnu , Nnu , f

^
^
^
^
y(t ),...,
y(t ),
y(t ),...,
y(t )]
c1
cNc
d1
d Nd
where

C(q)

^
y(t ) D(q)qi y(t ), i 0,..., Na
ai

C(q)F (q)

^
y(t ) D(q)q jui (t ), i 1,..., nu , j 0,..., Ni,b
bi, j

C(q)F (q)

^
y(t ) D(q)q j wi (t ), i 1,..., nu , j 1,..., Ni, f
fi, j

C(q)

^
y(t ) qi (t ), i 1,..., Nc
ci

C(q)

^
y(t ) qi v(t ), i 1,..., Nd
di

According to the definition of regression vector (t , ) , you can have

C(q)F (q) (t, ak ) D(q)(t, ak ) , (t k, ai ) (t, aik ) .If defines


C(q)F (q) G(q)
That is

(t, ai ) (t, ai ) d1(t 1, ai ),..., d N (t Nd , ai ) g1 (t 1, ai ),,, g N (t N g , ai )


d

(t, ai ) d1 (t, ai 1 ),..., d Nd (t, ai Nd ) g1 (t, ai 1 ),,, g Ng (t, ai Ng )

National Instruments Corporation

57

System Identification Toolkit

Algorithm References

C(q)Fi (q) (t, bi, j ) D(q)(t, bi, j ) , (t k, bi, j ) (t, bi, j k ) .If defines
C(q)Fi (q) Gi (q)
That is

(t, bi, j ) (t, bi , j ) d1 (t 1, bi , j ),..., d N (t Nd , bi , j ) gi ,1 (t 1, bi , j ),,, gi ,N (t N g , bi , j )


d

(t, bi, j ) d1 (t, bi, j 1 ),..., d Nd (t, bi, j Nd ) gi ,1 (t , bi , j 1 ),,, gi , Ng (t, bi , j Ng )

C(q)Fi (q) (t, fi, j ) D(q)(t, fi, j ) , (t k, bi, j ) (t, bi, j k ) . If defines
C(q)Fi (q) Gi (q)
That is

(t, fi, j ) (t, fi, j ) d1 (t 1, fi, j ),..., d N (t Nd , fi , j ) gn,1 (t 1, fi , j ),,, gn, N (t N g , fi , j )


d

(t, fi , j ) d1 (t, fi , j 1 ),..., dNd (t, fi , j Nd ) gn,1 (t , fi , j 1 ),,, gn, Ng (t, fi , j Ng )

C(q) (t, ci ) (t, ci ) , (t k, ci ) (t, cik )


That is

(t, ci ) (t, ci ) c1 (t 1, ci ),,, cN (t Nc , ci )


(t, ci ) c1 (t, ci 1 ),,, cN (t, ci N )
c

C(q) (t, di ) (t, di ) , (t k, di ) (t, dik )


That is

(t, di ) (t, di ) c1 (t 1, di ),,, cN (t Nc , di )


(t, di ) c1 (t, di 1 ),,, cN (t, di N )
c

3.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

SI Model Simulation VIs


1.

Introduction
This section includes the algorithms and references used by the si_GL Model Sim (MISO).vi,
si_Std Response To Model.vi, si_ARX Model Sim (MIMO).vi, si_State-Space (MIMO) core.vi
and si_Transfer Function Sim Core.vi, which are the core VIs to simulate defined models in SI
toolkit. These VIs are located in the labview\vi.lib\addons\System Identification\Model Analysis
Subs.llb directory.

System Identification Toolkit

58

ni.com

Algorithm References

2. Algorithms
The following are the algorithms for the SI Model Simulation VIs.

si_GL Model Sim (MISO).vi


This VI is the core VI to simulate general linear (MISO) model based on the input stimulus. The
general linear (MISO) model is described as
nu

A(q) y(n)
i 1

Bi (q)
C(q)
ui (n k )
e(n)
Fi (q)
D(q)
Na

A(q) 1 ai q i

where

i 1

Bi (q)

Ni ,b 1

Nc

Nd

Ni , f

j 0

i 1

i 1

j 1

bi, j q j , C(q) 1 ci qi , D(q) 1 di qi F (q) 1 fi, j q j and

q is the shift operator, which means

q i y(n) y(n i) .
k is the delay of the system.

Na , Ni,b , Nc , Nd , Ni, f are A order, B orders, C order, D order and F

orders of the general linear model.


The general linear model can be reformed into the following linear regressions structure:

y(n) T (n)
where

T (n) is the data vector constructed from the past input-output data u(n) and y(n) :

(n) [ y(n 1),..., y(n Na ),


u1 (n k ),..., u1 (n k N1,b ),..., unu (n k ),..., unu (n k Nnu ,b ),
w1 (n 1),..., w1 (n N1, f ),..., wnu (n 1),..., wnu (n Nnu , f ),

(n 1),..., (n Nc ), v(n 1),..., v(t Nd )]T


where

wi (t ) fi ,1wi (t 1) fi ,2 wi (t 1) ... fi ,n f 1 wi (t Ni , f )
bi,1ui (t ki ) bi,2ui (t ki 1) ... bi,nb1 ui (t ki Ni,b 1)

v(t ) d1v(t 1) d2v(t 1) ... dnd v(t Nd )


e(t ) c1e(t ) c2e(t 2) ... cnc e(t Nc )

is the parametric vector with model parameters:

[a1,..., aNa , b1,0 ,..., b1, N1,b ,..., bnu ,0 ,..., bnu , Nnu ,b , f1,1,..., f1, N1, f ,..., fnu ,1,..., fnu , Nnu , f , c1,..., cNc , d1 ,..., dNd ]T
Algorithm Reference

National Instruments Corporation

59

System Identification Toolkit

Algorithm References

The simulation of general linear model is to compute response

y(n) with stimulus u(t ) and noise

e(t ) as inputs. The standard deviation of response is also to be computed.


Response computation
From the definition of general linear model, the response

y(n) can be computed using the

following steps:
1) IIR filtering stimulus
coefficients of

F (q) being backward coefficients.

2) IIR filtering noise

D(q)

u(t ) with coefficients of B(q) being forward coefficients and

e(t ) with coefficients of C(q) being forward coefficients and coefficients of

being backward coefficients.

3) Summarizing the results of filtered stimulus

u(n) and filtered noise e(n) .

4) Filtering the summed result with coefficients of

A(q) being backward coefficients and 1 being

forward coefficients.
Note: the noise

e(n) must be rescaled by the inputted noise variance.

Standard deviation of response computation


The Standard deviation of response computation s implemented in the si_Std Response to
Model.vi
Lemma: let the
be P . If
close to

d -dimension vector

be an estimate with mean

0 , and its covariance matrix


^

f (0 ) is the p -dimensional random variable, asymptotically as

0 , you can have

becomes sufficiently

f (0) with good accuracy, defined as


^

f ( ) f (0 ) f ' (0 )( 0 )
where

f ' is the p d derivative matrix of f


^

with respect to
^

. This means

Covf ( ) E( f ( ) Ef ( ))( f ( ) Ef ( ))T f ' (0 )Pf ' (0 )T


The above equation is known as the Gauss approximation formula. [page 292, 9-56, Ref 1]
You therefore can define simulated response function to model parameters as

f (n, ) y(n, )
The covariance matrix of simulated response can be obtained according to the lemma:

Covy(n, ) y' (0 )P y' (0 )T

System Identification Toolkit

60

ni.com

Algorithm References

P is the covariance matrix of model parameter vector . Thus, you need to compute the
derivative matrix of

y' (n, ) .

Matrix y (n, ) computation


'

1 j
y(n)
q y(n) q j ya (n), j 1,..., Na
a j
A(q)

1
y(n)
q jui (n k ) q jubi (n k ), j 0,..., Ni,b
b(i, j )
A(q)Fi (q)
Bi (q)

y(n)
q jui (n k ) q ju fi (n k ), j 1,..., Ni, f
f(i, j )
A(q)Fi (q)Fi (q)

1
y(n)
q j e(n) q j ec (n), j 0,..., Nc
c j
A(q)D(q)

C(q)
y(n)
q j e(n) q j e f (n), j 0,..., Nd
d j
A(q)D(q)D(q)
ya (n) can be obtained by IIR filtering y(n) with -1 being forward coefficients and coefficient of

A(q) being backward coefficients.

ubi (n) can be obtained by IIR filtering ui (n) with 1 being forward coefficients and coefficient of
A(q)Fi (q) being backward coefficients.

u f i (n) can be obtained by IIR filtering ui (n) with Bi (q)


coefficient of

being forward coefficients and

A(q)Fi (q)Fi (q) being backward coefficients.

ec (n) can be obtained by IIR filtering e(n) with 1 being forward coefficients and coefficient of
A(q)D(q) being backward coefficients.

e f (n) can be obtained by IIR filtering e(n) with C(q)


coefficient of

being forward coefficients and

A(q)D(q)D(q) being backward coefficients.

Define the Vector

National Instruments Corporation

61

System Identification Toolkit

Algorithm References

yvec' (n, ) [q1 ya (n),..., q Na ya (n), ub1 (n k ),..., q N1,b ub1 (n k ),..., ubnu (n k ),..., q
q1u f 1 (n),..., q

N1, f

u f 1 (n),..., q1u f nu (n),..., q

q1ec (n),..., q Nc ec (n), q1e f (n),..., q

N f

Nnu , f

Nnu ,b

ubnu (n k ),...,

u f nu (n),

e f (n)]

[ ya (n 1),..., ya (n Na ), ub1 (n k ),..., ub1 (n k N1,b ),..., ubnu (n k ),..., ubnu (n k Nnu ,b ),...,
u f 1 (n k 1),..., u f 1 (n k N1, f ),..., u f nu (n k 1),..., u f nu (n k Nnu , f ),
ec (n 1),..., ec (n Nc ), e f (n 1),..., e f (n N f )]
The derivative matrix therefore is defined as

yvec' (1, )

y' (t, )

yvec' ( N , )

The covariance matrix of simulated response

Covy(t, )

can be obtained using the Gauss

approximation formula.
The diagonal values of

Covy(t, ) is the variances of simulated response points. The standard

deviation is the square root of the variance.


si_ARX Model Sim (MIMO).vi
This VI is the core VI to compute response of ARX (MIMO) model based on the input stimulus.
The ARX model is described by the backward shift operator

q 1

as:

A(q) y(t ) B(q)u(t k ) e(t )


where

u(t )

and

y(t )

are the inputs and outputs of the system, respectively. k is the delay of the

input. e(t) is the disturbance of the system.


The time domain equation of an ARX (MIMO) model is described as
a
y1 (t ) a111y1 (t 1) a112y1 (t 2) ... a11n11a y1 (t n11
)
a
a121y2 (t 1) a122y2 (t 2) ... a12n12a y2 (t n12
)

...
a1N y 1 yN y (t 1) a1N y 2 yN y (t 2) ... a1N y n1aN yN y (t n1aN y )
y

b
b111u1 (t k11) b112u1 (t k11 1) ... b11n11b u1 (t k11 n11
1)
b
b121u2 (t k12) b122u2 (t k12 1) ... b12n12b u2 (t k12 n12
1)

...
b1Nu 1uNu (t k1Nu ) b1Nu 2uNu (t k1Nu 1) ... b1Nu n1bN uNu (t k1Nu n1bNu 1)
u

e1 (t )

System Identification Toolkit

62

ni.com

Algorithm References

a
y2 (t ) a221y2 (t 1) a222y2 (t 2) ... a22n22a y2 (t n22
)
a
a211y1 (t 1) a212y1 (t 2) ... a21n21a y1 (t n21
)

...
a2 N y 1 yN y (t 1) a2 N y 2 yN y (t 2) ... a2 N y n2aN yN y (t n2aN y )
y

b
b211u1 (t k21) b212u1 (t k21 1) ... b21n21b u1 (t k21 n21
1)
b
b221u2 (t k22) b222u2 (t k22 1) ... b22n12b u2 (t k22 n22
1)

...
b2 Nu 1uNu (t k2 Nu ) b2 Nu 2uNu (t k2 Nu 1) ... b2 Nu n2b N uNu (t k2 Nu n2bNu 1)
u

e2 (t )

yN y (t ) aN y N y 1 yN y (t 1) aN y N y 2 yN y (t 2) ... aN y N y nNa N yN y (t nNa y N y )


y y

aN y 11y1 (t 1) aN y 12 y1 (t 2) ... aN y 1nNa 1 y1 (t nNa y 1 )


y

...
aN y ( N y 1)1 y( N y 1) (t 1) aN y ( N y 1) 2 y( N y 1) (t 2) ... aN y ( N y 1) nNa

y ( N y 1)

y( N y 1) (t nNa y ( N y 1) )

bN y 11u1 (t kN y 1 ) bN y 12u1 (t kN y 1 1) ... bN y 1n21b u1 (t kN y 1 nNb y 1 1)


bN y 21u2 (t kN y 2 ) bN y 22u2 (t kN y 2 1) ... bN y 2n12b u2 (t kN y 2 nNb y 2 1)
...
bN y Nu 1uNu (t kN y Nu ) bN y Nu 2uNu (t kN y Nu 1) ... bN y Nu n2b N uNu (t kN y Nu nNb y Nu 1)
u

eN y (t )
From the model definition, the response of

u1(t),..., uNu (t ) and noise e1 (t ),..., eNy (t )

y1 (t ),..., yN y (t ) , coefficients of the model, stimulus


form a recursive relationship. The response of the

model is computed in the point-by-point style in this VI.

si_State-Space (MIMO) core.vi


This VI is the core VI to compute response of state-space (MIMO) model based on the input
stimulus. A state-space (MIMO) model is described as

X (t 1) AX (t ) BU (t ) KE(t )
,
Y (t ) CX (t ) DU (t ) E(t )
where

U (t )

and

Y (t )

are the inputs and outputs of the system, respectively.

X (t ) is the state

variables.

National Instruments Corporation

63

System Identification Toolkit

Algorithm References

For MIMO System

u1 (t )
u (t )
2
, t 1, 2,..., N , n is the number of inputs, N is the
U (t ) is input vector. U (t )
u

unu (t )
sample number.

y1 (t )
y (t )
2
, t 1, 2,..., N , n is the number of outputs, N is the
Y (t ) is output vector. Y (t )
y

yny (t )
sample number.

E(t ) is noise disturbance vector.

X (t ) is state vector.

e1 (t )
e (t )
2
, t 1,2,..., N
E(t )

eny (t )

x1 (t )
x (t )
2
, t 1, 2,..., N , n is the number of states
X (t )
x

xnx (t )

A is nx nx state transmission matrix. B is nx nu input gain matrix. C is ny nx output gain


matrix.

D is ny nu direct-input gain matrix. K is nx ny noise gain matrix.

From the model definition, the response of

Y (t ) , states X (t ) , stimulus U (t ) and noise

E(t ) form a recursive relationship. The response of the model is computed in the point-by-point
style in this VI.
si_Transfer Function Sim Core.vi
This VI is the core VI to compute response of a transfer function (MIMO) model based on the
input stimulus. The transfer function (MIMO) model is described as

Y (t ) G( z)U (t )
G( z) is polynomial fraction matrix, defined as

g11 ( z) g1nx ( z)

G( z)


g ( z) g ( z)
ny nx
ny 1

Where

System Identification Toolkit

64

ni.com

Algorithm References

gij (z) is polynomial fraction in delay operator z1 :


gij ( z)

n z n n1z n1 ... 1z1 0


m z m m1z m1 ... 1z1 0

i indicates ith output in MIMO system.

j indicates jth

input in MIMO system.

u1 (t )
u (t )
2
, t 1, 2,..., N , n is the number of inputs, N is the
U (t ) is input vector. U (t )
u

unu (t )
sample number.

y1 (t )
y (t )
2
, t 1, 2,..., N , n is the number of outputs, N is the
Y (t ) is output vector. Y (t )
y

yny (t )
sample number.
From the definition of the model, the computation of multiple outputs

Y (t )

can be carried out one

output by one output.

yi (t ) gij ( z)u j (t ), i 1,.., N y , j 1,.., Nu


The computation of

gij (z)u j (t ) can be carried out by IIR filtering u j (t ) with nominator of

gij (z) being forward coefficients and denominator of gij (z) being backward coefficients.
3.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

SI Model Prediction VIs


1.

Introduction
This section includes the algorithms and references used by the si_GL Model Predict (MISO).vi,
si_SS Model predict vi, and si_SS State Response.vi, which are the core VIs to predict the
response of defined models in SI toolkit. These VIs are located in the
labview\vi.lib\addons\System Identification\Model Analysis Subs.llb directory.

2.

Algorithms
The following are the algorithms for the SI Model Prediction VIs.

National Instruments Corporation

65

System Identification Toolkit

Algorithm References

si_GL Model Predict (MISO).vi


This VI is the core VI to predict the response of general linear (MISO) model based on the input
stimulus. A generalized system model is defined as

y(t ) G(q)u(t ) H (q)e(t )


K-Step Prediction
The k-step-ahead prediction of

y(t ) is deduced as [3.31, page 71, Ref 1]

y(t | t k ) Wk (q)G(q)u(t ) [1Wk (q)]y(t )


where

Wk (q) H k (q)H 1 (q) . [3.27, page 70, Ref 1]

A general linear (MISO) model is described as


nu

A(q) y(t )
i 1

Bi (q)
C(q)
ui (t k )
e(t )
Fi (q)
D(q)

where
Na

A(q) 1 ai q i

Bi (q)

i 1

Ni ,b 1

bi, j q j

Nc

j 0

C(q) 1 ci qi
i 1

Nd

D(q) 1 di qi
i 1

Ni , f

F (q) 1 fi, j q j and q is the shift operator, which means:


j 1

q i y(n) y(n i) .
k is the delay of the system.

Na , Ni,b , Nc , Nd , Ni, f are A order, B orders, C order, D order and F

orders of the general linear model.

Algorithm Reference
According to the definition of the k-step-ahead prediction of

y(t ) and general linear model

(MISO), you can have

Gi (q)

Bi (q)
C(q)
, i 1,..., Nu , H (q)
A(q)Fi (q)
A(q)D(q)

The k-step-ahead prediction of

y(t ) can be reformed as

C(q)
F (q)D(q)
y(t | t k )
u (t )
F (q)C(q) F (q)
^

nu

i 1

System Identification Toolkit

H k (q)Bi (q)

j 1,..,nu

j 1,..,nu

j 1,..,nu

66

Fi (q) H k (q) A(q)D(q)


C(q)

j 1,..,nu

F (q)

j 1,..,nu

Fi (q)

ni.com

y(t )

Algorithm References

F (q)
(q)
g (q ), n 1,..., k
A(q) D(q) F (q)
C(q)

H k (q) can be computed by H k

j 1,..,nu

j 1,..,nu

g (qn ), n 1,..., k can be calculated by using the impulse response of

an IIR filter.

F ( q)
with coefficients of C(q) F (q) being forward coefficients and
A(q) D(q) F (q)
C ( q)

j 1,..,nu

j 1,..,nu

A(q)D(q)

j 1,..,nu

F (q) being backward coefficients.

j 1,..,nu

So the k-step-ahead prediction of

H k (q)Bi (q)

Fi (q)C(q)
C(q)

being forward coefficients and coefficients of

F (q)

j 1,..,nu

y(t ) can be computed by IIR filtering ui (t ) with coefficients of

Fj (q)D(q)

j 1,..,nu

j 1,..,nu

of

being backward coefficients, and by IIR filtering

Fi (q) H k (q) A(q)D(q)

C(q)

F (q)

j 1,..,nu

coefficients of

j 1,..,nu

y(t ) with coefficients

Fi (q)
being forward coefficients and

being backward coefficients.

si_SS Model Predict.vi


This VI is the core VI to predict the response of state-space (MIMO) model based on the input
stimulus. A state-space (MIMO) model is described as

X (t 1) AX (t ) BU (t ) KE(t )
,
Y (t ) CX (t ) DU (t ) E(t )
where

U (t )

and

Y (t )

are the inputs and outputs of the system, respectively.

X (t ) is the state

variables.

For MIMO System

u1 (t )
u (t )
2
, t 1, 2,..., N , n is the number of inputs, N is the
U (t ) is the input vector. U (t )
u

unu (t )
sample number.

National Instruments Corporation

67

System Identification Toolkit

Algorithm References

y1 (t )
y (t )
2
, t 1, 2,..., N , n is the number of outputs, N is
Y (t ) is the output vector. Y (t )
y

yny (t )
the sample number.

E(t ) is the noise disturbance vector.

X (t ) is the state vector.

e1 (t )
e (t )
2
, t 1,2,..., N
E(t )

eny (t )

x1 (t )
x (t )
2
, t 1, 2,..., N , n is the number of states
X (t )
x

xnx (t )

A is nx nx state transmission matrix. B is nx nu input gain matrix. C is ny nx output gain


matrix.

D is ny nu direct-input gain matrix. K is nx ny noise gain matrix.

From the model definition, the response of

Y (t ) , states X (t ) , stimulus U (t ) and noise

E(t ) form a recursive relationship. The response of the model is computed in the point-by-point
style in this VI.

Algorithm Reference

One-step Prediction
The conditional expectation of
^

y(t ) is the Gaussian process, given by [4.86, page 98, Ref 1]

X (t 1) A X (t ) BU (t ) K[Y (t ) C X (t ) DU (t )]
^

Y (t ) C X (t ) DU (t )
This can be reformed as
^
^
U (t )
X (t 1) [ A KC] X (t ) [ B KD, K ][
]
Y (t )
^

Y (t ) C X (t ) DU (t )
From

U (t ), Y (t ) , the one-step prediction of Y (t ) can be deduced from the above equation.

K-Step Prediction [10.99, page 345, Ref 1]

System Identification Toolkit

68

ni.com

Algorithm References

The K-step prediction is also to find the formula between the predicted

Y (t ) and

U (t ), Y (t ) as the one-step prediction. In the calculation of Y (t ) , the formula only uses


outputs Y (t ) up to time t k .
From the state-space model equation, you can find

Y (t k ) CX (t k ) DU (t k ) E(t k )
CAX (t k 1) CBU (t k 1) CBKE(t k 1)
DU (t k ) E(t k )
...
CAk X (t ) CAk 1BU (t ) CAk 2 BU (t 1) ...
CBU (t k 1) DU (t k )
CAk 1KE(t ) CAk 2 KE(t 1) ...
CKE(t k 1) E(t k )
The state space model can be rewritten as the matrix multiplications, as shown by the
following equation:

Y (t k ) CAk X [CAk 1B, CAk 2 B,..., D][U (t ),U (t 1),...,U (t k )]T V


where

V is the noise influence matrix.

By discarding the noise influence matrix

V , the vector Y of k-step predictor is defined as

Y (t k ) CAk X (t ) [CAk 1B, CAk 2 B,..., D][U (t ),U (t 1),...,U (t k )]T


The formula can be reformed as

Y^ (1)
T
X (1 k )
U (1 k ),U (1 k 1),...,U (1)

X (2 k )

^ ^
[CAk 1B, CAk 2 B,..., D] U (2 k ),U (2 k 1),...,U (2)
Y (1) Y (t k ) CAk

X ( N k )
U ( N k ),U ( N k 1),...,U ( N )
Y ( N )

U (1 k ),U (1 k 1),...,U (1)


U (2 k ),U (2 k 1),...,U (2)
k 1
k 2

[CA B, CA B,..., D]

U ( N k ),U ( N k 1),...,U ( N )

filtering

can be computed by FIR

[U (1),U (2),...,U ( N )] with coefficients of [CAk 1B, CAk 2 B,..., D] .

si_SS State Response.vi


This VI is a subVI to compute state response of a state-space (MIMO) model based on the input
stimulus.
National Instruments Corporation

69

System Identification Toolkit

Algorithm References

The formula of state response is defined as

X (t 1) AX (t ) BU (t )
X (t ) can be computed by a recursive process.
3.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Residual Analysis.vi
1.

Introduction
This section includes algorithms and references used by the si_Residual Analysis.vi, which is the
core VI to calculate the autocorrelation of prediction error and cross-correlation between
prediction error and stimulus signal. The si_Residual Analysis.vi is located in the
labview\vi.lib\addons\System Identification\Model Analysis Subs.llb directory.

2.

Function Description
You can use this VI to calculate the autocorrelation of prediction error and cross-correlation
among the prediction error, stimulus signal, and their confidence interval.

3.

APIs
Para Name
prediction

In/Out

Type

Description

In

1D CDB Array

Prediction error

input signal u

In

2D DBL Array

Input signal

cov(e)

Out

1D CDB Array

Normalized auto-correlation function of the

error

prediction errors
confidence of

Out

DBL

Confidence of

Out

2D DBL Array

Normalized cross-correlation function of the

cov(e)

cov(e)
cov(u, e)

prediction errors and input signal


confidence of

Out

1D CDB Array

Confidence of

cov(u, e)

cov(u, e)

4.

Algorithms [Page 511-513, Ref.1]

cove ( )
The auto-correlation of prediction error is defined as

ReN ( )

System Identification Toolkit

1 N
e(t)e(t )
N t 1

70

(1)

ni.com

Algorithm References

where N is the signal length. The normalized auto-correlation of prediction error is

cove ( )
where

cove ( )

N ReN ( ) is a zero mean Gaussian distribution with variance 2 [P.512, Ref 1],

ReN ( ) , is a zero mean Gaussian distribution

the auto-correlation of prediction error,


with variance

2 / N .

So the confidence interval of the

Na
where

(2)

1 N 2
e (t) ReN (0) , which is the variance of the prediction error.
N t 1

Confidence of
Since

ReN ( )

denotes the

ReN ( )

is

(3)

level of the normalized Gaussian distribution , N (0,1) , and

0.99% in this problem. Then the confidence interval of cove ( )


Na

is

1
N

(4)

coveu ( )
The cross-correlation between the prediction error, e(t), and the input signal, u(t), is
defined as

ReuN ( )

1 N
e(t)u(t )
N t 1

(5)

where N is the signal length. The normalized cross-correlation of prediction error is

coveu ( )

N
e

N
u

R (0)R (0)

Confidence of
Since

ReuN ( )

(6)

coveu ( )

N ReuN ( ) is a zero mean Gaussian distribution with variance P1 [Eq. (16.64),

P.513, Ref 1], where

P1

k N

The auto-correlation of prediction error,


with variance

P1 / N .

(k ) RuN (k )

And then the confidence interval of

(7)

ReuN ( ) , is a zero mean Gaussian distribution

So the confidence interval of

Na

National Instruments Corporation

N
e

P1
N

ReuN ( ) is
(8)

coveu ( )
71

is
System Identification Toolkit

Algorithm References

1
ReN (0)RuN (0)
5.

Na

P1
N

(9)

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Convert to Transfer Function Model.vi


1.

Introduction
This section includes the algorithms and references used by the si_Convert to Transfer Function
Model.vi, which is the core VI to convert defined models into transfer function models. The
si_Convert to Transfer Function Model.vi is located in the labview\vi.lib\addons\System
Identification\Model Conversion Subs.llb directory.

2.

Function Description
You can use this VI to convert an AR, ARX (SISO, MISO, and MIMO), ARMAX (SISO, MISO),
OE (SISO, MISO), BJ (SISO, MISO), general linear model (SISO, MISO), or state-space model
(SISO, MISO, and MIMO) into the corresponding transfer function model.

3.

APIs
Para Name
system model in

In/Out
In

Type

Description

SI object

Contains the information of the model to be


converted.

4.

realization type

In

Text ring

Determines the type of state-space realization.

tolerance

In

DBL

Determines the zero-pole cancellation.

system model out

Out

SI object

Contains the information of the model.

Algorithms
Transfer Function Model Equivalents of General Linear Models
This algorithm is used by the si_GL2TF (MISO).vi.
If the transfer function between i-th input and output of a MISO general linear model is

Bi (q)
a1q1 amqm
Gi (q)

A(q)Fi (q) 1 b1q1 bmqm


It gives equivalent transfer function model to multiply

Gi (q)

(1)

q m on the nominator and denominator of

as

Gi (q)

System Identification Toolkit

a1qm1 qm
qm b1qm1 bm

72

(2)

ni.com

Algorithm References

The transfer function between the noise and output of a MISO general linear model is

H (q)

C(q)
D(q)

(3)

Transfer Function Model Equivalents of State-Space Models [P. 651, Ref 1]


This algorithm is used by the si_SS2TF Matrix Combine.vi.
The state-space representation of a given MIMO system is

x(t 1) Ax(t ) Bu(t ) Ke(t )


y(t ) Cx(t ) Du(t ) e(t )

(4)

Performing Z transform on the state-space equations yields

( zI ) X ( z) AX ( z) BU ( z) KE( z)
Y ( z) CX ( z) DU ( z) E( z)

(5)

So

X ( z) ( zI A)1[BU ( z) KE( z)]


Then

G( z)

Y ( z)
C( zI A)1 B D
U ( z)

(6)

H ( z)

Y ( z)
C( zI A)1 K I
E( z )

(7)

Further [Ref 1]
where

C( zI A)1 B
and

det( zI A BC) det( zI A)


det( zI A)

det( zI A) is the characteristic polynomial of matrix A .

The equivalent transfer function representation for the determinant part can be presented as

G( z) C( zI A)1 B D

det( zI A BC) det( zI A)(D 1)


det( zI A)

(8)

Each column vector of


column by column of

B is for one input. Each row vector of C is for one output. By selecting
B and row by row of C , MIMO system of G( z) can be computed channel

by channel.
The equivalent transfer function representation of the noise part is

H ( z) C( zI A)1 K I

5.

det( zI A KC) det( zI A)(I 1)


det( zI A)

(9)

Reference

National Instruments Corporation

73

System Identification Toolkit

Algorithm References

[1] T. Kailath, Linear Systems, Prentice Hall, Prentice Hall, 1980.

si_Convert to State Space Model.vi


1.

Introduction
This section includes the algorithms and references used by the si_Convert to State-Space
Model.vi, which is the core VIs to convert defined models into state-space models. The si_Convert
to State-Space Model.vi is located in the labview\vi.lib\addons\System Identification\Model
Conversion Subs.llb directory.

2.

Function Description
You can use this VI is to convert an AR, ARX (SISO, MISO, and MIMO), ARMAX (SISO,
MISO), OE (SISO, MISO), BJ (SISO, MISO), general linear model (SISO, MISO), transfer
function (SISO, MISO and MIMO), or pole-zero model (SISO, MISO and MIMO) into the
equivalent state-space model.

3.

APIs
Para Name
system model in

In/Out
In

Type

Description

SI object

Contains the information of the model to be


converted.

4.

realization type

In

Text ring

Determines the type of state-space realization.

tolerance

In

DBL

Determines the zero-pole cancellation.

system model out

Out

SI object

Contains the information of the model.

Algorithms
State-Space Model Equivalents of Transfer Function Models
This algorithm is used by the si_TF2SS Realization (MIMO).vi
The transfer function representation of a given MIMO system is defined by the following
polynomial fraction matrix:

g11 (q) g1nu (q)

G(q)


g (q) g (q)
ny nu
ny 1

Where

gij (q) is the polynomial fraction in delay operator q1 .


gij ( z)

an qn an1qn1 ... a1q1 a0


bmqm bm1qm1 ... b1q1 b0

i indicates the ith

System Identification Toolkit

output in MIMO system.

74

ni.com

Algorithm References

j indicates the jth

input in MIMO system.

G( z) can be reformed as

G(q)
where

1
An qn An1qn1 ... Aq
A0
1
m
m1
1
Bmq Bm1q ... B1q B0

A0 ,..., An , B0 ,..., Bm is ny nu matrix.

The equivalent observable state-space realization of the transfer function model can be performed
as

Am1 1 0 ... 0
A
0 1 ... 0
A m2 ...

A0 0 0 ... 0

Bm1 Am1Bm
B A B
B m2 m2 m

B0 A0 Bm

C 1

D Bm

0 0

0 0

State-Space Model Equivalents of ARX Model (MIMO)


This algorithm is used by the si_ARX To SS (MIMO).vi.
According to the definition of ARX model (MIMO), an ARX model (MIMO) can be reformed as

Ey(t) + A1 y(t - 1) + ... + ANa y(t - Na ) = B0u(t - k ) + ... + BNb u(t - k - Nb ) + Ee(t )
Where

y(t ) is output vector [ y1 (t), y2 (t),..., yny (t)]T , u(t ) is input vector

[u1 (t ), u2 (t ),..., unu (t )]T , E is identity matrix, A1,..., ANa is ny ny matrix, B0 ,..., BNb is

ny nu matrix. k is the input delay.


The deterministic part of an ARX (MIMO) model can be further reformed into a transfer function
(MIMO) representation, which then can be further converted into a state-space model by
observable state-space realization.

B0q- k + ... + BNb q- k- Nb


B0q Na - k + ... + BNb q Na - k- Nb
G(q) =
=
E + A1q- 1 + ... + ANa q- Na
E Na + A1q Na - 1 + ... + ANa
For the noise part, the same conversion method is used as that of the determinant part.
5.

Reference
[1] T. Kailath, Linear Systems, Prentice Hall, Prentice Hall, 1980.

National Instruments Corporation

75

System Identification Toolkit

Algorithm References

si_Convert to Pole-Zero Model.vi


1.

Introduction
This section includes the algorithms and references used by the si_Convert to Pole-Zero Model.vi,
which is the core VI to convert defined models into pole-zero models. the si_Convert to Pole-Zero
Model.vi is located in the labview\vi.lib\addons\System Identification\Model Conversion Subs.llb
directory.

2.

Function Description
You can use this VI is to convert an AR, ARX (SISO, MISO, and MIMO), ARMAX (SISO,
MISO), OE (SISO, MISO), BJ (SISO, MISO), general linear model (SISO, MISO), state-space
model (SISO, MISO, and MIMO), or transfer function model (SISO, MISO, and MIMO) into the
equivalent pole-zero model.

3.

APIs
Para Name

In/Out

system model in

In

Type

Description

SI object

Contains the information of the model to be


converted.

4.

realization type

In

Text ring

Determines the type of state-space realization.

tolerance

In

DBL

Determines the zero-pole cancellation.

system model out

Out

SI object

Contains the information of the model.

Algorithms
This algorithm is used by the si_TF2ZP (MIMO).vi and the si_TF2ZP plus STD (MIMO).vi.
The pole-zero model representations of a given MIMO system is defined by the following
polynomial fraction matrix:

g11 (q) g1nu (q)

G(q)


g (q) g (q)
ny nu
ny 1

where

gij (q) is the polynomial fraction in delay operator q1 , represented in terms of the zeros,

poles, and the transfer function gain K , where the static gain K s can be computed from

Ks G(1) .
n1

gij (q)

K (q qi )
i 0
m1

(q q )
i 0

i indicates the ith

System Identification Toolkit

output in a MIMO system.

76

ni.com

Algorithm References

j indicates the jth

input in a MIMO system.

You then need to compute the polynomial roots of transfer function polynomials to convert a
transfer function model into a pole-zero model.
The Standard Deviation of Zeros and Poles
Refer to the si_Std Root to Polynomial.vi for more information about the implementing algorithm.
The si_Std Root to Polynomial.vi is a core VI used by the SI Poles-Zeros Plot.vi.
5.

Reference
[1] T. Kailath, Linear Systems, Prentice Hall, Prentice Hall, 1980.

si_Std Freq.vi
1.

Introduction
This section includes the algorithms and references used by the si_Std Freq.vi, which is the core
VI to estimate standard deviation of frequency response. The si_Std Freq.vi is located in the
labview\vi.lib\addons\System Identification\Model Presentation Subs.llb directory.

2.

Function Description
You can use this VI to compute the confidence region of the Bode and Nyquist plots. The
frequency response function, G(e
coefficients

) , of a system can be computed from the estimated

of a linear polynomial model, such as an AR, ARX, ARMAX, OE, BJ or GL

model. Given that the standard deviation of

3.

is known, the purpose of this VI is to compute the

, and phase, arg G e , of the frequency

G e j

standard deviation of the magnitude,


response function,

G(e j ) .

APIs
Para Name

In/Out

Type

Description

freq response

In

1D CDB Array

Frequency response

In

1D DBL Array

Complex frequency response

transfer

In

Cluster

Alpha is the numerator of the transfer function.

containing

Beta1 * Beta2 is the denominator of the transfer

Alpha, Beta 1

function. Typically, Alpha is B(q), and Beta1 and

and Beta 2.

Beta2 are A(q) and F(q), respectively.

function

G(e j )

Alpha, Beta 1

National Instruments Corporation

77

System Identification Toolkit

Algorithm References

and Beta 2 are


1D DBL Array.
covariance

In

2D DBL Array

Covariance matrix P of estimated model

matrix

coefficients N
standard

Out

deviation

Cluster

Standard deviation of frequency response

containing the
standard
deviation of the
magnitude and
phase response

4.

Algorithms
Since all the other polynomial models are converted to general-linear models when computing
frequency response, this section discusses only the computation formula for frequency response of
general-linear models.
Frequency Response of General Linear Model
The general-linear model (SISO) is defined as

A(q) y(t )

B(q)
C(q)
u(t )
e(t )
F (q)
D(q)

(1)

The frequency response between the input and output of the system is

G(e j )

B(e j )
A(e j )F (e j )

(2)

The general linear model (MISO) is defined as


N

A(q) y(t )
i 1

Bi (q)
C(q)
ui (t )
e(t )
Fi (q)
D(q)

(3)

The frequency response for i-th input and output is

Gi (e j )

Bi (e j )
A(e j )Fi (e j )

(4)

Gauss approximation formula [Page 292, 9-56, Ref 1]


Let

be an estimate of the coefficients of the polynomial model. The mean and covariance

matrix of

is

0 and P , respectively. If f (0 ) is the p -dimensional random variable,

asymptotically as

becomes sufficiently close to


^

0 , you can have

f () with good accuracy.

f ( ) f (0 ) f ' (0 )( 0 )

System Identification Toolkit

78

ni.com

Algorithm References

where

f ' is the p d derivative of f


^

with respect to
^

. This means

Covf ( ) E( f ( ) Ef ( ))( f ( ) Ef ( ))T f ' (0 )Pf ' (0 )T

(5)

The above expression is known as the Gauss approximation formula.


To solve the above function,

is the combination of the coefficients of A, B, and F.

magnitude or phase of frequency response function

G(e j ) .

f (0 )

is the

According to the Gauss

approximation formula, the covariance matrix of magnitude and phase of frequency response
function

G(e j )

are

P|G| Cov(| G(e j ) |) | G(e j ) | P | G(e j ) |T

(6)

and

PargG Cov(arg(G(e j ))) arg(G(e j )) P arg(G(e j ))T

Since

and

G(e j )

(7)

are known, you can apply Equation 6 and 7 to compute the standard

deviation of magnitude and phase of frequency response if you know the derivative of the
magnitude and phase of

G(e j )

arg(G(e j )) , you can derive

Derivative of

with respect to

. To derive

| G(e j ) |

and

G(e j ) as the following.

G(e j ) , | G(e j ) | and arg G(e j )

The derivative of

G(e j ) with respect to

with respect to

at frequency

is a vector defined as

G(e j1 ) [ G(e j1 ),
G(e j1 ),...,
G(e j1 ),

a1
a2
aNa

G(e j1 ),
G(e j1 ),...,
G(e j1 ),
b1
b2
bNb

(7)

G(e j1 ), G(e j1 ),...,


G(e j1 )]
f1
f2
f N f
where

G(e j1 ) j1 k
G(e j1 )
(e ) , k 1,2,..., Na ,
ak
A(e j1 )

G(e j1 ) j1 k
G(e j1 )
(e ) , k 1,2,..., Nb ,
bk
B(e j1 )

National Instruments Corporation

79

System Identification Toolkit

Algorithm References

G(e j1 ) j1 k
j1
G(e )
(e ) , k 1,2,..., N f .
fk
F (e j1 )
The derivative of

G(e j )

is defined as


j1
G(e )

j2

G(e )

G(e j )

....

jN
G(e )

Since

(8)

G(e j ) G(e j ) G(e j ) , the derivative of | G(e j ) |

is

j
j
j
j
(G(e )). G(e ) (G(e )). G(e )

=
(G(e j )). G(e j )
j
G(e )

1
( G(e j ) )

2* G(e j )

where

G(e j )

derivative of

is the conjugate of

arg(G(e j ))

G(e j ) .

Because

(9)

arg G(e j ) ln G(e j ) , the

is

arg G(e j ) G(e j )./ G(e j )

By computing the derivative of

| G(e j ) |

and

arg G(e j ) with Equation 9 and 10 and then

applying Equation 6 and 7, you can get the covariance matrix of

| G(e j ) |

The diagonal of the covariance matrix is the variance of the vector

5.

(10)

and

| G(e j ) |

arg G(e j ) .

and arg G(e

).

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Std Root to Polynomial.vi


1.

Introduction
This section includes the algorithms and references used by the si_Std Root to Polynomial.vi,
which is the core VI to calculate the confidence region of the roots of a polynomial. The si_Std

System Identification Toolkit

80

ni.com

Algorithm References

Root to Polynomial.vi is located in the labview\vi.lib\addons\System Identification\Math Tools.llb


directory.
2.

Function Description
You can use this VI to calculate the confidence region of the roots of a polynomial based on its
coefficients and the covariance of the coefficients.

3.

APIs
Para Name

In/Out

polynomial

Type

Description

In

1D DBL Array

The roots of a polynomial

In

2D DBL Array

A matrix containing the covariance of

coefficients
covariance

coefficients
std range

In

DBL

The factor that determines the confidence


region, which is std range * standard deviation

Roots

Out

1D CDB Array

The roots of a polynomial

circle plot data

Out

1D Array of

Each Cluster containing two 1D DBL Array,

Cluster

which represents the x-value and y-value of the


bound of a region

sta of root (special

Out

1D DBL Array

The variance of imaginary part of roots

format)

4.

Algorithms
Variance of the Transform [Page 292, 9-56, Ref 1]
Let the

d -dimension vector

be an estimate with mean

0 and its covariance matrix P . If


^

f (0 ) is the p -dimensional random variable, asymptotically as

0 , you can have

becomes sufficiently close to

f () with good accuracy.


^

f ( ) f (0 ) f ' (0 )( 0 )
where

f ' is the p d derivative of f


^

with respect to
^

. This means
^

Covf ( ) E( f ( ) Ef ( ))( f ( ) Ef ( ))T f ' (0 )Pf ' (0 )T


This expression is known as the Gauss approximation formula.
Here, you view the roots of a polynomial as the function of its coefficients. So using the
covariance of coefficients and the derivative of roots with respect to coefficients, which is
calculated by the si_Polynomial Root Derivative.vi, you can get the covariance of roots.

National Instruments Corporation

81

System Identification Toolkit

Algorithm References

Then by using the si_Variance of Real and Imaginary of Roots.vi, you can get the variance of the
real part and the imaginary part and their covariance for each root.
Set the variances you obtained as the input of the si_Confidence Region of Polynomial.vi, you can
get the confidence region of each roots.
5.

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

si_Polynomial Root Derivative.vi


1.

Introduction
This section includes the algorithms and references used by the si_Polynomial Root Derivative.vi,
which is the core VI to calculate the derivative of roots of a polynomial with respect to the
polynomial coefficients. The si_Polynomial Root Derivative.vi is located in the
labview\vi.lib\addons\System Identification\Model Presentation Subs.llb directory.

2.

Function Description
Given a polynomial as represented by the following equation:

a0 xn ... an1x an a0 (x x1)(x x2 )...(x xn )

(1)

The purpose of this VI is to calculate the derivative of the roots with respective to the coefficients.

x1
x1
a a
n
0

xn xn
an
an
where

xi

xi
a
k
3.

are the roots and

ai

(2)

are the coefficients of the polynomial. However, this document uses

elsewhere to denote derivative matrix of Equation 2.

APIs
Para Name

In/Out

Type

Description

coefficients

In

1D DBL Array

The coefficients of a polynomial

dx/da

Out

2D CDB Array

The derivative of roots with respect to the


coefficients

4.

Algorithms

System Identification Toolkit

82

ni.com

Algorithm References

First, consider that the given polynomial is a monic polynomial, where a0

1 for Equation 1,

with roots x1,..., xn .

xn b1xn1 ... bn1x bn x x1 ... x xn 0

(3)

From the Vieta Theorem, you can have

b1 (1) xi

i
b x x

2
i j

i j

bn (1)n x1...xn

(4)

or

bp (1) p

k1

...xk p , p 1,2,..., n

(5)

k1 ...k p
ki k j

You therefore can have

b1
1, q 1,2,..., n
xq

(6)

and

bp
(1) p xk1 ...xk p1
xq
k1 ...k p1
ki k j
ki q

p
(1) xk1 ...xk p1 xq xk1 ...xk p2
k1...k p1
.
k1 ...k p2
ki k j

ki k j
ki q

b
(1) p (1) p1 bp1 (1) p1 xq p1
xq

bp1 xq

(7)

bp1
xq

For a common polynomial

a0 xn ... an1x an a0 (x x1)(x x2 )...(x xn )

(9)

you can rewrite it as

xn b1xn1... bn1x bn (x x1)(x x2 )...(x xn )

(10)

where

bj

aj
, j 1,2,..., n .
a0

You therefore can have


National Instruments Corporation

83

System Identification Toolkit

Algorithm References

xi
x
1 n
2 ak i
a0
a0 k 1 bk
xi 1 xi

, k 1, 2,..., n
ak a0 bk

(11)
(12)

si_Variance of Real and Imaginary of Roots.vi


1.

Introduction
This section includes the algorithms and references used by the si_Variance of Real and Imaginary
of Roots.vi, which is the core VI to calculate the variance of real part and imaginary part of
polynomial roots of a polynomial and their covariance. The si_Variance of Real and Imaginary of
Roots.vi is located in the labview\vi.lib\addons\System Identification\Model Presentation Subs.llb
directory.

2.

Function Description
If the variance and covariance of a complex number and its conjugate are known, you can deduce
the variance of the real and imaginary parts and the covariance between the real and imaginary
parts. You can use this VI to calculate the variance of real and imaginary parts, the covariance of
real and imaginary parts if the roots of a polynomial are known, and the covariance matrix of the
roots. Note that the polynomial roots are required to be real or in conjugate pairs in this VI.

3.

APIs
Para Name

In/Out

Type

Description

polynomial roots

In

1D CDB Array

The roots of a polynomial, or real coefficients

Covariance

In

2D CDB Array

Covariance matrix of the polynomial roots

sta of root (special

Out

1D CDB Array

Reconstructing variance and covariance in an

format)

array, which has the same length to roots

Polynomial Roots

Out

1D CDB Array

Copy of polynomial roots

Re_Variance

Out

1D DBL Array

The variance of real part of the roots

Im_Variance

Out

1D DBL Array

The variance of imaginary part of the roots

Re_Im_Covariance

Out

1D DBL Array

The covariance of real part and imaginary part

dup

of the roots

4.

Algorithms
For a complex number,
can be written as

z , you can denote its real part as a

and its imaginary part as

b . Then, z

a bi . Thus, you can have

E( z) E(a) E(b)i ,
where

E( z) means the expectation value of z .

System Identification Toolkit

84

ni.com

Algorithm References

Thus,

D( z) E( z E( z))2 E(a E(a))2 E(b E(b))2 2E(a E(a))(b E(b))i


D(a) D(b) 2Cov(a, b)i
where

D( z)

means the variance of

and

Cov(a, b)

means the covariance of

and

(1)

b.

Similarly, you can have

Cov( z, z) E( z E( z))( z E( z)) E(a E(a))2 E(b E(b))2


D(a) D(b)
where

(2)

z means the conjugate of z .

From Equations 1 and 2, you can get

1
Cov(a, b) (D( z))
2

(3)

1
D(a) (Cov( z, z) (D( z)))
2

If

1
D(b) (Cov( z, z) (D( z)))
2
z is a real number, you can treat z as a complex number with D(b) 0

(4)
(5)
and

Cov(a, b) 0 .

Then Equations 3, 4, and 5 become

D(a) D( z)

(6)

D(b) 0

(7)

Cov(a, b) 0

(8)

si_Confidence Region of Polynomial.vi


1.

Introduction
This section includes the algorithms and references used by the si_Confidence Region of
Polynomial.vi, which is the core VI to calculate the confidence regions of roots of a polynomial.
The si_ Confidence Region of Polynomial.vi is located in the labview\vi.lib\addons\System
Identification\Model Presentation Subs.llb directory.

2.

Function Description
If you have knowledge about the variance and covariance of the real part and imaginary part of a
complex number, you can draw the confidence region of the complex number as an ellipse, or an
interval in the degenerate form, on the plane. Similarly, for a polynomial, if you know all the
above parameters of its roots, you can draw several ellipses on the plane to show the confidence
region of its roots. You can use this VI to calculate the bound of these ellipses.

3.

APIs

National Instruments Corporation

85

System Identification Toolkit

Algorithm References

Para Name
polynomial

In/Out

Type

Description

In

1D CDB Array

The roots of a polynomial

var_Re

In

1D DBL Array

The variance of real part of roots

var_Im

In

1D DBL Array

The variance of imaginary part of roots

covar_ReIm

In

1D DBL Array

The covariance of real part and imaginary part of

roots

roots
num of points

In

I32

The number of points in each circle

std range

In

BDL

The factor determines the confidence region,


which is std range * standard deviation.

circle plot data

Out

1D Array of

Each Cluster contains 2 1D DBL Array, which

Cluster

represent the x-value and y-value of the bound of a


region.

4.

Algorithms
For a complex number,

X , you can denote its real part and imaginary part as x1 and x2 .

Suppose that their average values are

1, 2 , their variances are 1, 2 , and their covariance is

1 2 , where 0 1 .
If one of

and

is zero, then one part of

interval on another direction with mid-point

X is a constant, and the confidence region is an

(1, 2 )

and radius std range* i , which does not

equal 0.
Otherwise, you can consider the distribution of

P( x1, x2 )

x1

and

x2

as bivariate normal distribution

z
exp
2
2 1 2
21 2 1
1

(1)

where
2
2
x1 1 2 x1 1 x2 2 x2 2

12

1 2

22

(2)

You can move the average point to zero and rotate the axis as shown in the following equation by
coordinate converting:

x1 1 r1 cos r2 sin

x2 2 r1 sin r2 cos
Then,

System Identification Toolkit

86

ni.com

Algorithm References

cos2 2 cos sin sin 2 2


2 r1
2
1 2
2
1

cos sin cos2 sin 2 cos sin


r1r2
2

12

1 2
22

2
2
sin 2 cos sin cos 2

2
r2
2

1 2
2
1

Let

(3)

r2 0 , so you can have the conditional distribution

cos2 2 cos sin sin 2


2
2
1
1 2
2 2

P(r1 | r2 0) const exp


r1
2

2 1

(4)

The constant before the exponential function is not necessary to know, but you must know it is
also a normal distribution with

cos2

12
1

2 cos sin

1 2
1 2

sin2

22

(5)

is the variance.
So, in this direction, (cos ,sin ) , the confidence region is [-std range* , std range* ]. Thus,
where

you have a point on the ellipse as (std range* * cos + 1 , std range* * sin + 2 ). You can
get the ellipse by connecting all these points.
For a polynomial, you can handle all its roots following the above method.

SI Average Theta and Covariance.vi


1.

Introduction
This section includes the algorithms and references used by the SI Average Theta and
Covariance.vi. The SI Average Theta and Covariance.vi is the core VI used to merge general linear
polynomial models. The SI Average Theta and Covariance.vi is located in the
labview\vi.lib\addons\System Identification\Model Merge.llb directory.

2.

Function Description
The purpose of this function is to merge general-linear polynomial models estimated from
different experimental data sets. The models to be merged must be of the same model type and
must have the same model orders.

National Instruments Corporation

87

System Identification Toolkit

Algorithm References

3.

APIs
Para Name

In/Out

Type

Description

theta 1

In

2D DBL Array

The parameters of model 1

covariance 1

In

3D DBL Array

The covariance matrix of model 1

theta 2

In

2D DBL Array

The parameters of model 2

covariance 2

In

3D DBL Array

The covariance matrix of model 2

theta

Out

2D DBL Array

The parameters of the merged model

covariance

Out

3D DBL Array

The covariance matrix of the merged


model

4.

Algorithms

This VI uses

i to denote the parameters estimated from dataset i and C i

to denote the

corresponding covariance matrix. The optimal way to combine these estimates is demonstrated by
the following equation: [Ref 1]

2
C C i
i1

1 1

5.

i
1

CC i

(1)

i 1

References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall, Page 465,
Equation 14.15.

SI Generate Pseudo-Random Binary Sequence.vi


1.

Introduction
This section includes the algorithms and references used by the SI Generate Pseudo-Random
Binary Sequence.vi. The SI Generate Pseudo-Random Binary Sequence.vi is the core VI used to
generate pseudo-random binary sequences (PRBS). The SI Generate Pseudo-Random Binary
Sequence.vi is located in the labview\vi.lib\addons\System Identification\Utility.llb directory.

2.

Function Description
The purpose of this function is to generate a PRBS to be used as the stimulus signal of a system.

3.

APIs
Para Name

In/Out

Type

Description

samples

In

I64

The length of the sequence

polynomial order

In

I32

The order of the primitive polynomial

seed

In

I64

The seed of a PRBS

System Identification Toolkit

88

ni.com

Algorithm References

4.

upsampling factor

In

I32

The upsampling factor n

PRBS

Out

1D U8 Array

The PRBS this VI generates

Algorithms
High frequency fluctuations can be harmful to devices in the real-world industrial environment.
Therefore, a stimulus signal whose power spectrum is similar to a lowpass filter is often desirable.
You can obtain a lowpass PRBS by upsampling the original PRBS, also known as the original
maximum length sequence, whose spectrum is uniform over the entire frequency range. [Ref 1]

n
where n is the upsampling factor,

Tclk

Tclk
Ts

(1)

is the clock period of the original maximum length

sequence, and Ts is the sampling period.

5.

Reference
[1] Yucai Zhu, Multivariable System Identification for Process Control, Elsevier Science, 2001,
Page 43.

Gauss-Newton Minimization Method


1.

Introduction
This section summarizes the algorithms of the Gauss-Newton minimization method. You can
use the Gauss-Newton minimization method to refine the estimation of continuous transfer
function models, user-defined models, partially known models, and polynomial models such
as the ARMAX, output-error (OE), Box-Jenkins (BJ), and general-linear models.

2.

Problem to Solve
The purpose of model estimation is to identify the model coefficients by minimizing the mean
square error,

VN , which is defined by the following equation:


VN ( )

1 N 1 2
(t, )
N t 1 2

(1)

In this equation, all the coefficients to be estimated are combined together as a vector.

(t , )

is the error

y (t, ) y(t ) ,

simulated output of the system,

indicating the difference between the predicted or

yt, , and the measured output, yt .

You can use some methods, such as the multi-stage method for polynomial models, to get a
coarse estimation of

National Instruments Corporation

. You then can use the following iteration to refine :


89

System Identification Toolkit

Algorithm References

(i1) (i ) f (i )

where

is the step size and

(2)

is the search direction. The purpose of iteration is to

f (i )

minimize the mean square error VN

. The problem to solve lies in how to select and

compute the search direction.


3.

Algorithms [page 326, Ref 1]


The Gauss-Newton minimization defines the search direction

f ( ) as

f ( ) V ''( ) V '( )
1

(3)

where

1 N
(t, ) (t, )
N t 1

(4)

1 N
(t, ) T (t, )

N t 1

(5)

V '( )
and

V ''( )

t,

dyt,
dt

(6)

T denotes transposing. By inserting Equations 4 and 5 into 3, you obtain the following
equation:
N

f ( )

(t, ) (t, )

t 1
N

(t, )

(t, )

t 1

(1, )
(2, )
(1, ) (2, ) ... ( N , ) ...

( N , )

T (1, )
T

(2, )

(1,

(2,

)
...

(
N
,

...
T

( N , )
T (1, )
T

(2, )

...
T

( N , )
You can evaluate

System Identification Toolkit

f ( )

(1, )
(2, )

...

( N , )

(7)

by solving the following linear equation:

90

ni.com

Algorithm References

T (1, )
(1, )
T

(2, ) f ( ) (2, )
...
...
T

( N , )
( N , )

(8)

The following equations define (t , ) .


Gradient of ARMAX Model [Page 330, Equation 10.52, Ref 1]

(t, )

1
[ y(t 1)... y(t Na ) u(t 0)...u(t Nb 1)
C(q)

(t 1)... (t Nc )]T
Gradient of OE Model [Page 330, Equation 10.54b,e, Ref 1]

1 k

Bq
q u(t ),
q k ut , t 1,...,N
F qF q
F q

t,

Gradient of BJ Model [Page 330, Equation 10.54b,c,d,e, Ref 1]

D(q)
D(q) k
qk u(t ),
q w(t ),
C(q) F (q)
C(q) F (q)
1
1 k
qk (t ),
q v(t )], t 1,..., N
C(q))
C(q))

(t, ) [

Gradient of General-Linear Model [Page 330, Equation 10.54a,b,c,d,e, Ref 1]

(t, ) [

D(q) k
D(q)
D(q) k
q y(t ),
qk u(t ),
q w(t ),
C(q)
C(q) F (q)
C(q) F (q)
1
1 k
qk (t ),
q v(t )], t 1,..., N
C(q))
C(q))

Gradient of Continuous Transfer Function Models, User-Defined Models, and Partially


Known Models
The LabVIEW System Identification Toolkit does not have explicit formulas to calculate the
gradients for continuous transfer function, user-defined, or partially known models. Instead,
this toolkit uses the following numerical differentiation equation to calculate the gradients.

yt, d yt, d
2 d
d *DIFF _ 2

t,

where

4.

DIFF _ 2 = 3.2057501263e6

Robustness Consideration [Pages 481-483, Ref 1]


Since the optimization criterion is to minimize the norm of the prediction error as shown by
Equation 1, accurate estimation of the norm of the prediction error can improve the robustness
of the minimization. The prediction error is clipped using the following equation: [Page 483,
Equation(15.9), Ref 1]

National Instruments Corporation

91

System Identification Toolkit

Algorithm References

(n) | (n) |

(n) (n)
(n)

where p is a scalar in the range


selects

1.5 .

1 1.8

. The System Identification Toolkit

is the estimated standard deviation of the prediction error by using the

MAD method, as shown by the following equation:

MAD* 1.483263287118
where MAD = the median of { | (t ) ~ | } with ~ as the median of (t ) [Page 483, Ref 1].
The constant 1.483263287118 is obtained with

5.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.

Instrumental Variable Method


1.

Introduction
This document includes the algorithm summary on the instrumental variable method to identify
an ARX model.

2.

Problem to Solve
An ARX model can be defined as

A(q) y(n) B(q)u(n k ) e(n)


If the noise e(n) is uncorrelated to the regression variables, y(n) and u(n), the coefficients of the
model A(q) and B(q) can be estimated with least squares regression method. However, if the
noise is correlated to y(n) and u(n), the least squares regression method does not work well. The
instrumental variable method described in this document can solve this problem.
3.

Algorithms
The instrumental variable method suggests the solution for the ARX model as [Eq. 7.118, P. 224,
Ref 1]:

NLS [
where

N
1 N
T
1 1

(
t
)

(
t
)
]

(t) y(t)
N t 1
N t 1

(1)

contains the instruments variables.

Choice of Instruments Variables

System Identification Toolkit

[P.225, Ref 1, 3.2, Ref 2]

92

ni.com

Algorithm References

For an open-loop system, the input sequence of the system, or its filtered version, is often a good
choice of instrumental variables. One of the choices of instrumental variables is

[x(t 1) x(t 2).... x(t Na ) u(t) u(t 1)...u(t Nb 1)]T


where

x(t )

(2)

is generated from the input through a linear system


c N (q) x(t ) M (q)u(t )

(3)

where

N (q) 1 n1q 1 n2 q 2 .... nnN q nN

(4)

M (q) 1 m1q 1 m2 q 2 .... mmN q mN

(5)

In practice, you can use the least squares method to estimate the coefficients of an ARX model.
You then can use the estimated A(q) and B(q) as N(q) and M(q), respectively, to have an
instrumental variable estimation of the ARX model with Equation 1.
4.

Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
[2] National Instruments xMath User Manual.

SI Estimate Discrete Transfer Function Model from


FRF (SISO arbitrary).vi
1.

Introduction
This section includes the algorithms and references used by the SI Estimate Discrete Transfer
Function Model from FRF (SISO arbitrary).vi. The SI Estimate Discrete Transfer Function Model
from FRF (SISO arbitrary).vi is the core VI used to estimate discrete transfer functions from FRF
data. The SI Estimate Discrete Transfer Function Model from FRF (SISO arbitrary).vi is located in
the labview\vi.lib\addons\System Identification\Frequency Domain Estimation.llb directory.

2.

Function Description
The discrete transfer function model can be represented as

y( k ) H( z )u( k ) e( k ) ,

(1)

where u(k) and y(k) are the stimulus and response signals of a system, e(k) is the additive noise,
and H(z) is represented by the following equation.

H( z )

b0 b1z... bm z

a0 a1z... an z

, mn

(2)

where m is the numerator order and n is the denominator order.


The purpose of this VI is to estimate the transfer function H(z) by using the frequency response
function (FRF) of a system.

National Instruments Corporation

93

System Identification Toolkit

Algorithm References

3.

APIs
Para Name

In/Out

Type

Description

FRF magnitude

In

Cluster

The magnitude of the FRF of the system

FRF phase

In

Cluster

The phase of the FRF of the system

FRF format

In

Cluster

orders of

In

Cluster

m is the numerator order and n is the

transfer function

denominator order

model
FRF weight

In

1D CDB Array

The frequency-domain weight of the


estimation error

sampling rate

In

DBL

system model

Out

Object containing

out

information about

this model
coefficients of

Out

Cluster

Numerator is [b0, b1, , bm],

transfer function

Denominator is [a0, a1, , an]

model

4.

Algorithms
This VI uses the polynomial Matrix Fraction Description (MFD) to represent the transfer function
model. The polynomial MFD also estimates MIMO models. This estimation method is a
multivariable least squares method in the frequency domain.
For a set of observed FRF data G( ) , evaluated at N frequency points
j

p r
i

for j 1,...,N
G( e ) G( j ) C

(3)

The aim of the identification procedure is to find a linear time-invariant (LTI) model P( ) that
approximates the above FRF data. The model P( ) is parameterized by either a left or right
polynomial MFD, where collects all the real-valued parameters of the polynomial MFD.
The model P( ) approximates the data G( ) by minimizing the following equation.
j

J( )

trE( j , )E * ( j , ) E( ) 2F
N

(4)

j 1

where E( , ) G( ) P( , ) for j 1,...,N .


j

The goal of this algorithm is to find a real-valued in the following equation.

: argminJ( )

(5)

Focusing on the left-hand side of the polynomial MFD, the model P( ) can be parameterized as

System Identification Toolkit

94

ni.com

Algorithm References

P( z , ) A( z , ) B( z , )

(6)

where A and B denote parameterized polynomial matrices in terms of z-1. Note that

P( j , ) P( z , )

(7)

i jT

z e

For a model with r inputs and p outputs, the following equations represent A and B, respectively:
1

A( z , ) I p p
where A

p p

pr

(8)

k 1

d m 1

k d

Ak z

B( z , )
where B

Bk z

(9)

and d denotes the number of leading zero matrix coefficients. Because each

input-output pair defines a SISO LTI system, Equations 8 and 9 are scalar polynomials.
When the system is defined by scalar polynomials, you can determine dij by the number of time
delays from the j-th input to the i-th output. These pair-wise parameters, dij, mij, and nij are
structural parameters and are set to d:=min{dij}, m:=max{mij}, and n:=max{nij} for Equations 8
and 9 in the general MIMO case.
Then, the error E( , ) is defined by the following:
j

1
1
1
1
E( j , ) A( z , ) A( z , )G( j ) B( z , ) i T

z e j

(9)

From here, a multivariable case SK-iteration can be invoked to actually minimize the error. If
necessary, a subsequent GN-optimization can be utilized by using the SK-iteration result as the
initial estimate.
Because this VI applies to SISO systems only, the above algorithm is used in a degenerated case,
where r=p=1.

5.

References
[1] R. A. Callafon, D. de Roover, and P. M. J. Van den Hof, Multivariable least squares frequency
domain identification using polynomial matrix fraction descriptions, in Proc. 35th Int. Conf.
Decision and Control, Kobe, Japan, Dec. 1996, pp. 2030-2035.

National Instruments Corporation

95

System Identification Toolkit

Algorithm References

SI Estimate Continuous Transfer Function Model from


FRF (SISO arbitrary).vi
1. Introduction
This section includes the algorithms and references used by SI Estimate Continuous Transfer
Function Model from FRF (SISO arbitrary).vi. The SI Estimate Continuous Transfer Function
Model from FRF (SISO arbitrary).vi is the core VI used to estimate continuous transfer function
model from FRF data. The SI Estimate Continuous Transfer Function Model from FRF (SISO
arbitrary).vi is located in the labview\vi.lib\addons\System Identification\Frequency Domain
Estimation.llb directory.

2. Function Description
The continuous transfer function model can be represented as

y(k ) H (s)u(k ) e(k )

(1)

where u(k) and y(k) are the input and output of a system, e(k) is the additive noise, and H(s) is
represented by the following equation.

H ( s)

b0 b1s... b j s ... bm s
a0 a1s... ai s ... an s

,m<n

(2)

where m is the numerator order and n is the denominator order. The purpose of this VI is to
estimate the transfer function H(s) by using the FRF of a system.
3. APIs
Para Name

In/Out

Type

Description

FRF magnitude

In

Cluster

The magnitude of the FRF of a system

FRF phase

In

Cluster

The phase of the FRF of a system

FRF format

In

Cluster

orders of

In

Cluster

m is the numerator order and n is the

transfer function

denominator order

model
FRF weight

In

1D CDB Array

The frequency-domain weight of the


estimation error

system model

Out

out

Object containing
information about this

model
coefficients of

Out

Cluster

Numerator is [b0, b1, , bm],

transfer function

Denominator is [a0, a1, , an]

model

4. Algorithms

System Identification Toolkit

96

ni.com

Algorithm References

The algorithm used in this VI is a least squares method. To have better numerical properties, the
basis polynomials are chosen to be the Chebyshev polynomials[1] instead of the natural basis
polynomials {1, s, s2, , sn}.
Chebyshev polynomials are defined in many ways. One way by recursion is as follows:

T0(s) = 1
T1(s) = s
Tn+1(s) = 2sTn(x) Tn-1(s)
where the resulting basis polynomials are {T0, T1, T2, , Tn}.
Now you can define H(s) as:

H( s )

b0 b1 T1( s ) ... b j T j ( s ) ... bmTm ( s )


c

(3)

a0 a1 T1( s ) ... ai Ti ( s ) ... anTn ( s )

Suppose you obtain a set of observed FRF data G( ) , evaluated at N frequency points .
j

G( ) G( ) C , for j 1,...N

j
j

By evaluating H(s) at the same set of N frequency points , you reach a standard setup for a least
j

squares problem:
N

H( , j ) G( j )

argmin

j 1

where H( , ) H( s )
j

siw j

and a0

a1

... an b0 b1

c
... bm .

After obtaining , the coefficients under the Chebyshev basis, you can insert them back into
Equation 3 so as to obtain the coefficients {a0, a1, , an, b0, b1, , bm}, which are under the natural
basis.
5. References
[1] Vetterling, William T., William H. Press, Saul A. Teukolsky, and Brian P. Flannery. 1992.
Numerical Recipes in C: The Art of Scientific Computing. Cambridge University Press
[2] Xmath System Identification Module, Part 1

SI Estimate State-Space Model from FRF.vi


1.

Introduction
This section includes the algorithms and references used by the SI Estimate State-Space Model
from FRF.vi. The SI Estimate Discrete State-Space Model from FRF (MIMO arbitrary).vi is the
core VI used to estimate a discrete state-space model from FRF data. The SI Estimate State-Space

National Instruments Corporation

97

System Identification Toolkit

Algorithm References

Model from FRF.vi is located in the labview\vi.lib\addons\System Identification\Frequency


Domain Estimation.llb directory.
2.

Function Description
The discrete state space models in this VI are defined as

x( k 1) Ax( k ) Bu( k )
y( k ) Cx( k ) Du( k ) n( k )
m

(1)

where u( k ) , y( k ) , x( k ) are the input, output, and state, respectively, of the


l

system. n( k ) is the noise term which is assumed to be independent of the input sequence
u(k). By using the Fourier transform on both sides of both equations in Equation 1, you obtain the
following equations.
i

e X ( ) AX ( ) BU( )
Y ( ) CX( ) DU( ) N( )
where Y(), U(), N(), and X() are the transformed output, input, noise, and state,
respectively. By eliminating the state, you obtain the following equation.

Y ( ) G( e
i

where G( e

) G( z )

z e

D C( zI A ) B

z e

)U( ) N( )
and is the frequency response function

(FRF) of the system.


The goal of this VI is to find an estimate for the system matrices A, B, C, and D, and the initial
states x0, given samples of the FRF G( e

3.

) of the system.

APIs
Para Name

In/Out

Type

Description

FRF magnitude

In

Cluster

The magnitude of the FRF of the system

FRF phase

In

Cluster

The phase of the FRF of the system

FRF format

In

Cluster

number of states

In

I32

Denoted by n, also known as the order of


the system

noise subspace

In

DBL

Determines the augmented order to


incorporate noise at a given number of
states

structure selector

In

Cluster

Information about the D matrix and initial


state

sampling rate

In

DBL

system model

Out

Object containing

System Identification Toolkit

98

ni.com

Algorithm References

out

information about

this model
coefficients of

Out

Cluster

Estimated matrices A, B, C, D

Out

1D DBL Array

Estimated initial state vector

state-space
model
initial states

4.

Algorithms
The algorithm used in this VI is a frequency-domain subspace identification method, which is very
similar to its time-domain counterpart.

y( k )
y( k 1 )
and similarly with u ( k ) and n ( k )
Define yd ( k )
d
d

y( k d 1 )
By recursively using Equation 1, you obtain:

yd d x( k ) d ud ( k ) nd ( k )

(2)

C
CA
and is the extended system observability matrix and
where d

d 1
CA

0 0 0
D
CB
D 0 0

d CAB CB D 0


d 2
CA B CB

0
0
0 is the lower triangular Toeplitz matrix.

0
D

By using the Fourier transform on both sides of Equation 2, we obtain

Wd ( ) Y( ) d X ( ) dWd ( ) U( ) Wd ( ) N( )
where denotes the Kronecker product and Wd ( ) 1 e

2i

... e

(3)

i( d 1 ) T

Assume you have samples of the Fourier transform of the input and output signals at M
frequencies k, where k=1, 2,, M. By collecting these samples properly, you have

Yd ,M (Wq ( 1 ) Y( 1 ) ... Wq ( M ) Y( M ) )

Ud ,M (Wq ( 1 ) U( 1 ) ... Wq ( M ) U( M ) )
Nd ,M (Wq ( 1 ) N( 1 ) ... Wq ( M ) N( M ) )

X M ( X ( 1 ) ... X ( M ) )
By using Equation 3, you obtain

National Instruments Corporation

99

System Identification Toolkit

Algorithm References

Yd ,M d X M dU d ,M Nd ,M

(4)

From Equation 4, you want to remove the term U


by some proper orthogonal projection.
d d ,M
Next, you can estimate d, which will enable you to obtain estimates of matrices A and C. You
then can estimate matrices B and D and the initial state x0 by using the least squares method.
This VI uses the following five steps to implement the algorithm described above by employing
QR factorization and singular value decomposition (SVD) for efficiency and reliability.
1) Form the matrices Y and U in Equation 4. You can suppress the subscript variables for
simplicity. Notice that because you begin with the FRF, you can assign U to be the unit or the
Fourier transform of the impulse signal and directly relate FRF and Y.
2) Calculate the QR factorization

H
U R11 0 Q1

R
Y 21 R22 Q H
2
3) Calculate the SVD of R22

ReR
22

Im R22 U S U O S
0

T
0 VS

O V T
O

4) Determine A and C:

( J U ) J U
A
1 s
2 s
C J 3U s
where J ( I
1

( d 1)l

0( d 1)l l ) , J 2 ( 0( d 1)l l

I( d 1)l ) , and J3 ( Il 0l ( d 1)l ) and are

the selection matrices.


5) Solve for B, D, and x0 from the following least squares problem
M

,D
, x argmin
B
0

5.

k 1

Y ( k ) ( D C ( e

ik

)1 B )U ( ) C ( e
IA
k

ik

)1 x
IA
0

References
[1] McKelvey, T. 1995. Identification of State-Space Models from Time and Frequency Data.
Ph.D. thesis, Department of Electrical Engineering, Division of Automatic Control, Linkoping
University, Sweden.

System Identification Toolkit

100

ni.com

S-ar putea să vă placă și