IDGREYMODEL - Too many inputs - but only one input - Help please

5 次查看(过去 30 天)
Hi,
I am trying to make a grey box model for my thermal network of a zone. I get the error
Error using idgrey (line 372)
The ODE function "Thermalzone" could not be evaluated successfully using the given set of parameters, sample time and optional arguments.
The error message generated during the evaluation was:
Too many input arguments.
Error in graamodell (line 7)
sys = idgrey(odefun,parameters,fcn_type);
However Ionly have one Input. I cant see how this is happening.
The code I have made is here:
%For the ODE function thermal zone
function [A,B,C,D] = Thermalzone(R1C1)
A=-1/(R1C1);
B=transpose([1/(R1C1), 1/(R1C1), 1/(R1C1), 1/(R1C1)]);
C=1;
D=transpose([0 0 0 0]);
end
%For the ID grey model
odefun = 'Thermalzone';
R1C1=0.3*0.4;
parameters={'R1C1', R1C1;};
fcn_type = 'c';
sys = idgrey(odefun,parameters,fcn_type);

采纳的回答

Jalaj Gambhir
Jalaj Gambhir 2019-11-11
Hi,
The first issue is the missing Ts parameter. The value of Ts parameter is set based on the value of ‘fcnType’ (if not provided inside idgrey). Have a look here. But solving this issue alone does not solve the problem.
The next issue is the usage of transpose in the variables ‘B’ and ‘D’. The sizes for the terms should be consistent while solving the ODE. The matrix shape expected are mentioned here. The correct function definition:
%For the ODE function thermal zone
function [A, B, C, D] = Thermalzone(R1C1,Ts)
A= -1/(R1C1);
B= [1/(R1C1), 1/(R1C1), 1/(R1C1), 1/(R1C1)];
C= 1;
D= [0 0 0 0];
end
%For the ID grey model
odefun = 'Thermalzone';
R1C1=0.3*0.4;
parameters={'R1C1', R1C1};
fcn_type = 'c';
sys = idgrey(odefun,parameters,fcn_type);

更多回答(1 个)

Lara Hammer
Lara Hammer 2019-11-14
Thank YOU! It worked!

类别

Help CenterFile Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by