idgrey error "too many arguments"

When executing the idgrey command that includes "optional arguments" MATLAB appears to insert a zero at the beginning of the list of optional arguments and it then throws the error that there are too many arguments in the call to my ode function named in the idgrey command. What's going on???
I have read and re-read the documentation on idgrey, but to no avail.
Thanks

9 comentarios

Geoff Hayes
Geoff Hayes el 7 de Ag. de 2016
Dave - please copy and paste the line or lines of code that is generating the error message, and copy and paste the full error message. We need to see how you are using idgrey in your code.
Please also show the output of
which -all idgrey
as it sounds as if you might have your own idgrey.m on your path.
Dave
Dave el 7 de Ag. de 2016
Editada: Walter Roberson el 7 de Ag. de 2016
Guys, here's the error message and the output from which -all idgret
Error using idgrey (line 368)
The ODE function "greymodHati_DKS" could not 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 GreyboxIDHati23ms_DKS (line 412)
sys = idgrey('greymodHati_DKS',parameters,'c',{ACState,ConstCoeff,AC},...
>> which -all idgrey
/Applications/MATLAB_R2014b/MATLAB_R2014b.app/toolbox/ident/ident/@idgrey/idgrey.m % idgrey constructor
The line of code that is generating the error is
sys = idgrey('greymodHati_DKS',parameters,'c',{ACState,ConstCoeff,AC},...
'InputName', InputName, 'OutputName', OutputName, ...
'StateName', StateName, 'InputDelay',Td*Ts);
Thanks for the quick response
Walter Roberson
Walter Roberson el 7 de Ag. de 2016
You provided the function greymodHati_DKS but the code for that function expects fewer parameters than idgrey needs to pass for your combination of parameters. Please show the "function" line for greymodHati_DKS
Dave
Dave el 7 de Ag. de 2016
Editada: Walter Roberson el 8 de Ag. de 2016
Here's the function line.
function [a,b,c,d] = greymodHati_DKS(Cm,CL,CQ1,ACState,ConstCoeff,AC)
and in the idgrey call "parameters" is a 3x2 cell array
an earlier direct call to this same function in my code completed successfully, so I can't understand why calling it through idgrey with the same number of arguments creates this error.
While trying to debug, I substituted "varargin" in the argument list in my function for the last three arguments, and instead of receiving the desired 3 structured arrays, it received a zero, then the three structured arrays.
Dave
Dave el 7 de Ag. de 2016
The 'parameter' array in the idgrey call was formed as instructed in the idgrey instructions. So idgrey should not be passing too many arguments, but it appears to be doing just that,
Dave
Dave el 7 de Ag. de 2016
Editada: Dave el 7 de Ag. de 2016
Here's the code that forms the parameters array
parameters = {'Cm',Cm;... 'CL',CL;... 'CQ1',CQ1};
Walter Roberson
Walter Roberson el 8 de Ag. de 2016
Which one of the variables named is the time input to the ode?
Dave
Dave el 8 de Ag. de 2016
there is no explicit time input. The ode function simply determines the ABCD matrix quadruple for the linear model of the ODEs.

Iniciar sesión para comentar.

 Respuesta aceptada

Dave
Dave el 9 de Ag. de 2016

2 votos

OK, here's the answer. Even though I found no mention of this in the documentation, "idgrey" passes the sampling interval "Ts" in the user supplied ode function input argument list, in addition to any additional arguments that need to passed. Consequently, since I passed just the list of arguments necessary, I received the error "Too many arguments." This issue was resolved by adding the dummy argument "Ts" in the ode function argument list, even though with a continuous system the sampling interval is known to be zero.

Más respuestas (0)

Categorías

Preguntada:

el 7 de Ag. de 2016

Respondida:

el 9 de Ag. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by