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

9 views (last 30 days)
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);

Accepted Answer

Jalaj Gambhir
Jalaj Gambhir on 11 Nov 2019
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);

More Answers (1)

Lara Hammer
Lara Hammer on 14 Nov 2019
Thank YOU! It worked!

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!