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 天)
显示 更早的评论
采纳的回答
Rahul
2024-10-4
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Model Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!