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

1 次查看(过去 30 天)
  7 个评论

请先登录,再进行评论。

采纳的回答

Rahul
Rahul 2024-10-4
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Model Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by