Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
LabVIEW
LabVIEW System Identification VIs Algorithm References
Subtitle
June 2014
Support
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.
To comment on National Instruments documentation, refer to the National Instruments Web site
at ni.com/info and enter the Info Code feedback.
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
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
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
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,
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
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.
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)
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
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
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 (na ) y (0) a1
y (n + 1) a
y (1)
, a=
2
mf = a , mb =
y ( N − 1) y ( N − na − 1) a na
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
y ( 0) 0 0
y (1) y (0) 0
Mf =
y ( N − na ) y ( N − n a + 1) y ( N − 1)
5. References
[1] Signal Processing Toolkit User Manual, National Instruments
[2] Guangshu Hu, Digital Signal Processing, Tsing Hua University Press.
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
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
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
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.
eb (n) x(n na ) xˆ b (n na )
2
b E{ eb (n) }
i =m
b
m −1 (i − 1) | 2
5. References
[1] Guangshu Hu, Digital Signal Processing, Tsing Hua University Press.
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
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.
3. APIs
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
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
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
,
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 -
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.
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
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.
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.
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
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).
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
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.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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.
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
q − i y ( n) = y ( n − i ) .
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
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).
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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
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
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).
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), you can apply
the instrumental variable method to estimate B(q) and F(q) of Equation 1.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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,
respectively.
BJ model Out Cluster B is [0,...0, b0 , b1 ,...., bN b −1 ] , The
[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)
Equation 5 can be treated as an AR model. With the AR model estimation, you have an
D(q )
vˆ(n) = e(n) (6)
C (q )
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
estimation methods with vˆ(n) and eˆ(n) as the output and input, respectively.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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.
[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.
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)
Equation 4 can be treated as an AR model. With the AR model estimation, you have an estimation
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
estimation methods with vˆ(n) and eˆ(n) as the output and input, respectively.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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.
[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).
( 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 )
Equation 6 can be treated as an AR model. With the AR model estimation, you can have an
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
estimation methods with vˆ(n) and eˆ(n) as the output and input, respectively.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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
[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
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 )
Equation 6 can be treated as an AR model. With the AR model estimation, you have an estimation
D (q )
vˆ(n) = e(n) (7)
C (q )
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
estimation methods with vˆ(n) and eˆ(n) as the output and input, respectively.
5. References
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
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
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.
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.
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.
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:
N
1 1
VN =
N
∑2e
k =1
2
(k ) (5)
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
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.
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
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.
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
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)
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
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
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
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
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
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
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
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)
With the Yt , U t , X t and qX t you can solve the equation 1 to obtain A, B, C, and D.
From Y f ∏ ⊥ Z = Gf Ef
p
U f
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
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 ,
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)
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
(G ) (Y
∗ −1
f f0 ( )
− H f U f 0 ) = G ∗f
−1
Γ f X 0 + E1 f 0 (8)
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:
∞
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
Ru (τ ) = E[u (t )u (t − τ )] = αδ (τ ) (3)
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.
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.
α 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.
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:
∞
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
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)
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
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.
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
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.
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
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
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.
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:
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.
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.
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 )
which means
q − i y ( n) = y ( n − i ) .
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
C (q )ψ (t , bi ) = ϕ (t , bi ) , ϕ (t − k , bi ) = ϕ (t , bi + k )
That is
C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is
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
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 )
j =0 i =1 i =1 i =1
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 )
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
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
C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is
C (q )ψ (t , di ) = −ϕ (t , di ) , ϕ (t − k , di ) = ϕ (t , di + k )
That is
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 − 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)
[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
^
ψ (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
C (q ) Fi (q ) = Gi (q )
That is
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
C (q )ψ (t , ci ) = ϕ (t , ci ) , ϕ (t − k , ci ) = ϕ (t , ci + k )
That is
C (q )ψ (t , di ) = −ϕ (t , di ) , ϕ (t − k , di ) = ϕ (t , di + k )
That is
3. Reference
[1] Ljung, L. 1999. System Identification Theory for the User. 2nd ed. Prentice Hall.
2. Algorithms
The following are the algorithms for the SI Model Simulation VIs.
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 − 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)
[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.
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.
^ ^
f (θ ) ≈ f (θ 0 ) + f ' (θ 0 )(θ − θ 0 )
Matrix y
'
(n, θ ) computation
∂ 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
+ ...
+ 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
+ ...
+ 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 )
+ ...
+ 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
+ ...
+ 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 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.
where U (t ) and Y (t ) are the inputs and outputs of the system, respectively. X (t ) is the state
variables.
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
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.
β 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.
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.
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.
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 )
Ni , f
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 )
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.
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.
where U (t ) and Y (t ) are the inputs and outputs of the system, respectively. X (t ) is the state
variables.
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.
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
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.
^
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 .
The state space model can be rewritten as the matrix multiplications, as shown by the
following equation:
^
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] .
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)
• cov e (τ )
The auto-correlation of prediction error is defined as
N
1
ReN (τ ) =
N
∑ e(t )e(t − τ )
t =1
(1)
• Confidence of cov e (τ )
Since N ReN (τ ) is a zero mean Gaussian distribution with variance λ2 [P.512, Ref 1],
• 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)
P1
Na (8)
N
And then the confidence interval of cov eu (τ ) is
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.
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
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.
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.
5. Reference
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
G ( z ) can be reformed as
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]
[u1 (t ), u2 (t ),..., unu (t )]T , E is identity matrix, A1 ,..., ANa is n y n y matrix, B0 ,..., BNb is
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.
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.
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
You then need to compute the polynomial roots of transfer function polynomials to convert a
transfer function model into a pole-zero model.
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
jω
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
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
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.
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ω )
^ ^
f (θ ) ≈ f (θ 0 ) + f ' (θ 0 )(θ − θ 0 )
To solve the above function, θ is the combination of the coefficients of A, B, and F. f (θ 0 ) is the
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.
θ θ
∂ ∂ ∂ ∂
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 )
∂ jω1
∂θ G (e )
∂ jω2
∂ G (e )
G (e jω ) = ∂θ (8)
∂θ
....
∂ jω Nω
G (e )
∂θ
∂ 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 ) ∂θ
jω
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.
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 )
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.
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.
2. Function Description
Given a polynomial as represented by the following equation:
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
First, consider that the given polynomial is a monic polynomial, where a0 = 1 for Equation 1,
with roots x1 ,..., xn .
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
∂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
where
aj
bj = , j = 1, 2,..., n .
a0
You therefore can have
∂xi 1 n ∂x
= − 2 ∑ ak i (11)
∂a0 a0 k =1 ∂bk
∂xi 1 ∂xi
= , k = 1, 2,..., n (12)
∂ak a0 ∂bk
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 .
Thus,
D(b) = 0 (7)
Cov(a, b) = 0 (8)
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
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,
− 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
For a polynomial, you can handle all its roots following the above method.
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.
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.
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
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.
2. Problem to Solve
The purpose of model estimation is to identify the model coefficients by minimizing the mean
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 θ :
θ (i +1) = θ (i ) + αf (θ (i ) ) (2)
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:
ψ T (1, θ ) ε (1, θ )
T
ψ (2, θ ) f (θ ) = ε (2, θ ) (8)
... ...
T
ψ ( N , θ ) ε ( N , θ )
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
σˆ = 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.
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)
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
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.
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
The purpose of this VI is to estimate the transfer function H(z) by using the frequency response
function (FRF) of a 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 -
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.
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.
∑ tr {E( ω j ,θ )E * ( ω j ,θ )}=
N
2
J(θ ) = E( θ ) F
(4)
j =1
θˆ := argminJ ( θ ) (5)
Focusing on the left-hand side of the polynomial MFD, the model P( θ ) can be parameterized as
−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.
−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.
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
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
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
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.
iω
e X ( ω ) = AX ( ω ) + BU ( ω )
Y ( ω ) = CX ( ω ) + DU ( ω ) + N ( ω )
where Y(ω), U(ω), N(ω), and X(ω) are the transformed output, input, noise, and state,
respectively. By eliminating the state, you obtain the following equation.
iω
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
The goal of this VI is to find an estimate for the system matrices A, B, C, and D, and the initial
iω
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
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
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
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
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
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.