- Inherent process noise represented by 'NoiseVariance', which is directly scaled by the identity matrix ('I') to match the dimensions of the state space. This noise component is assumed to be white noise affecting all states equally and independently.
- Input-driven uncertainty represented by the term (B*(inputVariance)*B'). considers how variations in the input (with a known variance 'inputVariance') propagate through the system dynamics (modeled by (B)) to affect the states.
Can process noise matrix be extracted from Linear System Model?
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Balavignesh
on 30 May 2024
Hi Valeriy,
As per my understanding, you calculated the process noise covariance matrix ('Q') for a discrete linear system identified using the MATLAB System Identification Toolbox and want to make sure the results are accurate.
The formula you used attempts to account for two primary sources of uncertainty in the model:
Your calculation of 'Q' results in a matrix that is almost diagonal with (0.0026) on the diagonal. The off-diagonal elements are very close to zero, which is expected given the magnitude of elements in 'B'. This suggests that the process noise and input-driven uncertainties are assumed to affect each state independently, with minimal cross-correlation. This is a common simplification that makes the Kalman filter easier to implement and understand. The small magnitude of 'B' means the input-driven uncertainty's contribution to 'Q' is negligible compared to the inherent process noise 'NoiseVariance'. This is why the resulting 'Q' matrix values are very close to NoiseVariance and the matrix appears almost as an identity matrix scaled by 'NoiseVariance '.
Your approach and the resulting calculation are conceptually correct within the assumptions made (e.g., white noise, independence of state noises, linear propagation of input variance through 'B'). The almost identity appearance of 'Q' is a direct consequence of the small magnitude of 'B' in your system, which minimizes the impact of input variance on the process noise covariance.I would suggest you validate the assumptions leading to the formulation of 'Q' against the specific characteristics and requirements of your application. Adjustments may be necessary if, for example, there is significant cross-correlation between the noises affecting different states or if the input variance significantly affects the system dynamics in a non-linear manner.
Hope that helps!
0 Comments
See Also
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!