greybox linear model error
1 回表示 (過去 30 日間)
古いコメントを表示
I get the following error: "The number of inputs and outputs of the model must match that of the data." However, I have ensured the number of outputs are definitely correct - where have I gone wrong?
NB: y= 100x3, u=100x1
load v1v2;
y=[x_store simSoC_TECM];
u=simCurr_TECM;
data = iddata(y,u,1,'Name','Battdata'); %y=O/P (V1,V2), u=I/P (Ibat), Ts=1.
data.OutputName = {'BattV1','BattV2','BattSoc'};
data.OutputUnit = {'V','V','%'};
data.Tstart = 0;
data.TimeUnit = 's';
%%load parameters
load rcbranch
R1=RpTF1mean(5,3);
R2=RpTF2mean(5,3);
T1=TauTF1mean(5,3);
T2=TauTF2mean(5,3);
R0=RoTFmean(5,3);
C1=T1/R1;
C2=T2/R2;
%%construct greybox model
param = {T1;T2;C1;C2;Cnom;R0}
linm = idgrey('batteryeq_lin',param,'c');
function [A,B,C,D] = batteryeq_lin(T1,T2,C1,C2,Cnom,R0,Ts)
A=[-1/T1 0 0;0 -1/T2 0;0 0 0]; %(V1 V2 SOC)
B=[1/C1;1/C2;-1/Cnom];
C=[-1 -1 -1];
D=R0;
%%Specify known and unknown parameters.
for i=1:1:5
linm.Structure.Parameters(i).Free = false;
end
linm.Structure.Parameters(6).Free = true;
linm.Structure.Parameters(6).Minimum = 45e-3;
linm.Structure.Parameters(6).Maximum = 90e-3;
%%Estimate R0.
tic
linm = greyest(data,linm)
toc
Thank you
0 件のコメント
採用された回答
Prashant Arora
2017 年 7 月 17 日
編集済み: Prashant Arora
2017 年 7 月 17 日
Hi Imisi, In your code below
function [A,B,C,D] = batteryeq_lin(T1,T2,C1,C2,Cnom,R0,Ts)
A=[-1/T1 0 0;0 -1/T2 0;0 0 0]; %(V1 V2 SOC)
B=[1/C1;1/C2;-1/Cnom];
C=[-1 -1 -1];
D=R0;
C is defined as a row vector, which implies that the state-space model has only 1 output, as opposed to 3 outputs created with iddata. This is causing a mismatch and results in an error. Essentially C*x + D returns a scalar according to the equations you have specified.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with System Identification Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!