필터 지우기
필터 지우기

greybox linear model error

조회 수: 1 (최근 30일)
Imisi Jo
Imisi Jo 2017년 7월 11일
댓글: Imisi Jo 2017년 7월 18일
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

채택된 답변

Prashant Arora
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.
  댓글 수: 1
Imisi Jo
Imisi Jo 2017년 7월 18일
Ah of course! Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by