## Can process noise matrix be extracted from Linear System Model?

Given I have a linear discrete system identified by using the System Identification Toolbox, of the following standard form:

y = Cx + Du + e

x = Ax + Bu + Ke

If I extract A, B, C, D, K matrices in addition to NoiseVariance (which represents the variance of the model versus the measurements it was identified from), and additionally I have the variance of input, can I calculate the Q (process noise covariance) matrix from that information?

I looked at several topics and forum posts, for example:

https://www.mathworks.com/help/control/ug/kalman-filtering.html

https://www.mathworks.com/help/ident/ug/estimating-states-of-time-varying-systems-using-kalman-filters.html

https://www.mathworks.com/matlabcentral/answers/1722215-kalman-filter-discrete-system-kalmf-r-and-q-do-not-seem-to-influence-the-performance-of-the-kalman

https://www.mathworks.com/matlabcentral/answers/339275-how-to-set-q-and-r-in-a-kalman-filter

https://www.mathworks.com/matlabcentral/answers/122661-finding-out-q-and-r-matrices-of-a-given-system

https://dsp.stackexchange.com/questions/21796/question-about-q-matrix-model-process-covariance-in-kalman-filter

The consensus seems to be, that if I used the Matlab System Identification Toolbox to identify the linear discrete system (let’s call it ss1), then Q is given by:

% N is the order of the system, i.e. 3rd order N = 3

N = length(ss1.x0);

% Q = NoiseVariance * Identity + InputVariance * Contribution of Input

Q = ss1.NoiseVariance * eye(N) + ss1.B * inputVariance * ss1.B’

Is this accurate? Here’s an example from a system I identified.

% Generated by Matlab System Identification

N = 3;

NoiseVariance = 0.0026;

B = 1.0e-04 * [ -0.0001 0.0141 -0.1492];

% Provided by me (SISO system, just one input)

inputVariance = 0.001;

% Calculate process noise covariance

Q = NoiseVariance * eye(N) + B * inputVariance * B’;

I get this:

Q =

0.0026 -0.0000 0.0000

-0.0000 0.0026 -0.0000

0.0000 -0.0000 0.0026

…basically an identity because the B matrix (contribution of input directly into output) is:

B =

1.0e-04 *

-0.0001

0.0141

-0.1492Given I have a linear discrete system identified by using the System Identification Toolbox, of the following standard form:

y = Cx + Du + e

x = Ax + Bu + Ke

If I extract A, B, C, D, K matrices in addition to NoiseVariance (which represents the variance of the model versus the measurements it was identified from), and additionally I have the variance of input, can I calculate the Q (process noise covariance) matrix from that information?

I looked at several topics and forum posts, for example:

https://www.mathworks.com/help/control/ug/kalman-filtering.html

https://www.mathworks.com/help/ident/ug/estimating-states-of-time-varying-systems-using-kalman-filters.html

https://www.mathworks.com/matlabcentral/answers/1722215-kalman-filter-discrete-system-kalmf-r-and-q-do-not-seem-to-influence-the-performance-of-the-kalman

https://www.mathworks.com/matlabcentral/answers/339275-how-to-set-q-and-r-in-a-kalman-filter

https://www.mathworks.com/matlabcentral/answers/122661-finding-out-q-and-r-matrices-of-a-given-system

https://dsp.stackexchange.com/questions/21796/question-about-q-matrix-model-process-covariance-in-kalman-filter

The consensus seems to be, that if I used the Matlab System Identification Toolbox to identify the linear discrete system (let’s call it ss1), then Q is given by:

% N is the order of the system, i.e. 3rd order N = 3

N = length(ss1.x0);

% Q = NoiseVariance * Identity + InputVariance * Contribution of Input

Q = ss1.NoiseVariance * eye(N) + ss1.B * inputVariance * ss1.B’

Is this accurate? Here’s an example from a system I identified.

% Generated by Matlab System Identification

N = 3;

NoiseVariance = 0.0026;

B = 1.0e-04 * [ -0.0001 0.0141 -0.1492];

% Provided by me (SISO system, just one input)

inputVariance = 0.001;

% Calculate process noise covariance

Q = NoiseVariance * eye(N) + B * inputVariance * B’;

I get this:

Q =

0.0026 -0.0000 0.0000

-0.0000 0.0026 -0.0000

0.0000 -0.0000 0.0026

…basically an identity because the B matrix (contribution of input directly into output) is:

B =

1.0e-04 *

-0.0001

0.0141

-0.1492 Given I have a linear discrete system identified by using the System Identification Toolbox, of the following standard form:

y = Cx + Du + e

x = Ax + Bu + Ke

If I extract A, B, C, D, K matrices in addition to NoiseVariance (which represents the variance of the model versus the measurements it was identified from), and additionally I have the variance of input, can I calculate the Q (process noise covariance) matrix from that information?

I looked at several topics and forum posts, for example:

https://www.mathworks.com/help/control/ug/kalman-filtering.html

https://www.mathworks.com/help/ident/ug/estimating-states-of-time-varying-systems-using-kalman-filters.html

https://www.mathworks.com/matlabcentral/answers/1722215-kalman-filter-discrete-system-kalmf-r-and-q-do-not-seem-to-influence-the-performance-of-the-kalman

https://www.mathworks.com/matlabcentral/answers/339275-how-to-set-q-and-r-in-a-kalman-filter

https://www.mathworks.com/matlabcentral/answers/122661-finding-out-q-and-r-matrices-of-a-given-system

https://dsp.stackexchange.com/questions/21796/question-about-q-matrix-model-process-covariance-in-kalman-filter

The consensus seems to be, that if I used the Matlab System Identification Toolbox to identify the linear discrete system (let’s call it ss1), then Q is given by:

% N is the order of the system, i.e. 3rd order N = 3

N = length(ss1.x0);

% Q = NoiseVariance * Identity + InputVariance * Contribution of Input

Q = ss1.NoiseVariance * eye(N) + ss1.B * inputVariance * ss1.B’

Is this accurate? Here’s an example from a system I identified.

% Generated by Matlab System Identification

N = 3;

NoiseVariance = 0.0026;

B = 1.0e-04 * [ -0.0001 0.0141 -0.1492];

% Provided by me (SISO system, just one input)

inputVariance = 0.001;

% Calculate process noise covariance

Q = NoiseVariance * eye(N) + B * inputVariance * B’;

I get this:

Q =

0.0026 -0.0000 0.0000

-0.0000 0.0026 -0.0000

0.0000 -0.0000 0.0026

…basically an identity because the B matrix (contribution of input directly into output) is:

B =

1.0e-04 *

-0.0001

0.0141

-0.1492 system, digital signal processing MATLAB Answers — New Questions