# Variance of linear system model

11 Ansichten (letzte 30 Tage)
Valeriy am 14 Apr. 2024
Kommentiert: Manikanta Aditya am 15 Apr. 2024
I have a linear system model estimated using System Identification Toolbox.
It gives me the variances of inputs and initial state. What I need is the variance of the system output. Where do I get that?
The "Estimate State-Space Model" dialog box has a checkbox called "Estimate covariance" but that only estimate variance of the inputs and state, for example dA, dB, dC, dD, dx0. Where is the variance of the system output?
>> [A,B,C,D,K,x0,dA,dB,dC,dD,dx0] = idssdata(ss3);
>> dA
dA =
1.0e+15 *
0.1366 0.0413 0.0323
0.7838 0.3893 0.3096
1.1010 0.4438 0.3811
>> dB
dB =
1.0e+12 *
0.3205
3.7370
6.5220
>> dC
dC =
1.0e+14 *
1.5653 0.4331 0.2216
>> dD
dD =
0.0050
##### 2 KommentareKeine anzeigenKeine ausblenden
Manikanta Aditya am 15 Apr. 2024
The variance of the system output is not directly given by the System Identification Toolbox.
The output of a state-space model is given by the equation:
y(t)=Cx(t)+Du(t)
where:
• y(t) is the output,
• x(t) is the state,
• u(t) is the input,
• C is the output matrix, and
• D is the feedthrough matrix.
Given the variances of x(t) and u(t), you can calculate the variance of y(t) as follows:
Var[y(t)]=CVar[x(t)]C+DVar[u(t)]D
where ' denotes the transpose of a matrix, and Var[x(t)] and Var[u(t)] are the variances of the state and input, respectively.
Hope this helps.
Valeriy am 15 Apr. 2024
Bearbeitet: Valeriy am 15 Apr. 2024
@Manikanta Aditya thanks for the reply. Could you help me understand the notation you used?
I understood this:
• C is the weight of system state, in my case 1x3 column vector (C' is transpose of C)
• D is the weight of input, a scalar (you can't transpose a scalar?)
• stateVariance can be extracted from identified system by using idssdata, it would be dx0
• inputVariance I could calculate from my input data set
estimateVariance = C * stateVariance * C+ D * inputVariance * D
Why do I multiply the state variable by both C and the transpose of C?
Why do I multiply the input variance by both D and transpose of D?
Matlab says D is a scalar (my system is third order), so I assume it's going to be a scalar for a SISO system of any order? Then I don't multiply by its transpose, but square it instead?
Is there a cheat sheet with rules on how to add, subtract, multiply, and divide variances?

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Manikanta Aditya am 15 Apr. 2024
• Multiplying by C and C’: This operation is known as a matrix multiplication. When you multiply a matrix by its transpose, you’re essentially transforming the variance of the state (which is a vector) into the variance of the output (which is also a vector). This is a common operation in linear algebra when dealing with transformations of multivariate data.
• Multiplying by D and D’: In your case, since D is a scalar, you’re correct that you don’t need to transpose it. Instead, you square it. This is because the variance of a random variable multiplied by a constant is the square of the constant times the original variance. So, if D is the weight of the input, then D^2 is the weight of the variance of the input.
• Variance Operations: Variance is a measure of dispersion, and it has its own set of rules for arithmetic operations:
• Addition/Subtraction: The variance of the sum/difference of two independent random variables is the sum of their variances. If the variables are not independent, this rule doesn’t apply.
• Multiplication/Division: Things get a bit more complicated here. Generally, the variance of the product/quotient of two random variables does not equal the product/quotient of their variances. You might want to look up “variance of product of random variables” for more details.
Hope this helps.
##### 2 KommentareKeine anzeigenKeine ausblenden
Valeriy am 15 Apr. 2024
This is great, thanks!
I had one more hiccup on calculating variance of the derivative of the linear system Ax(t) + Bu(t) + Ke(t) (since in that case, A * system state * A' gives you a 3-element vector for a third order system), but I was told to simply sum the variances of the system state variables, which will represent the total variance of system state. You confirmed above that this should work as long as system state variables are independent.
Manikanta Aditya am 15 Apr. 2024
You’re correct. If you have a linear system described by the equation:
Ax(t)+Bu(t)+Ke(t)
and you’re interested in the variance of the derivative of the system state, you would indeed sum the variances of the system state variables. This is under the assumption that the system state variables are independent.
This is because the variance operator is linear for independent random variables. In other words, the variance of the sum of independent random variables is equal to the sum of their variances. So, if your system state variables are independent, you can simply sum their variances to get the total variance of the system state.
However, it’s important to note that this might not be the case if your system state variables are not independent. In that case, you would need to consider the covariances between the variables as well.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Linear Model Identification finden Sie in Help Center und File Exchange

R2023b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by