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

2 vues (au cours des 30 derniers jours)
  7 commentaires
Yilin
Yilin le 3 Oct 2024
Déplacé(e) : Torsten le 3 Oct 2024
@Torsten Got it, Thanks for your help!!

Connectez-vous pour commenter.

Réponse acceptée

Rahul
Rahul le 4 Oct 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

Plus de réponses (0)

Catégories

En savoir plus sur Linear Model Identification dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by