I am using the system identification tool box to create a greybox model. My error is The sizes of the matrices returned by the ODE function must be consistent with the input/o

3 visualizaciones (últimos 30 días)
  7 comentarios

Iniciar sesión para comentar.

Respuesta aceptada

Rahul
Rahul el 4 de Oct. de 2024
Hi @Yilin,
From what I understand, you are trying to create a linear ODE grey-box model using the state space matrices returned from your ODE function “GreyBox18”.
For a generic state space system, the state space equations are represented as follows:
Hence, as pointed out by @Torsten, since LHS of eq (1) has dimensions (3,1), the resultant of matrix multiplication of ‘K.*e(t)’ should also have (3,1) as its dim. So, it might be that the matrix ‘K’ needs to be initialized with size (3, 1), since error matrix ‘e(t)’ is a scalar. Here is how you structure your ODE function:
function [A,B,C,D,K] = GreyBox18(C_n, C_en, C_m, R_en, R_mn, R_oen, ~[AJ1] )
A = [(-1/(C_n*R_en)-1/(C_n*R_mn)), 1/(C_n*R_en), 1/(C_n*R_mn);
1/(C_en*R_en), -1/(C_en*R_oen)-1/(C_en*R_en), 0; 1/(C_m*R_mn), 0, -1/(C_m*R_mn)];
B = [1/C_n, 1/C_n, 0, 0, 0, -1/C_n;
0, 0, 1/(C_en*R_oen), 1/C_en, 0, 0;
0, 0, 0, 0, 1/C_m, 0];
C = [1,0,0];
D = zeros(1,6);
K = zeros(3,1); % Change size of K to (3,1)
end

Más respuestas (0)

Categorías

Más información sobre Linear Model Identification en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by