XCOS Kalman Filter Demo

If I change the dimension of the set context to

// Define physical parameters
k1 = 100;   // Spring constant of k1 (N/m)
k2 = 50;    // Spring constant of k2 (N/m)
b = 10;     // Damping coefficient (Ns/m)
m1 = 5;     // Mass of m1 (kg)
m2 = 3;     // Mass of m2 (kg)
// System Matrices
A = [0, 1, 0, 0;
    -(k1 + k2) / m1, -b / m1, k2 / m1, 0;
     0, 0, 0, 1;
     k2 / m2, 0, -k2 / m2, 0];

B = [0;
     1 / m1;
     0;
    -1 / m2];

C = [1, 0, 0, 0;
     0, 0, 1, 0];

D = [0; 0];

// Kalman Filter Parameters
Q = diag([0.01, 0.01, 0.01, 0.01]);  // Process noise covariance
R = diag([0.05, 0.05]);              // Measurement noise covariance
P0 = diag([0.1, 0.1, 0.1, 0.1]);    // Initial error covariance

Then how to debug it. It is hard coded. What is the error now?


If we change parameter then it wont work hence model is used for only case.

In which block do you use these Q, R and P0 parameters ? in specific blocks ?
Could you share this schema ?

Please go to Demo >XCOS> Control System > Kalman Filter

If you change above parameters then we will get this error. Other variable

Q, R and P0 are inside the kalman filter super block so you can see it.