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 件のコメント
Yilin
Yilin 2024 年 10 月 3 日
移動済み: Torsten 2024 年 10 月 3 日
@Torsten Got it, Thanks for your help!!

サインインしてコメントする。

採用された回答

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 Center および File ExchangeLinear Model Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by