Sei sulla pagina 1di 104

TM

LabVIEW
LabVIEW System Identification VIs Algorithm References
Subtitle

TitleShort-Hidden (cross reference text)

June 2014
Support

Worldwide Technical Support and Product Information


ni.com

Worldwide Offices
Visit ni.com/niglobal to access the branch office Web sites, which provide up-to-date
contact information, support phone numbers, email addresses, and current events.

National Instruments Corporate Headquarters


11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100

To comment on National Instruments documentation, refer to the National Instruments Web site
at ni.com/info and enter the Info Code feedback.

© 2004–2014 National Instruments. All rights reserved.


Legal Information
Warranty
NI devices are warranted against defects in materials and workmanship for a period of one year from the invoice date, as
evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace equipment that proves
to be defective during the warranty period. This warranty includes parts and labor.
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 the invoice date, 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. CUSTOMER’S 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 owner’s failure to follow the National Instruments installation, operation,
or maintenance instructions; owner’s modification of the product; owner’s 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.
End-User License Agreements and Third-Party Legal Notices
You can find end-user license agreements (EULAs) and third-party legal notices in the following locations:
• Notices are located in the <National Instruments>\_Legal Information and <National Instruments>
directories.
• EULAs are located in the <National Instruments>\Shared\MDF\Legal\license directory.
• Review <National Instruments>\_Legal Information.txt for more information on including legal information
in installers built with NI products.
Trademarks
Refer to the NI Trademarks and Logo Guidelines at ni.com/trademarks for more information on National Instruments
trademarks.
ARM, Keil, and µVision are trademarks or registered of ARM Ltd or its subsidiaries.
LEGO, the LEGO logo, WEDO, and MINDSTORMS are trademarks of the LEGO Group. ©2013 The LEGO Group.
TETRIX by Pitsco is a trademark of Pitsco, Inc.©2013
FIELDBUS FOUNDATION™ and FOUNDATION™ are trademarks of the Fieldbus Foundation.
EtherCAT® is a registered trademark of and licensed by Beckhoff Automation GmbH.
CANopen® is a registered Community Trademark of CAN in Automation e.V.
DeviceNet™ and EtherNet/IP™ are trademarks of ODVA.
Go!, SensorDAQ, and Vernier are registered trademarks of Vernier Software & Technology. Vernier Software & Technology
and vernier.com are trademarks or trade dress.
Xilinx is the registered trademark of Xilinx, Inc.
Taptite and Trilobular are registered trademarks of Research Engineering & Manufacturing Inc.
FireWire® is the registered trademark of Apple Inc.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Handle Graphics®, MATLAB®, Real-Time Workshop®, Simulink®, Stateflow®, and xPC TargetBox® are registered
trademarks, and TargetBox™ and Target Language Compiler™ are trademarks of The MathWorks, Inc.
Tektronix®, Tek, and Tektronix, Enabling Technology are registered trademarks of Tektronix, Inc.
The Bluetooth® word mark is a registered trademark owned by the Bluetooth SIG, Inc.
The ExpressCard™ word mark and logos are owned by PCMCIA and any use of such marks by National Instruments is under
license.
The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft
Corporation in the United States and other countries.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your
software, the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.
Export Compliance Information
Refer to the Export Compliance Information at ni.com/legal/export-compliance for the National Instruments global
trade compliance policy and how to obtain relevant HTS codes, ECCNs, and other import/export data.
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 VIs.

Refer to the LabVIEW Help, available in LabVIEW by selecting Help»LabVIEW Help, for more
information about the main steps in the system identification process and about how to use the System
Identification VIs 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 1 System Identification VIs


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 VI SubVI
Data SI Remove Trend si_Piecewise Linear Fitting.vi
Preprocessing SI Detect Feedback SI Detect Feedback (Array).vi
Nonparametric SI Estimate Impulse Response si_Correlation Analysis.vi
Model SI Estimate Impulse Response (Least Squares
Estimation Array).vi
SI Estimate Frequency si_Frequency Analysis.vi
Response
Frequency- SI Estimate Transfer Function SI Estimate Discrete Transfer Function Model
Domain Model Model from FRF from FRF (SISO arbitrary).vi
Estimation SI Estimate Continuous Transfer Function
Model from FRF (SISO arbitrary).vi
SI Estimate State-Space Model SI Estimate State-Space Model from FRF.vi
from FRF
Parametric SI Estimate AR Model si_AR (FB, LS, YW and PC).vi
Model si_AR Burg Method.vi
Estimation SI Estimate ARX Model si_Est ARX Model (SISO).vi
si_Est ARX Model (MISO).vi
si_Est ARX Model (MIMO).vi
SI Estimate ARMAX Model si_Est ARMAX Model (SISO).vi
si_Est ARMAX Model (MISO).vi
SI Estimate OE Model si_Est OE Model (SISO).vi
si_Est OE Model (MISO).vi
SI Estimate BJ Model si_Est BJ Model (SISO).vi
si_Est BJ Model (MISO).vi
SI Estimate GL Model si_Est GL Model (SISO).vi
si_Est GL Model (MISO).vi
SI Estimate State-Space Model SIMPCA
si_Impulse Realization (MIMO).vi
SI Estimate Transfer Function SI Estimate Continuous Transfer Function
Model Model (SISO Array).vi
SI Estimate Discrete Transfer Function Model
(SISO Array).vi
SI Estimate User-Defined SI Estimate User-Defined Model (MIMO
Model Array).vi
Partially Known SI Estimate Partially Known SI Estimate Partially Known Continuous
Model Continuous Transfer Function Transfer Function Model (General SISO
Estimation Model Array).vi
SI Estimate Partially Known SI Estimate Partially Known State-Space Model
State-Space Model (MIMO Array).vi
Recursive SI Recursively Estimate AR Recursive model estimation
Model Model
Estimation SI Recursively Estimate ARX
Model
SI Recursively Estimate
ARMAX Model
SI Recursively Estimate OE
Model
SI Recursively Estimate BJ
Mode
SI Recursively Estimate State-
Space Model
Model SI Model Conversion si_Convert to Transfer Function Model.vi

System Identification VIs 2 ni.com


Algorithm References

Conversion SI Convert to Models of CDT si_Convert to State Space.Model.vi


si_Convert to Pole-Zero Model.vi
Model Analysis SI Bode Plot si_Std Freq.vi
SI Nyquist Plot
SI Pole-Zero Plot 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
Model SI Model Simulation si_GL Model Sim (MISO).vi
Validation 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 Model Prediction si_GL Model Predict (MISO).vi
si_SS Model Predict vi
si_SS State Response.vi
SI Model Residual Analysis si_Residual Analysis.vi
Utilities SI Merge Models SI Average Theta and Covariance.vi
SI Generate Pseudo-Random SI Generate Pseudo-Random Binary
Binary Sequence Sequence.vi

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  s N −1 . The piecewise points include 0, x1, …, xL,
N-1.

3. APIs
Para Name In/Out Type Description
signal (with In 1D DBL Array The signal to be fitted

trend)
piecewise In 1D I32 Array The piecewise points of the linear fitting
points
Signal Out 1D DBL Array Fitted signal
(without
trend)
best fit Out 1D DBL Array The best fit piecewise linear signal

© National Instruments 3 System Identification VIs


Algorithm References

slopes Out 1D DBL Array The piecewise slope


intercepts Out 1D DBL Array The piecewise intercept
error Out I32 -

4. Algorithms

If y 0, y1  y L , y N −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 (1)
xi +1 − xi xi +1 − xi
Therefore, you can obtain the piecewise linear trend, or the best fit values, of the signal if you

know y 0, y1  y L , y N −1 . Using the least square criterion, you can obtain y 0, y1  y L , y N −1 by


solving the following linear equations:

AY = S (2)

where Y = [ y 0, y1  y L , y N −1 ]T , S = [ s 0, s1  , s N −1 ]T , and

 a00 b00 0 0 0 
  
 0 0 0 
 
 a0 m0 b0 m0 0 0 0 
 
 0 a10 b10 0 0 
 0  
 0 0 
A=  (3)
 0 a1m1 b1m1 0 0 
 
 0 0  
 0 
 0 0 0 aL −1,0 bL −1,0 
 
 0 0 0  
 
 0 0 0 aL −1,mL−1 bL −1,mL−1 

xi +1 − k k − xi
where aik = , bik = ,and mi represents the number of signals between
xi +1 − xi xi +1 − xi

xi and xi +1 that satisfies m0 + ... + mL −1 = N . x0 = 0 and xN −1 = N − 1 .

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

y 0, y1  y L , y N −1 . Then, by multiplying the matrix A by the vector Y, you can calculate the best
fit signal.

System Identification VIs 4 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 5 System Identification VIs


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) (1)
Na
where 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
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 ,...., aN a ]
coefficients
std Out 1D DBL Array Standard deviations of [1, a1 , a2 ,...., aN a ]
covariance Out 2D DBL Array Covariance matrix of [a1 , a 2 ,...., a N a ]
noise Out 1D DBL Array e(n)
noise Out DBL Variance of e(n)
variance

System Identification VIs 6 ni.com


Algorithm References

error Out I32 Error code

4. Algorithms

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

M f  m f 
 a = −  (2)
M b   mb 
where

 y (n a − 1) y (n a − 2)  y (0) 
 y (n ) y (n a − 1)  y (1) 
Mf = a 
     
 
 y ( N − 2) y ( N − 3)  y ( N − na + 1)

 y (1) y (2)  y (na ) 


 y (2) y (3)  y (na + 1)
Mb = 
     
 
 y ( N − na ) y ( N − na + 1)  y ( N − 1) 

 y (na )   y (0)   a1 
 y (n + 1)   a 
y (1)
, a=
2 
mf =  a  , mb =  
        
     
 y ( N − 1)   y ( N − na − 1) a na 

Least Squares Method


The AR coefficients can be estimated by solving the following linear equations:

 y (n a − 1) y (n a − 2)  y (0)   a1   y (na ) 
 y (n )  a   
 a y (n a − 1)  y (1)   2  = −  y (na + 1) (1)
          
    
 y ( N − 2) y ( N − 3)  y ( N − na + 1) a na   y ( N − 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 = −  (3)
M b   mb 
where

© National Instruments 7 System Identification VIs


Algorithm References

 y ( 0) 0  0 
 y (1) y (0)  0 
Mf =
     
 
 y ( N − na ) y ( N − n a + 1)  y ( N − 1)

 y (1) y (2)  y (na ) 


 y (2) y (3)  y (na + 1)
Mb = 
     
 
 y ( N − 1) 0  0 
 y (1)   y (0)   a1 
 y (2)   y (1)  a 
, a=
2 
mf =   , mb =  
        
     
 y ( N − 1)  y ( N − 2) a na 

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) (1)
Na
where 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 VIs 8 ni.com


Algorithm References

Para Name In/Out Type Description


stimulus In 2D DBL Array The input signals of a system
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing A A order, B order, and delay are Na ,
parameters order, B order, and
[N , N ,...., N ], and [k1, k2 ,...., kN ] ,
1b 2b Nb
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
deviations
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -
matrix
noise Out 1D DBL Array e(n)

4. Algorithms
Burg Method [Ref 1, page 363]
According to the definition of AR model, you can define:
Na
xˆ f (n) = −∑ a kf (k ) x(n − k )
k =1

e f (n)  x(n)  xˆ f (n)


2
 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 ) = −∑ a kb (k ) x(n − na + k )
k =1

eb (n)  x(n  na )  xˆ b (n  na )
2
 b  E{ eb (n) }

© National Instruments 9 System Identification VIs


Algorithm References

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


algorithm, where
ˆ
m ( k )  am1 ( k )  k m am1 ( m  k ), k  1,..., m 1
aˆˆˆ (2)

aˆm (m)  kˆm (3)

ˆˆm  (1 kˆm 2 )m1 (4)


N −1
− 2∑ emf −1 (i )emb −1 (i − 1)
kˆm = N −1
i =m
N −1
, m = 1,2,...., na (5)
∑| e
i =m
f
m −1 (i ) | + ∑ | e
2

i =m
b
m −1 (i − 1) | 2

em f (n)  em1 f (n)  km em1b (n 1)


em b (n)  em1b (n)  km em1 f (n) (6)

e0 (n)  e0 (n)  x(n), m  1,..., na


f b

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) (1)

Na N b −1
where A(q ) = 1 + ∑ a i q −i , B ( q ) =
i =1
∑b q
i =0
i
−i
, 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 , a 2 ,...., a N a ] and [b0 , b1 ,...., bNb −1 ]
using the input-output data of a system.

System Identification VIs 10 ni.com


Algorithm References

3. APIs

Para Name In/Out Type Description


stimulus In 1D DBL Array The input signal of a system
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing A A order, B order, and delay are Na , Nb , and k,
parameters order, B order, and
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 coefficients
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -
matrix
noises Out 1D DBL Array e(n)

4. Algorithms
The least square solution for the ARX model estimation is [Equation 7.34, Ref 1]:
 1 N
1 N
θ NLS = [
N
∑ϕ (t )ϕ T (t )]−1
t =1
∑ϕ (t ) y(t )
N t =1
(2)

where

ϕ (t ) = [− y (t − 1) − y (t − 2).... − y (t − N a ) u (t ) u (t − 1)... u (t − N b + 1)]T


You can rewrite Equation 2 as the solution of the linear equations:
AX = Y (3)
where

a1 
 
ϕ T ( p )     y( p) 
 T  a N a   y ( p + 1)
 ϕ ( p + 1)
A= , X =  , and Y =  
   0 
b  
     
ϕ T ( N )     y( N ) 
bNb −1 
5. References

© National Instruments 11 System Identification VIs


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 input-
output 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) (1)
Na N ib −1
where A(q ) = 1 + ∑ ai q −i , B(q) = [ B1 (q), B2 (q),...., BN (q)] and Bi (q) =
i =1
∑b q
j =0
ij
−j
,

u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k N )]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
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing A A order, B order, and delay are Na ,
parameters order, B order, and
[N ,N ,...., N ], and [k1, k2 ,...., kN ] ,
1b 2b Nb
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
deviations
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -

System Identification VIs 12 ni.com


Algorithm References

matrix
noise Out 1D DBL Array e(n)

4. 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 input-
output 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) (1)
Na N b −1
where A(q) = I + ∑ Ai q −i
, B(q) = ∑B q i
−i
, y (n) = [ y1 (n), y 2 (n),...., y M (n)]T ,
i =1 i =0

u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k 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
signal
response In 2D DBL Array The output signals of a system
signal
model In Cluster containing A A order, B order, and delay are [ N 1 a , N 2 a ,...., N Na ] ,
parameters order, B order, and
[ N 1b , N 2 b ,...., N Nb ] , and [k1, k2 ,...., kN ] ,
delay. A order is
I32. B order and respectively.

© National Instruments 13 System Identification VIs


Algorithm References

delay are ID I32.


ARX model Out Cluster -
std Out Cluster The standard deviations of coefficients A and B
deviations
noise Out 2D DBL Array Variance of e(n)
variance
covariance Out 3D DBL Array -
matrix
noise Out 2D DBL Array e(n)

4. 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 input-
output 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) (1)
Na N b −1 Nc
where A(q ) = 1 + ∑ ai q −i , B(q) =
i =1
∑ bi q −i , C (q) = 1 + ∑ ci q −i , u(n), y(n) and e(n) are
i =0 i =1

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 In/Out Type Description

System Identification VIs 14 ni.com


Algorithm References

stimulus In 1D DBL Array The input signal of a system


signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing A A order, B order, C order and delay are Na ,
parameters order, B order, C
N , Nc , and k, respectively.
b
order and delay. A
order, B order, C
order and delay are
I32.
ARMAX Out Cluster -
model
std Out Cluster The standard deviations of coefficients A, B,
deviations and C
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -
matrix
noise Out 1D DBL Array e(n)

4. 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
A(q)y(t)=B(q)u(t-k)+ v(t) (3)

Since v(t) here is not white Gaussian noise, the System Identification VIs apply 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 ) (4)

Here, as elsewhere, fˆ denotes the estimation of f . Thus, Equation 4 can be rewritten as


1
vˆ(t ) = e(t ) (5)
C (q)

© National Instruments 15 System Identification VIs


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
estimation methods with vˆ(t ) and eˆ(t ) as the output and input, respectively.

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 input-
output 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) (1)
Na N ib −1
where A( q ) = 1 + ∑ ai q , B(q) = [ B1 (q ), B2 (q ),...., B N (q )] and Bi (q ) =
−i
∑b q ij
−j
,
i =1 j =0

Nc
C (q ) = 1 + ∑ ci q −i , u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k N )]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 ) .
k i is the delay of the i-th input of the system. The purpose of this VI is to estimate the coefficients
[a1 , a 2 ,...., a N a ] , [bij ] and [c1 , c 2 ,...., c N c ] based on the input-output data of a system.

3. APIs
Para Name In/Out Type Description

System Identification VIs 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 Na , [ N 1b , N 2 b ,...., N Nb ] , N c , and k,
and delay. A order, C
respectively.
order and delay are I32.
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 -
matrix
noise Out 1D DBL Array e(n)

4. 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
B (q )
y (n) = u ( n − k ) + e( n ) (1)
F (q )
N b −1 Nf
where, B(q) = ∑b q
i =0
i
−i
, F (q) = 1 + ∑fq
i =1
i
−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 ) .

© National Instruments 17 System Identification VIs


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
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing B order, B order, F order and delay are Nb , N f ,
parameters F order and delay. They are
and k respectively.
I32.
OE model Out Cluster B is [0,...0, b0 , b1 ,...., bN b −1 ] , The

number of zeros at the beginning

equals k. F is [1, f1 , f 2 ,...., f N f ]


std Out Cluster The standard deviations of
deviations coefficients B and F
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -
matrix
noise Out 1D DBL Array e(n)

4. 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 VIs apply the instrumental variable (IV) method to estimate F(q) and B(q).

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

System Identification VIs 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
B (q )
y (n) = u ( n − k ) + e( n ) (1)
F (q )

where
N ib −1
B(q ) = [ B1 (q ), B2 (q ),...., BN (q )] and Bi (q ) = ∑b q
j =0
ij
−j
,

N if
F (q ) = [ F1 (q ), F2 (q ),...., FN (q )] and Fi (q ) = 1 + ∑ f ij q − j ,
j =1

B(q) B (q) B (q) B (q)


=[ 1 , 2 ,..., N ],
F (q) F1 (q) F2 (q ) FN (q )

u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k N )]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 [ f ij ] based on the input-output data of a system.

3. APIs
Para Name In/Out Type Description
stimulus In 2D DBL Array The input signal of a system
signal
response In 1D DBL Array The output signal of a system

© National Instruments 19 System Identification VIs


Algorithm References

signal
model In Cluster containing B order, B order, F order and delay
parameters F order and delay. They are [ N 1b , N 2 b ,...., N Nb ] , [ N 1 f , N 2 f ,...., N Nf ] ,

are 1D I32.
and k, respectively.
OE model Out Cluster B is a matrix as

0,...0, b10 , b11 ,...., b1( N1b −1) 


 
0,...0, b20 , b21 ,...., b2 ( N 2 b −1)  . The
... 
 
0,...0, bN 0 , bN 1 ,...., 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 N 2 f 
 
... 
1, f N 1 , 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 -
matrix
noise Out 1D DBL Array e(n)

4. 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 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) (3)

Here F max (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

System Identification VIs 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 input-
output 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
B(q) C (q)
y ( n) = u (n − k ) + e( n ) (1)
F (q) D(q)
N b −1 Nf Nc Nd
where B(q) = ∑ bi q −i , F (q) = 1 + ∑ f i q −i , C (q) = 1 + ∑ ci q −i , D(q) = 1 + ∑ d i q −i
i =0 i =1 i =1 i =1

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 ,...., c N c ] and [d1 , d 2 ,...., d Nd ] 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
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster B order, F order, C order, D order and
parameters delay are Nb , Nf , Nc , Nd and k,

© National Instruments 21 System Identification VIs


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 [1, f1 , f 2 ,...., f N f ] . C

is [1, c1 , c2 ,...., c N c ] and D is

[1, d1 , d 2 ,...., d N d ]
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 -
matrix
noise Out 1D DBL Array e(n)

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.
Let
C (q )
ε ( n) = F ( q ) e( n ) (2)
D(q )
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:

Bˆ (q ) C (q)
vˆ(n) = y (n) − u (n − k ) = e( n ) (4)
ˆ
F (q ) D(q)

Here, as elsewhere, fˆ denotes the estimation of f . If Nc = 0 , 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) (6)
C (q )

System Identification VIs 22 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) and eˆ(n) as the output and input, respectively.

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)
y ( n) = u (n − k ) + e( n ) (1)
F (q) D(q)

where
N ib −1
B(q ) = [ B1 (q ), B2 (q ),...., BN (q )] and Bi (q ) = ∑b q
j =0
ij
−j
,

N if
F (q ) = [ F1 (q ), F2 (q ),...., FN (q )] and Fi (q ) = 1 + ∑ f ij q − j ,
j =1

B(q) B (q) B (q) B (q)


=[ 1 , 2 ,..., N ],
F (q) F1 (q) F2 (q ) FN (q )

u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k N )]T , N is the number of input channels,


Nc Nd
C ( q ) = 1 + ∑ ci q − i , D ( q ) = 1 + ∑ d i q − i ,
i =1 i =1

and q is the backward shift operator, which means:

© National Instruments 23 System Identification VIs


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 ] , [ f ij ] , [c1 , c2 ,...., c N c ] , and [d1 , d 2 ,...., d N d ] based on the input-output data of a system.

3. APIs
Para Name In/Out Type Description
stimulus In 2D DBL Array The input signal of a system
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster B order, F order, C order, D order and
parameters delay are [ N 1b , N 2 b ,...., N Nb ] ,

[ N 1 f , N 2 f ,...., N Nf ] , N c , N d and

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

BJ model Out Cluster B is a matrix as

0,...0, b10 , b11 ,...., b1( N1b −1) 


 
0,...0, b20 , b21 ,...., b2 ( N 2 b −1)  . The
... 
 
0,...0, bN 0 , bN 1 ,...., 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 N 2 f 
 
... 
1, f N 1 , f N 2 ,...., f NN 
 Nf 
C is [1, c1 , c2 ,...., c N c ] and D is

[1, d1 , d 2 ,...., d N d ]
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 -
matrix
noise Out 1D DBL Array e(n)

System Identification VIs 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
C (q)
ε (n) = F max (q) e( n )
D(q)
Here F max (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:

Bˆ (q ) C (q)
vˆ(n) = y (n) − u (n − k ) = e( n ) (3)
Fˆ (q ) D(q)

Here, as elsewhere, fˆ denotes the estimation of f . If Nc = 0 , 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) (5)
C (q )
Then a high order AR model is applied to estimate eˆ(n) . Since 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 25 System Identification VIs


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:
B(q ) C (q )
A(q ) y (n) = u (n − k ) + e( n ) (1)
F (q ) D(q )
Na N b −1 Nf Nc
where A(q ) = 1 + ∑ ai q −i , B(q) = ∑ bi q −i , F (q) = 1 + ∑ f i q −i , C (q) = 1 + ∑ ci q −i ,
i =1 i =0 i =1 i =1

Nd
D(q ) = 1 + ∑ d i 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 , a 2 ,...., a N a ] , [b0 , b1 ,...., bNb −1 ] , [ f1 , f 2 ,...., f N f ] , [c1 , c2 ,...., c N c ] and

[d1 , d 2 ,...., d Nd ] 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
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster A order, B order, F order, C order, D
parameters order and delay are Na , Nb , Nf , Nc ,

Nd and k, respectively.

GL model Out Cluster A is [1, a1 , a2 ,...., a N a ] . B

is [0,...0, b0 , b1 ,...., bN b −1 ] , The

number of zeros at the beginning

equals k. F is [1, f1 , f 2 ,...., f N f ] . C

System Identification VIs 26 ni.com


Algorithm References

is [1, c1 , c2 ,...., c N c ] and D is

[1, d1 , d 2 ,...., d N d ]
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 -
matrix
noise Out 1D DBL Array e(n)

4. 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
C (q )
ε ( n) = F ( q ) e( n ) (2)
D(q )
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
C (q )
ε ( n) = e(n) , then Equation 1 becomes
D(q )
B(q)
A(q ) y (n) = u ( n − k ) + ε ( n) (4)
F (q)
You can approximately consider Equation 4 as an ARX model, whose B order is high

( Nb + N f
+ Nc + Nd ). 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 ) (5)
ˆ
F (q ) D (q )

Here, as elsewhere, fˆ denotes the estimation of f . If Nc = 0 , Equation 4 can be rewritten as

D(q )vˆ(n) = e(n) (6)

© National Instruments 27 System Identification VIs


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) (7)
C (q )
Then a high order AR model is applied to estimate eˆ(n) . Since 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:
B(q ) C (q )
A(q ) y (n) = u (n − k ) + e( n ) (1)
F (q ) D(q )
Na
where A(q ) = 1 + ∑ ai q −i ,
i =1

N ib −1
B(q ) = [ B1 (q ), B2 (q ),...., BN (q )] and Bi (q ) = ∑b q
j =0
ij
−j
,

N if
F (q ) = [ F1 (q ), F2 (q ),...., FN (q )] and Fi (q ) = 1 + ∑ f ij q − j ,
j =1

B(q) B (q) B (q) B (q)


=[ 1 , 2 ,..., N ],
F (q) F1 (q) F2 (q ) FN (q )

System Identification VIs 28 ni.com


Algorithm References

u (n − k ) = [u1 (n − k1 ), u 2 (n − k 2 ),...., u N (n − k N )]T , N is the number of input channels,


Nc Nd
C ( q ) = 1 + ∑ c i q − i , D ( q ) = 1 + ∑ d i q −i ,
i =1 i =1

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 , a 2 ,...., a N a ] , [bij ] , [ f ij ] , [c1 , c2 ,...., c N c ] , and [d1 , d 2 ,...., d N d ] based on the input-
output data of a system.

3. APIs

Para Name In/Out Type Description


stimulus In 2D DBL Array The input signal of a system
signal
response In 1D DBL Array The output signal of a system
signal
model In Cluster containing A order, A order, B order, F order, C order, D
parameters B order, F order, C order, D order and delay are Na ,
order and delay. B order and
[ N 1b , N 2 b ,...., N Nb ] , [ N 1 f , N 2 f ,...., N Nf ] , N c ,
F order are 1D I32. A order ,
C order, D order and delay Nd and [ k 1 , k 2 ,...., k N ] , respectively.
are I32.
GL model Out Cluster A is [1, a1 , a2 ,...., a N a ] .
B is a matrix as

0,...0, b10 , b11 ,...., b1( N1b −1) 


 
0,...0, b20 , b21 ,...., b2 ( N 2 b −1)  . The
... 
 
0,...0, bN 0 , bN 1 ,...., 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 N 2 f 
 
... 
1, f N 1 , f N 2 ,...., f NN 
 Nf 
C is [1, c1 , c2 ,...., c N c ] and D is

© National Instruments 29 System Identification VIs


Algorithm References

[1, d1 , d 2 ,...., d N d ]
std Out Cluster The standard deviations of coefficients
deviations A, B, F, C, and D
noise Out DBL Variance of e(n)
variance
covariance Out 2D DBL Array -
matrix
noise Out 1D DBL Array e(n)

4. 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
C (q )
ε ( n) = F ( q ) e( n ) (2)
D(q )
and set Fi (q ) = 1 , then Equation 1 becomes

A(q ) F max (q ) y (n) = B(q )u (n − k ) + ε (n) (3)

where F max (q ) is the polynomial with maximum order in all Fi (q ) . You can apply ARX model

estimation methods to estimate B(q) and A(q ) F max (q ) . 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) (4)

Using 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 ) (5)
Fˆ (q ) D (q )

Here, as elsewhere, fˆ denote the estimation of f . If Nc = 0 , 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) (7)
C (q )

System Identification VIs 30 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.

b0 + b1 s... + b j s j ... + bm s m
H (s) = e − sTd , m ≤ n (2)
a0 + a1 s... + ai s ... + a n s
i n

where m is the numerator order, n is the denominator order, and Td 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 31 System Identification VIs


Algorithm References

transfer function denominator order


model
delay initial In DBL The initial guess of Td
guess (s)
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
delay (s) Out DBL The estimated Td

4. 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 / dt  G ( z ) (3)

where

v0 + v1 z + .... + v n z n
G (z ) = (4)
u 0 + u1 z + ... + u n z n
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 G ( z ) . 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 G ( z ) 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 b j are tuned by the Gauss-Newton
optimization method to minimize the following cost function:

System Identification VIs 32 ni.com


Algorithm References

N
1 1
VN =
N
∑2e
k =1
2
(k ) (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 (2)
a 0 + a1 z... + a n z n
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 Cluster Numerator is[b0 ,b1 ,..., bm ] ,
Denominator is [a0 , a1 ,..., a n ]
transfer function
model

© National Instruments 33 System Identification VIs


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.

bm ... + b1 z 1−m + b0 z − m
( )
H z −1 = z −( n−m )
an ... + a1 z 1−n + 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 Help 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
VIs use 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 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 Identification VIs 34 ni.com


Algorithm References

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 The name and optimized value of
variables each variable
number of 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:

2
1 N 1 2 1 N 1∧ 
VN (θ ) = ∑ e ( k , θ ) = ∑  y (k ,θ ) − y (k ) (1)
N k =1 2 N k =1 2  

where θ is the variable vector, y (k ,θ ) is the response the user-defined model subVI calculates,
and y (k ) 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:

xt +1 = Axt + But

© National Instruments 35 System Identification VIs


Algorithm References

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 space model

4. Algorithms
The impulse response of this system can be computed as

h0 = D , hk = CA k −1 B , k>0 (2)

The Hankel matrix is defined as

 hk +1 hk + 2 ... hk + j −1 hk + j 
h hk +3 ... ... 
 k +2
H ij (k ) =  hk +3 ...  (3)
 
 ... 
 hk +i ... ... ... hk +i + j 

H ij (k ) = Oi A k F j

where Oi and F j are the extended observability and controllability matrixes, respectively.

[
Oi = C CA ... CAi −1 , F j = B ]
T
[ AB ... A j −1 B ]
From the above equations, you can deduce:

H ij (0 ) = Oi F j , (4)

H ij (1) = Oi AF j (5)

Oi B = H i ,1 (0) , CF j = H 1, j (0 ) (6)

The SVD of H ij (0 ) is

V1T 
H ij (0 ) = [U 1 U 2 ] ∑ 1 [ ∑ ] 2  T  = U 1 ∑ 1V1
T
(7)
V2 
where ∑ 1 contains the n largest singular values, n is the model order, or number of states, and

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

System Identification VIs 36 ni.com


Algorithm References

From Equations 4 and 7, you can deduce:


1 1
Oi = U 1 ∑ 12 , Fi = ∑ 12 V1T [Ref 2] (8)

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


1 1
− −
A = ∑ 1 2 U 1T H i , j (1)V1 ∑ 1 2
1

B = ∑ 1 2 U 1T H i ,1 (0 )
1

C = H 1, j (0 )V1 ∑ 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 Ho’s
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 VIs is defined as

qxt = Axt + Bu t + Ket


y t = Cxt + Du t + 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 ut

and yt .

3. API
For SISO Case
Para Name In/Out Type Description

© National Instruments 37 System Identification VIs


Algorithm References

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 initial state
SS coef Out Cluster The coefficients of state space model, A, B, C,
and D
K 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 initial state
coefficients Out Cluster The coefficients of state space model system
of state- matrix, A, B, C, and D
space
K Out 2D DBL Array Kalman gain
X0 Out 1D DBL Array Initial States

4. 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  X t  T T 
A B
C D  = min  −
  Yt  C D  U t 
=
  Yt  t
[
X ,U t ]
 U [
   X t ,U t ]

 (1)
     t  
Where ↑ 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 X t .

A. Estimation of System Matrix


The System Identification VIs define the past and future Hankel data matrices in the following way:

System Identification VIs 38 ni.com


Algorithm References

 yt yt +1  yt + N −1   ut u t +1  u t + N −1 
 qy     
qyt +1  , U =  qu t qu t +1  
Yf =  
t

      f      
 f −1 f −1   f −1 
q yt q y y +1  q f −1 yt + N −1  q u u
f −1
q u t +1 f −1
 q u t + N −1 

 q −1 yt q −1 yt +1  q −1 yt + N − 2 q −1 yt + N −1 
 
      
q − p y q − p yt +1  q − p yt + N − 2 q yt + N −1 
−p
Z p =  −1 t  (2)
 q ut q −1ut +1  q −1u t + N − 2 q −1u t + N −1 
      
 −p −p −p

 q u t q u t +1  q ut + N −2 q − p u t + N −1 
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:

Y f = Γf X + H f U f + G f E f

Where Γ f is the extended system observability matrix.

 D 0 0 0 0
 C 
 CA 
 CB
 D 0 0 0 
Γf =   , H f =  CAB CB D 0 0,
    
 f −1       0
CA  CA B   CB
f − 2
D 

 I 0 0 0 0
 CK
 I 0 0 0
G f =  CAK CK I 0 0
 
     0
CA f −2 K   CK 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 , L y   = Lz Z p
 Yp 
Then you can have

Y f = Γ f Lz Z p + H f U f + G f E f

Project out U f by multiplying ∏U⊥ f and remove noise E f by multiplying Z Tp , you get

Y f ∏U⊥ f Z Tp = β z Z p ∏U⊥ f Z Tp

Where β z = Γ f Lz and Λ p is the extended system controllability matrix. β z can be estimated

using the QR decomposition equivalents for [U Tf , Z Tp , Y fT ] .

© National Instruments 39 System Identification VIs


Algorithm References

 R11 R12 R13 


[ f p
T
f ]
U , Z , Y = [Q1, Q2 , Q3 ] 0 R22 R23 
T T
(3)
 0 0 R33 

β z = R23
T T
R22 R22 R22

[ ] (4)
 
After obtaining the β z , you can estimate Γ f by performing SVD decomposition on β z weighted

with Z p .

 SVD
β z Z p = USV T

Γˆ f = U 1 (5)

Because you already obtained the estimation of β z and Γ̂ f , then you can estimate the state sequence
X t by solving β z Z p = Γ f X t . That is

(
X t = Γˆ Tf Γˆ f )
−1
Γˆ pT βˆ z Z p (6)

And also the qX t can be estimated similarly.

With the Yt , U t , X t and qX t you can solve the equation 1 to obtain A, B, C, and D.

B. Estimation of Kalman Gain K

From Y f ∏ ⊥ Z = Gf Ef
p
 
 U f 

You can get


T
R33 Q3T = G f E f
T
Where 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 = G ∗f E1 f

G ∗f E1 f = R33
T
Q3T

Because Q3T is an orthonormal matrix, you can choose E1 f = Q3T , then

G ∗f = R33
T

Then the Kalman gain K, actually KF, can be identified from the first block column of G ∗f , denoted

as G ∗f 1 ,

System Identification VIs 40 ni.com


Algorithm References

 F 
 CKF   I 0  F 
G ∗f 1 =   = m×m
    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 (7)
 

C. Estimation of Initial States X0

To write the equation Y f = Γ f X + H f U f + G f E f at t = 0,

Y f 0 = Γ f X 0 + H f U f 0 + G ∗f E1 f 0

You can first compute Y f 0 for zero initial states to obtain H f U f 0 by processing the stimulus

through the estimated system with X 0 = [0, , 0].


By removing 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 ) = G ∗f
−1
Γ 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.

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

© National Instruments 41 System Identification VIs


Algorithm References


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
signal
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
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
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, Ru , and cross-correlation between


input and output, R yu , are related with

R yu (τ ) = ∑ g (k ) Ru (k − τ ) (2)
k =0

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

Ru (τ ) = E[u (t )u (t − τ )] = αδ (τ ) (3)

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


Ryu (τ )
g (τ ) = (4)
α

Input Pre-Whitening
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 pre-
whitening filter are exactly the coefficients of the AR model of the input sequence.

System Identification VIs 42 ni.com


Algorithm References

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 VIs. If all Ru (τ ),τ > 0 are within the
confidence region, you have 99% confidence to say that the signal has been prewhitened.

Theoretically, the autocorrelation of a white noise is αδ (τ ) , 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

α 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.

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

© National Instruments 43 System Identification VIs


Algorithm References


y (n ) = ∑ h(k )u (n − k ) + e(n ) , (1)
k = −∞

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 represented as N t <0 and N t >=0 , respectively

impulse Out Cluster The estimated impulse response


response
standard Out Cluster The standard deviation of the estimated
deviation impulse response

4. 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(− N t <0 ) 
ϕ T ( p )  h(− N + 1) e( p − N t < 0 ) 
 T   <  e( p + 1 − N ) 
ϕ ( p + 1)
t 0

A=  , H =  , E = t <0 
, and
     
  h( N t >=0 + 1)   
ϕ T ( L − 1)  h( N t >=0 )  e( L − 1 − N t < 0 ) 
 
 y ( p − N t <0 ) 
 y ( p + 1 − N )
Y = t <0 

 
 
 y ( L − 1 − N t <0 ) 
ϕ (t ) = [u (t ) u (t − 1)... u (t − N t >=0 − N t <0 + 1)]T
p = N t >=0 + N t <0 − 1
L is the length of the signals.
By finding the optimal H, you can minimize the following cost function:
L −1− N t < 0
V= ∑ e (n )
n= p − Nt <0
2
(3)

System Identification VIs 44 ni.com


Algorithm References

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

[
H = AT A ] −1
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 ]−1

(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

R yu (τ ) = ∑ g (k ) Ru (k − τ ) (1)
k =0

where Ru is the autocorrelation of the input of a system, and R yu 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ω ) (2)

G (e jω ) is known as the frequency response of the system. 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 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
signal

© National Instruments 45 System Identification VIs


Algorithm References

Window In I32 Order of the prewhitening filter


length
num of freq In I32 Number of points of the frequency response
bins sequence
freq in log? In Boolean Boolean to select whether the frequency points are
distributed linearly or logarithmically
amplitude in In Boolean Boolean to determine whether the amplitude of the
dB? frequency response is in dB unit
sampling rate In DBL -
Amplitude Out XY Graph Amplitude of the frequency response
Response
Phase Out XY Graph Phase of the frequency response
Response
Std deviations Out Cluster The standard deviation of the amplitude and phase
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]:
ˆ N (ω )
Φ
Gˆ (e jω ) = N
yu
(3)
Φ u (ω )
ˆ
where
N −1
ˆ N (ω ) = 1
Φ ∑R (τ )e jωτ (4)
yu yu
N τ=0

N −1
ˆ N(ω ) = 1
Φ ∑ R (τ )e ωτ j
(5)
u u
N τ=0

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.
N −1
1
Φ yu (e jω ) =
N

τ
R
=0
yu (τ ) w(τ )e jωτ (6)

N −1
1
Φ u (e jω ) =
N

τ
R (τ ) w(τ )e ωτ
=0
u
j
(7)

w(τ ) 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
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.

System Identification VIs 46 ni.com


Algorithm References

Residual Spectrum
The spectrum of the residual of a system can be computed with [Equation 6.78, Ref 1]:
ˆ N (ω )
Φ
ˆˆN (ω ) = Φ N (ω ) −
Φ
yu
(8)
v y
ˆ N (ω )
Φ u

Standard Deviation of Frequency Response


The standard deviation of the frequency response estimation can be estimated with [Equation 6.59,
Ref 1]:
1 Φ (ω )
E | GˆˆN (e jω ) − EGN (e jω ) |2 = W (γ ) v (9)
N Φ u (ω )

where N is the signal length and W (γ ) = 0.75γ 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 s l )
∏ (1 + T s )∏ (1 + 2r s / ω + (s / w ) )
e − sTd (1)
h i j j j 2
s p
i j

s h K p (1 + a1s + ... + al s l )
∏ (1 + T s )∏ (1 + 2r s / ω + (s / w ) )
e − sTd (2)
i j j j 2
p
i j

Where K p is the static gain

Td is the time delay

© National Instruments 47 System Identification VIs


Algorithm References

Tpi is the first-order time constant

ωj 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:
Kp
e − sTd (3)
1 + Tp s
The special 2nd order model is represented as:
Kp
e − sTd (4)
1 + 2rs / ω + s 2 / ω 2

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
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 Td
den info Out Cluster The estimated denominator
information
static gain Out Numeric The estimated Kp

4. Algorithm

System Identification VIs 48 ni.com


Algorithm References

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:

2
1 N 1 1 N 1∧ 
VN (θ ) = ∑ e 2 (k ,θ ) = ∑  y (k ,θ ) − y (k ) (5)
N k =1 2 N k =1 2  

where θ is the variable vector, y (k ,θ ) is the predicted response, and y (k ) 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 State-
Space 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
yt = Cxt + Dut + et
The goal of this VI is to estimate a user-defined state-space model.

© National Instruments 49 System Identification VIs


Algorithm References

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 D.
variables Out 1D Cluster Array The name and optimized value of
each variable
Kalman gain Out 2D DBL Array The estimated K matrix
initial states Out 1D DBL Array The estimated initial states

4. 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:

2
1 N 1 2 1 N 1∧ 
VN (θ ) = ∑ e ( k , θ ) = ∑  y (k ,θ ) − y (k ) (1)
N k =1 2 N k =1 2  

where θ is the variable vector, y (k ,θ ) is the predicted response, and y (k ) 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
GL Model (MISO).vi. These VIs are located in the labview\vi.lib\addons\System
Identification\Online Estimation Subs.llb directory.

System Identification VIs 50 ni.com


Algorithm References

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 y (t | θ ) = ϕ T (t , θ )θ in a linear regression form.
where ϕ 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 )
P(t − 1)ψ (t )
L(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 )
P(t − 1)ψ (t )
L(t ) =
λ (t ) +ψ (t )T P(t − 1)ψ (t )
1  P(t − 1)ψ (t )ψ (t )T P(t − 1) 
P(t ) = − −
λ (t )  λ (t ) +ψ (t )T P(t − 1)ψ (t ) 
P (t 1)

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)


Na Nb Nc
where A(q ) = 1 + ∑ ai q −i , B(q) = ∑ b j q − j , C (q) = 1 + ∑ ci q −i and q is the shift operator,
i =1 j =0 i =1

which means

q − i y ( n) = y ( n − i ) .

© National Instruments 51 System Identification VIs


Algorithm References

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 − N a ), u (n − k ),..., u (n − k − N1,b ), ε (n − 1),..., ε (n − N c )]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 ) = −q − i y (t ), i = 1,..., N a
∂ai
∂ ^
C (q) y (t ) = − q − i u (t ), i = 0,..., N b
∂bi
∂ ^
C (q) y (t ) = −q − iε (t ), i = 0,..., N c
∂ci
According to the definition of regression vector ϕ (t , θ ) , you can have

C (q )ψ (t , ai ) = ϕ (t , ai ) , ϕ (t − k , ai ) = ϕ (t , ai + k )
That is

ψ (t , ai ) = ϕ (t , ai ) − c1ψ (t − 1, ai )−,,, −cN ψ (t − N c , ai )


c

= ϕ (t , ai ) − c1ψ (t , ai +1 )−,,, −cNcψ (t , ai + Nc )

C (q )ψ (t , bi ) = ϕ (t , bi ) , ϕ (t − k , bi ) = ϕ (t , bi + k )
That is

ψ (t , bi ) = ϕ (t , bi ) − c1ψ (t − 1, bi )−,,, −cN ψ (t − N c , bi )


c

= ϕ (t , bi ) − c1ψ (t , bi +1 )−,,, −cNcψ (t , bi + Nc )

C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is

System Identification VIs 52 ni.com


Algorithm References

ψ (t , ci ) = ϕ (t , ci ) − c1ψ (t − 1, ci )−,,, −cN ψ (t − N c , ci )


c

= ϕ (t , ci ) − c1ψ (t , ci +1 )−,,, −cNcψ (t , ci + Nc )

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
B(q)
y ( n) = u ( n − k ) + e( n )
F (q)
Nb Nf

where B(q ) = ∑ b j q , F (q ) = 1 + ∑ fi q − i and q is the shift operator, which means


−j

j =0 i =1

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 − N b )1 (n − 1), − w(n − 1),..., − w(n − N f )]T

where
w(t ) + f1w(t − 1) + f 2 w(t − 2) + ... + f N f w(t − N f )
= b0u (t − k ) + b1u (t − k − 1) + ... + b Nb u (t − k − N b )

θ 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 ) = −q − i u (t ), i = 0,..., N b
∂bi
∂ ^
F (q) y (t ) = −q − i w(t ), i = 1,..., N f
∂fi
According to the definition of regression vector ϕ (t , θ ) , you can have

© National Instruments 53 System Identification VIs


Algorithm References

F (q )ψ (t , bi ) = ϕ (t , bi ) , ϕ (t − k , bi ) = ϕ (t , bi + k )
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
B(q) C (q)
y ( n) = u (n − k ) + e( n )
F (q) D(q )
where
Nb Nf Nc Nd
B(q ) = ∑ b j q , F (q ) = 1 + ∑ fi q − i , C (q ) = 1 + ∑ ci q − i , D(q ) = 1 + ∑ di q − i and q is
−j

j =0 i =1 i =1 i =1

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 − N b )1 (n − 1), − w(n − 1),..., − w(n − N f ),
ε (n − 1),..., ε (n − N c ), −v(n − 1),..., −v(t − N d )]T

where
w(t ) + f1w(t − 1) + f 2 w(t − 2) + ... + f N f w(t − N f )
= b0u (t − k ) + b1u (t − k − 1) + ... + b Nb u (t − k − N b )

v(t ) + d1v(t − 1) + d 2 v(t − 1) + ... + d nd v(t − N d )


= e(t ) + c1e(t ) + c2 e(t − 2) + ... + cn c e(t − N c )

System Identification VIs 54 ni.com


Algorithm References

θ is the parametric vector with model parameters:

[b0 ,..., bNb , f1 ,..., f N f , c1 ,..., cNc , d1 ,..., d Nd ]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 ∂d Nd
where
∂ ^
C (q) F (q) y (t ) = D(q )q − i u (t ), i = 0,..., N b
∂bi
∂ ^
C (q) F (q) y (t ) = − D(q )q − i w(t ), i = 1,..., N f
∂fi
∂ ^
C (q) y (t ) = q − iε (t ), i = 1,..., N c
∂ci
∂ ^
C (q) y (t ) = −q − i v(t ), i = 0,..., N d
∂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 , bi + k ) ,
If you define C ( q ) F ( q ) = G ( q ) , that is

ψ (t , bi ) = ϕ (t , bi ) + d1ϕ (t − 1, bi )+,..., d N ϕ (t − N d , bi ) − g1ψ (t − 1, bi )−,,, − g N ψ (t − N g , bi )


d g

= ϕ (t , bi ) + d1ϕ (t , bi +1 )+,..., d Nd ϕ (t , bi + Nd ) − g1ψ (t , bi +1 ) −,,, − g N gψ (t , bi + N g )

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 − N d , fi ) − g1ψ (t − 1, fi )−,,, − g N ψ (t − N g , fi )


d g

= ϕ (t , fi ) + d1ϕ (t , fi +1 )+,..., d Nd ϕ (t , fi + Nd ) − g1ψ (t , fi +1 )−,,, − g N gψ (t , fi + N g )

C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is

ψ (t , ci ) = ϕ (t , ci ) − c1ψ (t − 1, ci )−,,, −cN ψ (t − N c , ci )


c

= ϕ (t , ci ) − c1ψ (t , ci +1 )−,,, −cNcψ (t , ci + Nc )

C (q )ψ (t , di ) = −ϕ (t , di ) , ϕ (t − k , di ) = ϕ (t , di + k )
That is

© National Instruments 55 System Identification VIs


Algorithm References

ψ (t , di ) = −ϕ (t , di ) − c1ψ (t − 1, di )−,,, −cN ψ (t − N c , di )


c

= −ϕ (t , di ) − c1ψ (t , di +1 )−,,, −cNcψ (t , di + Nc )

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
Bi (q ) C (q)
A(q ) y (n) = ∑ ui (n − k ) + e( n )
i =1 Fi (q ) D(q )
Na
where A(q ) = 1 + ∑ ai q −i ,
i =1

Ni ,b −1 Nc Nd Ni , f

Bi (q ) = ∑ bi , j q − j , C (q ) = 1 + ∑ ci q − i , D(q ) = 1 + ∑ di q − i F (q ) = 1 + ∑ fi , j q − j and
j =0 i =1 i =1 j =1

q is the shift operator, which means

q − i y ( n) = y ( n − i ) .
k is the delay of the system. N a , N i ,b , N c , N d , N i , 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 − N a ),
u1 (n − k ),..., u1 (n − k − N1,b ),..., unu ( n − k ),..., unu ( n − k − N nu ,b ),
− w1 (n − 1),..., − w1 (n − N1, f ),..., − wnu (n − 1),..., − wnu (n − N nu , f ),
ε (n − 1),..., ε (n − N c ), −v(n − 1),..., −v(t − N d )]T

where
wi (t ) + fi ,1wi (t − 1) + fi ,2 wi (t − 1) + ... + fi ,n f 1 wi (t − N i , f )
= bi,1ui (t − ki ) + bi,2ui (t − ki − 1) + ... + bi,n b1 ui (t − ki − N i ,b + 1)

v(t ) + d1v(t − 1) + d 2 v(t − 1) + ... + d nd v(t − N d )


= e(t ) + c1e(t ) + c2 e(t − 2) + ... + cn c e(t − N c )

θ is the parametric vector with model parameters:

[a1 ,..., aNa , b1,0 ,..., b1, N1,b ,..., bnu ,0 ,..., bnu , Nn ,b , f1,1 ,..., f1, N1, f ,..., f nu ,1 ,..., f nu , Nn , f , c1 ,..., cNc , d1 ,..., d Nd ]T
u u

Algorithm Reference

System Identification VIs 56 ni.com


Algorithm References

^
ψ (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 , Nn ,b
u

∂ ^ ∂ ^ ∂ ^ ∂ ^
y (t ),..., y (t ),..., y (t ),..., y (t ),
∂f1,1 ∂f1, N f ∂f nu ,1 ∂f nu , Nn , f
u

∂ ^ ∂ ^ ∂ ^ ∂ ^
y (t ),..., y (t ), y (t ),..., y (t )]
∂c1 ∂cNc ∂d1 ∂d Nd
where
∂ ^
C (q) y (t ) = − D(q )q − i y (t ), i = 0,..., N a
∂ai
∂ ^
C (q) F (q) y (t ) = D(q )q − j ui (t ), i = 1,..., nu , j = 0,..., N i ,b
∂bi , j
∂ ^
C (q) F (q) y (t ) = − D(q )q − j wi (t ), i = 1,..., nu , j = 1,..., N i , f
∂fi , j
∂ ^
C (q) y (t ) = q − iε (t ), i = 1,..., N c
∂ci
∂ ^
C (q) y (t ) = −q − i v(t ), i = 1,..., N d
∂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 , ai + k ) .If defines


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

ψ (t , ai ) = ϕ (t , ai ) + d1ϕ (t − 1, ai )+,..., + d N ϕ (t − N d , ai ) − g1ψ (t − 1, ai )−,,, − g N ψ (t − N g , ai )


d g

= ϕ (t , ai ) + d1ϕ (t , ai +1 )+,..., + d Nd ϕ (t , ai + Nd ) − g1ψ (t , ai +1 )−,,, − g N gψ (t , ai + N g )

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 )

© National Instruments 57 System Identification VIs


Algorithm References

That is

ψ (t , bi , j ) = ϕ (t , bi , j ) + d1ϕ (t − 1, bi , j )+,..., d N ϕ (t − N d , bi , j ) − gi ,1ψ (t − 1, bi , j )−,,, − gi , N ψ (t − N g , bi , j )


d g

= ϕ (t , bi , j ) + d1ϕ (t , bi , j +1 )+,..., d Nd ϕ (t , bi , j + Nd ) − gi ,1ψ (t , bi , j +1 )−,,, − gi , N gψ (t , bi , j + N g )

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 − N d , fi , j ) − g n ,1ψ (t − 1, fi , j )−,,, − g n , N ψ (t − N g , fi , j )


d g

= ϕ (t , fi , j ) + d1ϕ (t , fi , j +1 )+,..., d Nd ϕ (t , fi , j + Nd ) − g n ,1ψ (t , fi , j +1 )−,,, − g n , N gψ (t , fi , j + N g )

C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is

ψ (t , ci ) = ϕ (t , ci ) − c1ψ (t − 1, ci )−,,, −cN ψ (t − N c , ci )


c

= ϕ (t , ci ) − c1ψ (t , ci +1 )−,,, −cNcψ (t , ci + Nc )

C (q )ψ (t , di ) = −ϕ (t , di ) , ϕ (t − k , di ) = ϕ (t , di + k )
That is

ψ (t , di ) = −ϕ (t , di ) − c1ψ (t − 1, di )−,,, −cN ψ (t − N c , di )


c

= −ϕ (t , di ) − c1ψ (t , di +1 )−,,, −cNcψ (t , di + Nc )

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.

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

System Identification VIs 58 ni.com


Algorithm References

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
Bi (q ) C (q)
A(q ) y (n) = ∑ ui (n − k ) + e( n )
i =1 Fi (q ) D(q )
Na
where A(q ) = 1 + ∑ ai q −i ,
i =1

Ni ,b −1 Nc Nd Ni , f

Bi (q ) = ∑b
j =0
i, j q −j
, C (q) = 1 + ∑c q
i =1
i
−i
, D(q) = 1 + ∑d q
i =1
i
−i
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. N a , N i ,b , N c , N d , N i , 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 − N a ),
u1 (n − k ),..., u1 (n − k − N1,b ),..., unu ( n − k ),..., unu ( n − k − N nu ,b ),
− w1 (n − 1),..., − w1 (n − N1, f ),..., − wnu (n − 1),..., − wnu (n − N nu , f ),
ε (n − 1),..., ε (n − N c ), −v(n − 1),..., −v(t − N d )]T

where
wi (t ) + fi ,1wi (t − 1) + fi ,2 wi (t − 1) + ... + fi ,n f 1 wi (t − N i , f )
= bi,1ui (t − ki ) + bi,2ui (t − ki − 1) + ... + bi,n b1 ui (t − ki − N i ,b + 1)

v(t ) + d1v(t − 1) + d 2 v(t − 1) + ... + d nd v(t − N d )


= e(t ) + c1e(t ) + c2 e(t − 2) + ... + cn c e(t − N c )

θ is the parametric vector with model parameters:

[a1 ,..., aNa , b1,0 ,..., b1, N1,b ,..., bnu ,0 ,..., bnu , Nn ,b , f1,1 ,..., f1, N1, f ,..., f nu ,1 ,..., f nu , Nn , f , c1 ,..., cNc , d1 ,..., d Nd ]T
u u

Algorithm Reference
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.

© National Instruments 59 System Identification VIs


Algorithm References

Response computation
From the definition of general linear model, the response y (n) can be computed using the
following steps:
1) IIR filtering stimulus u (t ) with coefficients of B (q ) being forward coefficients and
coefficients of F (q ) being backward coefficients.
2) IIR filtering noise e(t ) with coefficients of C (q ) being forward coefficients and coefficients of
D(q ) 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 d -dimension vector θ be an estimate with mean θ 0 , and its covariance matrix
^
be P . If f (θ 0 ) is the p -dimensional random variable, asymptotically as θ becomes sufficiently

close to θ 0 , you can have 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


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

derivative matrix of y ' (n, θ ) .

Matrix y
'
(n, θ ) computation

System Identification VIs 60 ni.com


Algorithm References

∂ 1 −j
y ( n) = − q y (n) = q − j ya (n), j = 1,..., N a
∂a j A(q )
∂ 1
y ( n) = q − j ui (n − k ) = q − j ubi (n − k ), j = 0,..., N i ,b
∂b(i , j ) A(q ) Fi (q )
∂ Bi (q )
y ( n) = − q − j ui (n − k ) = q − j u fi (n − k ), j = 1,..., N i , f
∂f (i , j ) A(q ) Fi (q ) Fi (q )

∂ 1
y ( n) = q − j e(n) = q − j ec (n), j = 0,..., N c
∂c j A(q ) D(q )
∂ C (q)
y ( n) = − q − j e(n) = q − j e f (n), j = 0,..., N d
∂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 ) being forward coefficients and

coefficient of 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 ) being forward coefficients and
coefficient of A(q ) D(q ) D (q ) being backward coefficients.

Define the Vector


− N1,b − N nu ,b
yvec ' (n, θ ) = [q −1 ya (n),..., q − Na ya (n), ub1 (n − k ),..., q ub1 (n − k ),..., ubnu (n − k ),..., q ubnu ( n − k ),...,
− N1, f − N nu , f
q −1u f 1 (n),..., q u f 1 (n),..., q −1u f nu (n),..., q u f nu (n),
−N f
q −1ec (n),..., q − Nc ec (n), q −1e f (n),..., q e f (n)]
= [ ya (n − 1),..., ya (n − N a ), ub1 (n − k ),..., ub1 (n − k − N1,b ),..., ubnu (n − k ),..., ubnu (n − k − N nu ,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 − N nu , f ),
ec (n − 1),..., ec (n − N c ), e f (n − 1),..., e f (n − N f )]

The derivative matrix therefore is defined as

© National Instruments 61 System Identification VIs


Algorithm References

 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

y1 (t ) + a111 y1 (t − 1) + a112 y1 (t − 2) + ... + a11n a y1 (t − n11a )


11

+ a121 y2 (t − 1) + a122 y2 (t − 2) + ... + a12 n a y2 (t − n12a )


12

+ ...
+ a1N y 1 y N y (t − 1) + a1N y 2 y N y (t − 2) + ... + a1N a y N y (t − n1aN y )
y n1 N y

= b111u1 (t − k11 ) + b112u1 (t − k11 − 1) + ... + b11n b u1 (t − k11 − n11b + 1)


11

+ b121u2 (t − k12 ) + b122u2 (t − k12 − 1) + ... + b12 n b u2 (t − k12 − n12b + 1)


12

+ ...
+ b1N u 1u N u (t − k1Nu ) + b1N u 2u N u (t − k1Nu − 1) + ... + b1N b u N u (t − k1Nu − n1bN u + 1)
u n1 N u

+ e1 (t )

System Identification VIs 62 ni.com


Algorithm References

y2 (t ) + a221 y2 (t − 1) + a222 y2 (t − 2) + ... + a22 n a y2 (t − n22


a
)
22

+ a211 y1 (t − 1) + a212 y1 (t − 2) + ... + a21n a y1 (t − n21


a
)
21

+ ...
+ a2 N y 1 y N y (t − 1) + a2 N y 2 y N y (t − 2) + ... + a2 N a y N y (t − n2aN y )
y n2 N y

= b211u1 (t − k21 ) + b212u1 (t − k21 − 1) + ... + b21n b u1 (t − k21 − n21


b
+ 1)
21

+ b221u2 (t − k22 ) + b222u2 (t − k22 − 1) + ... + b22 n b u2 (t − k22 − n22


b
+ 1)
12

+ ...
+ b2 N u 1u N u (t − k2 Nu ) + b2 N u 2u N u (t − k2 Nu − 1) + ... + b2 N b u N u (t − k2 Nu − n2bN u + 1)
u n 2 Nu

+ e2 (t )

y N y (t ) + a N y N y 1 y N y (t − 1) + a N y N y 2 y N y (t − 2) + ... + a N a y N y (t − nNa y N y )
y N y nN yN y

+ a N y 11 y1 (t − 1) + a N y 12 y1 (t − 2) + ... + a N a y1 (t − nNa y 1 )
y 1n N y 1

+ ...
+ a N y ( N y −1)1 y( N y −1) (t − 1) + a N y ( N y −1) 2 y( N y −1) (t − 2) + ... + a N ( N y −1) n Na y ( N y −1)
y( N y −1) (t − nNa y ( N y −1) )
y

= bN y 11u1 (t − k N y 1 ) + bN y 12u1 (t − k N y 1 − 1) + ... + bN b u1 (t − k N y 1 − nNb y 1 + 1)


y 1n 21

+ bN y 21u2 (t − k N y 2 ) + bN y 22u2 (t − k N y 2 − 1) + ... + bN b


2 n12
u2 (t − k N y 2 − nNb y 2 + 1)
y

+ ...
+ bN y N u 1u N u (t − k N y Nu ) + bN y N u 2u N u (t − k N y Nu − 1) + ... + bN b u N u (t − k N y Nu − nNb y N u + 1)
y N u n 2 Nu

+ eN y (t )

From the model definition, the response of y1 (t ),..., y N y (t ) , coefficients of the model, stimulus

u1 (t ),..., u Nu (t ) and noise e1 (t ),..., eN y (t ) 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 63 System Identification VIs


Algorithm References

For MIMO System

 u1 (t ) 
 u (t ) 
U (t ) is input vector. U (t ) =   , t = 1, 2,..., N , n is the number of inputs, N is the
2

   u

 
unu (t ) 
sample number.

 y1 (t ) 
 y (t ) 
Y (t ) is output vector. Y (t ) =   , t = 1, 2,..., N , n is the number of outputs, N is the
2

   y

 
 yny (t ) 
sample number.

 e1 (t ) 
 e (t ) 
E (t ) is noise disturbance vector. E (t ) =   , t = 1, 2,..., N
2

  
 
e (t )
 ny 
 x1 (t ) 
 x (t ) 
X (t ) is state vector. X (t ) =   , t = 1, 2,..., N , n is the number of states
2

   x

 
 xnx (t ) 
A is nx × nx state transmission matrix. B is nx × nu input gain matrix. C is n y × nx output gain

matrix. D is n y × nu direct-input gain matrix. K is nx × n y 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 1 n y nx 
Where

System Identification VIs 64 ni.com


Algorithm References

gij ( z ) is polynomial fraction in delay operator z −1 :

β n z n + β n −1 z n −1 + ... + β1 z1 + β 0
gij ( z ) =
α m z m + α m −1 z m −1 + ... + α1 z1 + α 0
i indicates ith output in MIMO system.
j indicates jth input in MIMO system.

 u1 (t ) 
 u (t ) 
U (t ) is input vector. U (t ) =   , t = 1, 2,..., N , n is the number of inputs, N is the
2

   u

 
unu (t ) 
sample number.

 y1 (t ) 
 y (t ) 
Y (t ) is output vector. Y (t ) =   , t = 1, 2,..., N , n is the number of outputs, N is the
2

   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,.., N u

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 65 System Identification VIs


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 ) + [1 − Wk (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
Bi (q ) C (q)
A(q ) y (t ) = ∑ ui (t − k ) + e(t )
i =1 Fi (q ) D(q)
where
Na Ni ,b −1 Nc Nd
A(q ) = 1 + ∑ ai q −i , Bi (q ) = ∑ bi , j q − j , C (q ) = 1 + ∑ ci q − i , D(q ) = 1 + ∑ di q − i
i =1 j =0 i =1 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. N a , N i ,b , N c , N d , N i , 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
Bi (q ) C (q)
Gi (q ) = , i = 1,..., N u , H (q ) =
A(q ) Fi (q ) A(q ) D(q )
The k-step-ahead prediction of y (t ) can be reformed as

^ nu
H k (q ) Bi (q ) ∏ Fj (q )D(q ) C (q) ∏ Fi (q ) − H k (q ) A(q ) D (q ) ∏ Fi (q )
y (t | t − k ) = ∑
j =1,.., nu j =1,.., nu j =1,.., nu
ui (t ) + y (t )
i =1 Fi (q )C (q ) ∏
j =1,.., nu
Fj (q) C (q) ∏
j =1,.., nu
Fi (q )

System Identification VIs 66 ni.com


Algorithm References

C (q) ∏
j =1,.., nu
Fj (q)
H k (q ) can be computed by H k (q ) = = g (qn ), n = 1,..., k
A(q ) D(q ) ∏
j =1,.., nu
Fj (q )

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

C (q) ∏ Fj (q)

j =1,.., nu
with coefficients of C (q) Fj (q ) being forward coefficients and
A(q ) D(q ) ∏
j =1,.., nu
Fj (q ) j =1,.., nu

A(q ) D(q ) ∏
j =1,.., nu
Fj (q ) being backward coefficients.

So the k-step-ahead prediction of y (t ) can be computed by IIR filtering ui (t ) with coefficients of

H k (q ) Bi (q ) ∏
j =1,.., nu
Fj (q )D(q )
being forward coefficients and coefficients of

Fi (q )C (q ) ∏
j =1,.., nu
Fj (q)
y (t ) with coefficients
being backward coefficients, and by IIR filtering

C (q) ∏
j =1,.., nu
Fi (q ) − H k (q ) A(q ) D(q ) ∏
j =1,.., nu
Fi (q )
of being forward coefficients and

C (q) ∏
j =1,.., nu
Fi (q )
coefficients of 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 ) 
U (t ) is the input vector. U (t ) =   , t = 1, 2,..., N , n is the number of inputs, N is the
2

   u

 
unu (t ) 
sample number.

© National Instruments 67 System Identification VIs


Algorithm References

 y1 (t ) 
 y (t ) 
Y (t ) is the output vector. Y (t ) =   , t = 1, 2,..., N , n is the number of outputs, N is
2

   y

 
 yny (t ) 
the sample number.

 e1 (t ) 
 e (t ) 
E (t ) =   , t = 1, 2,..., N
2
E (t ) is the noise disturbance vector.
  
 
e (t )
 ny 
 x1 (t ) 
 x (t ) 
X (t ) is the state vector. X (t ) =   , t = 1, 2,..., N , n is the number of states
2

   x

 
 xnx (t ) 
A is nx × nx state transmission matrix. B is nx × nu input gain matrix. C is n y × nx output gain

matrix. D is n y × nu direct-input gain matrix. K is nx × n y 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 VIs 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 −1 BU (t ) + CAk − 2 BU (t + 1) + ...
+CBU (t + k − 1) + DU (t + k )
+CAk −1 KE (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 −1 B, 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 −1 B, CAk − 2 B,..., D][U (t ), U (t + 1),..., U (t + k )]T

The formula can be reformed as

 ^ 
 X (1 − k )   U (1 − k ), U (1 − k + 1),..., U (1) 
T
 Y (1) 
 ^ ^  X (2 − k )   
 Y (1)  Y (t + k ) = CAk   + [CAk −1 B, CAk − 2 B,..., D]  U (2 − k ), U (2 − k + 1),..., U (2) 
        
     
Y^ ( N )   X ( N − k ) U ( N − k ),U ( N − k + 1),...,U ( N ) 
 

 U (1 − k ), U (1 − k + 1),..., U (1) 
T

 U (2 − k ), U (2 − k + 1),..., U (2) 
[CA B, CA B,..., D] 
k −1 k −2  can be computed by FIR
  
 
U ( N − k ), U ( N − k + 1),..., U ( N ) 
filtering [U (1), U (2),..., U ( N )] with coefficients of [CAk −1 B, 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 69 System Identification VIs


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 In/Out Type Description
prediction In 1D CDB Array Prediction error e
error
input signal u In 2D DBL Array Input signal u
cov(e) Out 1D CDB Array Normalized auto-correlation function of the
prediction errors
confidence of Out DBL Confidence of cov(e)
cov(e)
cov(u, e) Out 2D DBL Array Normalized cross-correlation function of the
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]

• cov e (τ )
The auto-correlation of prediction error is defined as
N
1
ReN (τ ) =
N
∑ e(t )e(t − τ )
t =1
(1)

System Identification VIs 70 ni.com


Algorithm References

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


1
cov e (τ ) = ReN (τ ) (2)
λ
N
1
where λ=
N
∑e
t =1
2
(t ) = ReN (0) , which is the variance of the prediction error.

• Confidence of cov e (τ )

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

the auto-correlation of prediction error, ReN (τ ) , is a zero mean Gaussian distribution

with variance λ2 / N . So the confidence interval of the ReN (τ ) is


λ
Na (3)
N
where Nα denotes the α level of the normalized Gaussian distribution , N (0,1) , and

α = 0.99% in this problem. Then the confidence interval of cov e (τ ) is


1
Na (4)
N
• cov eu (τ )
The cross-correlation between the prediction error, e(t), and the input signal, u(t), is
defined as
N
1
ReuN (τ ) =
N
∑ e(t )u (t − τ )
t =1
(5)

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


1
cov eu (τ ) = ReuN (τ ) (6)
N N
R (0) R (0)
e u

• Confidence of cov eu (τ )

Since N ReuN (τ ) is a zero mean Gaussian distribution with variance P1 [Eq. (16.64),
P.513, Ref 1], where
N
P1 = ∑R
k =− N
N
e (k ) RuN (k ) (7)

The auto-correlation of prediction error, ReuN (τ ) , is a zero mean Gaussian distribution

with variance P1 / N . So the confidence interval of ReuN (τ ) is

P1
Na (8)
N
And then the confidence interval of cov eu (τ ) is

© National Instruments 71 System Identification VIs


Algorithm References

1 P1
Na (9)
ReN (0) RuN (0) N

5. 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 In/Out Type Description
system model in In SI object Contains the information of the model to be
converted.
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.

4. 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 ) a1q −1 +  + am q − m
Gi (q ) = = (1)
A(q ) Fi (q ) 1 + b1q −1 +  + bm q − m

It gives equivalent transfer function model to multiply q m on the nominator and denominator of
Gi (q ) as

a1q m −1 +  + qm
Gi (q ) = (2)
q m + b1q m −1 +  + bm

System Identification VIs 72 ni.com


Algorithm References

The transfer function between the noise and output of a MISO general linear model is
C (q)
H (q) = (3)
D(q)
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 )
(4)
y (t ) = Cx(t ) + Du (t ) + e(t )
Performing Z transform on the state-space equations yields
( zI ) X ( z ) = AX ( z ) + BU ( z ) + KE ( z )
(5)
Y ( z ) = CX ( z ) + DU ( z ) + E ( z )
So

X ( z ) = ( zI − A) −1[ BU ( z ) + KE ( z )]
Then
Y ( z)
G( z) = = C ( zI − A) −1 B + D (6)
U ( z)
Y ( z)
H ( z) = = C ( zI − A) −1 K + I (7)
E( z)
Further [Ref 1]
where
det( zI − A + BC ) − det( zI − A)
C ( zI − A) −1 B =
det( zI − A)
and det( zI − A) is the characteristic polynomial of matrix A .

The equivalent transfer function representation for the determinant part can be presented as
det( zI − A + BC ) + det( zI − A)( D − 1)
G ( z ) = C ( zI − A) −1 B + D = (8)
det( zI − A)
Each column vector of B is for one input. Each row vector of C is for one output. By selecting
column by column of 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


det( zI − A + KC ) + det( zI − A)( I − 1)
H ( z ) = C ( zI − A) −1 K + I = (9)
det( zI − A)

5. Reference

© National Instruments 73 System Identification VIs


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 In/Out Type Description
system model in In SI object Contains the information of the model to be
converted.
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.

4. 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 1 n y nu 
Where

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

an q n + an −1q n −1 + ... + a1q1 + a0


gij ( z ) =
bm q m + bm −1q m −1 + ... + b1q1 + b0
i indicates the ith output in MIMO system.

System Identification VIs 74 ni.com


Algorithm References

j indicates the jth input in MIMO system.

G ( z ) can be reformed as

An q n + An −1q n −1 + ... + A1q1 + A0


G (q) =
Bm q m + Bm −1q m −1 + ... + B1q1 + B0
where A0 ,..., An , B0 ,..., Bm is n y  nu matrix.

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

 − Am −1 1 0 ... 0  Bm −1 − Am −1 Bm 
− A 0 1 ... 0  B − A B 
[ ]  m−2
A =
  ... 
[ ]  m−2  m−2 m 
B =
   
 − A0 0 0 ... 0  B0 − A0 Bm 
[C ] = [1 0  0] [ D ] = [ Bm 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  N a )  B0u (t  k )  ...  BNb u (t  k  N b )  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 n y  n y matrix, B0 ,..., BNb is

n y  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.

B0 qk  ...  BNb qk Nb B0 q 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 75 System Identification VIs


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 Type Description
system model in In SI object Contains the information of the model to be
converted.
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.

4. 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 1 n y nu 
where gij (q ) is the polynomial fraction in delay operator q −1 , represented in terms of the zeros,

poles, and the transfer function gain K , where the static gain K s can be computed from

K s = G (1) .
n −1
K ∏ (q − qi )
gij (q ) = i =0
m −1

∏ (q − q )
i =0
i

i indicates the ith output in a MIMO system.

System Identification VIs 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 ) , of a system can be computed from the estimated
^
coefficients θN of a linear polynomial model, such as an AR, ARX, ARMAX, OE, BJ or GL
^
model. Given that the standard deviation of θN is known, the purpose of this VI is to compute the

standard deviation of the magnitude, ( )


G e jω , and phase, arg G ( e jω ) , of the frequency

response function, G (e jω ) .

3. APIs
Para Name In/Out Type Description
freq response In 1D CDB Array Frequency response
w In 1D DBL Array Complex frequency response G (e jω )
transfer In Cluster Alpha is the numerator of the transfer function.
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.
Alpha, Beta 1

© National Instruments 77 System Identification VIs


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 Cluster Standard deviation of frequency response
deviation 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
B(q) C (q)
A(q ) y (t ) = u (t ) + e(t ) (1)
F (q) D(q)
The frequency response between the input and output of the system is

B(e jω )
G (e jω ) = (2)
A(e jω ) F (e jω )
The general linear model (MISO) is defined as
N
Bi (q ) C (q)
A(q ) y (t ) = ∑ ui (t ) + e(t ) (3)
i =1 Fi (q ) D(q)
The frequency response for i-th input and output is

Bi (e jω )
Gi (e jω ) = (4)
A(e jω ) Fi (e jω )

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 VIs 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. f (θ 0 ) is the

magnitude or phase of frequency response function G (e jω ) . 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
∂ ∂
Parg G = Cov(arg(G (e jω ))) = arg(G (e jω )) ⋅ Pθ ⋅ arg(G (e jω ))T (7)
θ θ
Since Pθ and G (e jω ) 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ω ) with respect to θ . To derive | G (e jω ) | and
θ
∂ ∂
arg(G (e jω )) , you can derive G (e jω ) as the following.
θ θ

Derivative of G (e jω ) , | G (e jω ) | and arg G (e jω ) with respect to θ


The derivative of G (e jω ) with respect to θ at frequency ω1 is a vector defined as

∂ ∂ ∂ ∂
G (e jω1 ) = [ G (e jω1 ), G (e jω1 ),..., G (e jω1 ),
∂θ ∂a1 ∂a2 ∂aNa
∂ ∂ ∂
G (e jω1 ), G (e jω1 ),..., G (e jω1 ), (7)
∂b1 ∂b2 ∂bNb
∂ ∂ ∂
G (e jω1 ), G (e jω1 ),..., G (e jω1 )]
∂f1 ∂f 2 ∂f N f
where

∂ G (e jω1 ) jω1 − k
G (e jω1 ) = − (e ) , k = 1, 2,..., N a ,
∂ak A(e jω1 )

∂ G (e jω1 ) jω1 − k
G (e jω1 ) = (e ) , k = 1, 2,..., N b ,
∂bk B(e jω1 )

© National Instruments 79 System Identification VIs


Algorithm References

∂ jω1 G (e jω1 ) jω1 − k


G (e ) = − (e ) , k = 1, 2,..., N f .
∂f k F (e jω1 )

The derivative of G (e jω ) is defined as

 ∂ jω1 
 ∂θ G (e ) 
 
 ∂ jω2 
∂ G (e )
G (e jω ) =  ∂θ  (8)
∂θ  
 .... 
 ∂ jω Nω 
 G (e )
 ∂θ 

Since G (e jω ) = G (e jω ) × G (e jω ) , the derivative of | G (e jω ) | is

∂ 1  ∂ ∂ 
( G (e jω ) ) = jω jω
 (G (e )). ∗ G (e ) + (G (e jω )). ∗ G (e jω ) 
∂θ 2* G (e jω )  ∂θ ∂θ 
(9)
1  ∂ 
= ℜ  (G (e jω )). ∗ G (e jω ) 
G (e )  ∂θ

where G (e jω ) is the conjugate of G (e jω ) . Because arg G (e jω ) = ℑ ln G (e jω )  , the

derivative of arg(G (e jω )) is
∂  ∂ 
arg G (e jω ) = ℑ  G (e jω )./ G (e jω )  (10)
∂θ  ∂θ 

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ω ) | and arg G (e jω ) .
The diagonal of the covariance matrix is the variance of the vector | G (e jω ) | and arg G (e jω ) .

5. 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 VIs 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 Type Description
polynomial In 1D DBL Array The roots of a polynomial
coefficients
covariance In 2D DBL Array A matrix containing the covariance of
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 θ becomes sufficiently close to

θ 0 , you can have 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 81 System Identification VIs


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 x n + ... + an −1 x + 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 
∂an 
 0 
     (2)
 
 ∂xn 
∂xn 
 ∂an ∂an 

where xi are the roots and ai are the coefficients of the polynomial. However, this document uses

 ∂xi 
  elsewhere to denote derivative matrix of Equation 2.

 k
a

3. 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 VIs 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 .

x n + b1 x n −1 + ... + bn −1 x + bn = ( x − x1 ) ... ( x − xn ) = 0 (3)

From the Vieta Theorem, you can have

 b1 = (−1)∑ xi
 i
 b = xx
 2 ∑ i j
 i≠ j (4)
 

bn = (−1) n x1...xn
or

bp = (−1) p ∑x
k1 ...k p
k1 ...xk p , p = 1, 2,..., n (5)
ki ≠ k j

You therefore can have


∂b1
= −1, q = 1, 2,..., n (6)
∂xq
and

∂bp
∂xq
= (−1) p ∑
k1 ...k p −1
xk1 ...xk p−1
ki ≠ k j
ki ≠ q

 
 
p
 k1∑
= (−1) xk1 ...xk p−1 − xq ∑ xk1 ...xk p−2 
...k p −1 k1 ...k p −2 . (7)
 ki ≠ k j ki ≠ k j 
 ki ≠ q 
 ∂bp −1 
= (−1) p (−1) p −1 bp −1 − (−1) p −1 xq 
 ∂xq 
∂bp −1
= −bp −1 + xq
∂xq
For a common polynomial

a0 x n + ... + an −1 x + an = a0 ( x − x1 )( x − x2 )...( x − xn ) (9)

you can rewrite it as

x n + b1 x n −1... + bn −1 x + bn = ( x − x1 )( x − x2 )...( x − xn ) (10)

where

aj
bj = , j = 1, 2,..., n .
a0
You therefore can have

© National Instruments 83 System Identification VIs


Algorithm References

∂xi 1 n ∂x
= − 2 ∑ ak i (11)
∂a0 a0 k =1 ∂bk
∂xi 1 ∂xi
= , k = 1, 2,..., n (12)
∂ak a0 ∂bk

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
dup
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
of the roots

4. Algorithms
For a complex number, z , you can denote its real part as a and its imaginary part as b . Then, z
can be written as a + bi . Thus, you can have
E ( z ) = E (a ) + E (b)i ,
where E ( z ) means the expectation value of z .

System Identification VIs 84 ni.com


Algorithm References

Thus,

D( z ) = E ( z − E ( z )) 2 = E (a − E (a )) 2 − E (b − E (b)) 2 − 2 E (a − E (a ))(b − E (b))i


(1)
= D(a ) − D(b) − 2Cov(a, b)i
where D( z ) means the variance of z and Cov(a, b) means the covariance of a and 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


(2)
= D(a ) + D(b)

where z means the conjugate of z .


From Equations 1 and 2, you can get
1
Cov(a, b) = − ℑ( D( z )) (3)
2
1
D(a) = (Cov( z , z ) + ℜ( D( z ))) (4)
2
1
D(b) = (Cov( z , z ) − ℜ( D( z ))) (5)
2
If z is a real number, you can treat z as a complex number with D(b) = 0 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 85 System Identification VIs


Algorithm References

Para Name In/Out Type Description


polynomial In 1D CDB Array The roots of a polynomial
roots
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
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 σ1 and σ2 is zero, then one part of X is a constant, and the confidence region is an
interval on another direction with mid-point ( µ1 , µ2 ) and radius std range* σ i , which does not
equal 0.

Otherwise, you can consider the distribution of x1 and x2 as bivariate normal distribution

1  z 
P ( x1 , x2 ) = exp  − 
( )
(1)
2πσ 1σ 2 1− ρ 2
 2 1 − ρ 2 
where

(x − µ ) 2 ρ ( x1 − µ1 )( x2 − µ2 ) ( x − µ2 )
2 2

z= 1 1 − + 2 (2)
σ 12 σ 1σ 2 σ 22
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 VIs 86 ni.com


Algorithm References

 cos 2 θ 2 ρ cos θ sin θ sin 2 θ  2


z =  − +  r1
 σ1 σ 1σ 2 σ 22
2

− 2  +
(
 cos θ sin θ ρ cos 2 θ − sin 2 θ

)
cos θ sin θ 
 r1r2 (3)
 σ12
σ 1σ 2 σ 22 
 
 sin 2 θ 2 ρ cos θ sin θ cos 2 θ  2
+  + +  r2
 1 σ 2
σ σ
1 2 σ 2
2

Let r2 = 0 , so you can have the conditional distribution

  cos 2 θ 2 ρ cos θ sin θ sin 2 θ  


  − +  
  σ 12 σ 1σ 2 σ 22  r2 
P (r1 | r2 = 0) = const × exp −
( )
(4)
 2 1− ρ 2
1

 
 
The constant before the exponential function is not necessary to know, but you must know it is
also a normal distribution with

cos 2 θ 2 ρ cos θ sin θ sin 2 θ


− +
1 σ 12 σ 1σ 2 σ 22
= (5)
∆2 1− ρ 2
where ∆ is the variance.
So, in this direction, (cos θ ,sin θ ) , the confidence region is [-std range* ∆ , std range* ∆ ]. Thus,
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 87 System Identification VIs


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]
−1
 2 −1
 (i )
[ ] [ ]
∧ 2
−1 ∧
C =  ∑ C (i )  , θ = C ∑ C (i ) θ (1)
 i =1  i =1

5. 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 VIs 88 ni.com


Algorithm References

upsampling factor In I32 The upsampling factor n


PRBS Out 1D U8 Array The PRBS this VI generates

4. 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]
Tclk
n= (1)
Ts
where n is the upsampling factor, Tclk 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:

1 N 1 2
VN (θ ) = ∑ ε (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 ) , indicating the difference between the predicted or

simulated output of the system, y (t ,θ ) , and the measured output, y (t ) .

You can use some methods, such as the multi-stage method for polynomial models, to get a
coarse estimation of θ . You then can use the following iteration to refine θ :

© National Instruments 89 System Identification VIs


Algorithm References

θ (i +1) = θ (i ) + αf (θ (i ) ) (2)

where α is the step size and ( )


f θ (i ) is the search direction. The purpose of iteration is to
minimize the mean square error V N (θ ) . 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
N
1
V '(θ ) = −
N
∑ψ (t ,θ )ε (t ,θ )
t =1
(4)

and
N
1
V ''(θ ) ≈
N
∑ψ (t ,θ )ψ
t =1
T
(t , θ ) (5)

dy (t ,θ )
ψ (t ,θ ) = (6)
dt
T denotes transposing. By inserting Equations 4 and 5 into 3, you obtain the following
equation:
N

∑ψ (t ,θ )ε (t ,θ )
f (θ ) = t =1
N

∑ψ (t ,θ )ψ
t =1
T
(t , θ )

 ε (1, θ ) 
 ε (2, θ ) 
[ψ (1,θ ) ψ (2,θ ) ... ψ ( N ,θ )]  ... 
 
= ε ( N , θ ) 
 ψ T (1, θ ) 
 T 
 ψ (2,θ ) 
[ψ (1, θ ) ψ (2, θ ) ... ψ ( N , θ ) ] 
...
 T 
ψ ( N ,θ ) 
−1
 ψ T (1,θ )   ε (1, θ ) 
 T   ε (2, θ ) 
 ψ (2,θ )   
=
 ...   ...  (7)
 T   
ψ ( N , θ )  ε ( N , θ ) 
You can evaluate f (θ ) by solving the following linear equation:

System Identification VIs 90 ni.com


Algorithm References

 ψ T (1, θ )   ε (1, θ ) 
 T   
 ψ (2, θ )  f (θ ) =  ε (2, θ )  (8)
 ...   ... 
 T   
ψ ( N , θ )  ε ( N , θ ) 

The following equations define ψ (t , θ ) .

Gradient of ARMAX Model [Page 330, Equation 10.52, Ref 1]


1
ψ (t ,θ ) = [− y (t − 1)... − y (t − N a ) u (t − 0)...u (t − N b + 1)
C (q)
ε (t − 1)...ε (t − N c )]T
Gradient of OE Model [Page 330, Equation 10.54b,e, Ref 1]

 1 −k B(q ) 
ψ (t ,θ ) =  q u (t ),− q −k u (t ) , t = 1,..., N
 F (q ) F (q )F (q ) 
Gradient of BJ Model [Page 330, Equation 10.54b,c,d,e, Ref 1]
D(q) − D(q) − k
ψ (t ,θ ) = [ q − k u (t ), q w(t ),
C (q) F (q) C (q) F (q)
1 −1 − k
q − k ε (t ), q v(t )], t = 1,..., N
C (q )) C (q ))
Gradient of General-Linear Model [Page 330, Equation 10.54a,b,c,d,e, Ref 1]
− D(q) − k D(q ) − D(q) − k
ψ (t ,θ ) = [ q y (t ), q − k u (t ), q w(t ),
C (q) C (q) F (q) C (q) F (q)
1 −1 − k
q − k ε (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 System Identification VIs do 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.
y (t ,θ + dθ ) − y (t ,θ − dθ )
ψ (t ,θ ) =
2 ⋅ dθ
dθ = θ * DIFF _ 2
where DIFF _ 2 = 3.2057501263e − 6

4. 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 91 System Identification VIs


Algorithm References

 ε (n) | ε (n) |< ρ ⋅ σˆ



ε (n) =  ρ ⋅ σˆ ε (n) > ρ ⋅ σˆ
− ρ ⋅ σˆ ε (n) < − ρ ⋅ σˆ

where p is a scalar in the range 1 ≤ ρ ≤ 1.8 . The System Identification VIs select ρ = 1.5 .
σˆ 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]:
 1 N
1 N
θ NLS = [
N
∑ ζ (t )ϕ
t =1
T
(t )]−1 ∑ ζ (t ) y(t )
N t =1
(1)

where ζ contains the instruments variables.

Choice of Instruments Variables ζ [P.225, Ref 1, 3.2, Ref 2]

System Identification VIs 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 − N a ) u (t ) u (t − 1)... u (t − N b + 1)]T (2)

where x(t ) 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.
m
b0 + b1 z ... + b z
H( z ) = m
n
, m≤n (2)
a0 + a1 z ... + a z
n

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 93 System Identification VIs


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 j

 iω p×r 
G( e ) G( ω j ) ∈ C for j ∈1,..., N  (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

∑ tr {E( ω j ,θ )E * ( ω j ,θ )}=
N
2
J(θ ) = E( θ ) F
(4)
j =1

where E( ω ,θ ) = G( ω ) − P( ω ,θ ) for j ∈1,..., N .


j j 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 VIs 94 ni.com


Algorithm References

−1 −1 −1
P( z ,θ ) = A( z ,θ ) B( z ,θ ) (6)
where A and B denote parameterized polynomial matrices in terms of z-1. Note that

P( ω ,θ ) = P( z ,θ ) iω j T
(7)
j
z =e

For a model with r inputs and p outputs, the following equations represent A and B, respectively:
n
−1 −k
A( z ,θ ) = I p × p + ∑ Ak z (8)
k =1

p× p
where A ∈ ℜ .
k

d + m −1
−1 −k
B( z ,θ ) = ∑ B z
k
(9)
k =d

p×r
where B ∈ ℜ and d denotes the number of leading zero matrix coefficients. Because each
k

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( ω ,θ ) = A( z ,θ )  A( z ,θ )G( ω ) − B( z ,θ ) (9)
j  j  iω j T
z =e

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 95 System Identification VIs


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.
j m
b0 + b1s... + b s ... + b s
j m
H ( s) = i n
,m<n (2)
a0 + a1s... + a s ... + a s
i n

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 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

System Identification VIs 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:
c c c c
b + b T ( s ) + ... + b j T j ( s ) + ... + bmTm ( s )
0 1 1
H( s ) = (3)
c c c c
a0 + a1 T1( s ) + ... + ai Ti ( s ) + ... + a n Tn ( s )

Suppose you obtain a set of observed FRF data G( ω ) , evaluated at N frequency points ω .
j 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 2
θ = argmin ∑ H ( θ ,ω j ) − G( ω j )
j =1

T
and θ = a ... b  .
c c c c c c
where H ( θ ,ω ) = H ( s ) a1 ... a b0 b1
j s =iw j  0 n m 

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 97 System Identification VIs


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 )
(1)
y( k ) = Cx( k ) + Du( k ) + n( k )
m l n
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.

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 )U ( ω ) + N ( ω )

iω −1
where G( e ) = G( z ) iω
= D + C( zI − A ) B iω
and is the frequency response function
z =e z =e

(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 ) of the system.

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 -
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 VIs 98 ni.com


Algorithm References

out information about -


this model
coefficients of Out Cluster Estimated matrices A, B, C, D
state-space
model
initial states Out 1D DBL Array Estimated initial state vector

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 ) 
Define y ( k ) =   and similarly with u ( k ) and n ( k )
d    d d
 
 y( k + d − 1 )
By recursively using Equation 1, you obtain:
y d = Οd x( k ) + Γ d u d ( k ) + n d ( k ) (2)

 C 
 CA 
where Ο =   and is the extended system observability matrix and
d   
 d −1 
CA 

 D 0 0 0 0
 CB D 0 0 0 

Γ d =  CAB CB D 0 0  is the lower triangular Toeplitz matrix.
 
     0
CA d − 2 B   CB D 

By using the Fourier transform on both sides of Equation 2, we obtain


Wd ( ω ) ⊗ Y ( ω ) = Ο d X ( ω ) + Γ d Wd ( ω ) ⊗ U ( ω ) + Wd ( ω ) ⊗ N ( ω ) (3)

iω 2iω iω ( d −1 )  T
where ⊗ denotes the Kronecker product and W ( ω ) = 1 e e ... e .
d  

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 ) )

U d ,M = ( Wq ( ω1 ) ⊗ U ( ω1 ) ... Wq ( ω M ) ⊗ U ( ω M ) )

N
d ,M
= ( Wq ( ω1 ) ⊗ N ( ω1 ) ... Wq ( ω M ) ⊗ N ( ω M ) )

X
M
= ( X ( ω ) ... X ( ω M ) )
1

By using Equation 3, you obtain

© National Instruments 99 System Identification VIs


Algorithm References

Y =Ο X +Γ U +N (4)
d ,M d M d d ,M d ,M

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

  Q1 
H
U   R11 0
  =    H 
 Y   R21 R
22   Q 
2

3) Calculate the SVD of R22

0  V 
(Re(R ) Im(R ) = (U )
T
 λS
UO   S
22 22 S
 0 λO  V T 
 O
4) Determine A and C:

 = ( J U ) + J U
1 s 2 s
Ĉ = J U s
3

where J = ( I 0( d −1 )l ×l ) , J 2 = ( 0( d −1 )l ×l I ) , and J = ( I 0 ) and are


1 ( d −1 )l ( d −1 )l 3 l l ×( d −1 )l

the selection matrices.


5) Solve for B, D, and x0 from the following least squares problem
M iω iω 2
−1 −1
B̂ , D̂ , x̂0 = argmin ∑ Y ( ω k ) − ( D + Ĉ( e k
I − Â ) B )U ( ω k ) − Ĉ( e k
I − Â ) x0
k =1

5. 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 VIs 100 ni.com

Potrebbero piacerti anche