Failure in initial objective function evaluation. FMINCON cannot continue.

Hi
I'm trying to optimize a system with the fmincon function and i'm using an erreurtest (ER = erreurtest(a,b,c,d,AP)) function that uses the first function ([tab_xy] = parcourstest (a,b,c,d,AP)) as well. When the fmincon function is disable, everything works out but when i'll trying to run it, I have a not enough input arguments in the line of the 2nd function.
Message error as shown:
Not enough input arguments.
Error in erreurtest (line 11)
[tab_xy] = parcourstest(a,b,c,d,AP);
Error in fmincon (line 536)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in ProjetMEC729 (line 33)
fmincon(@erreurtest,x0,A,B,Aeq,Beq,lb,ub)
Caused by:
Failure in initial objective function evaluation. FMINCON cannot continue.

 Réponse acceptée

3 commentaires

Thank you for your time
Not sure if I get the parameterizing point? I've been trying with the erreurtest but I'm seeing to be creating other problems.
fmincon(@(a) erreurtest(a,b,c,d,AP), x0, A, B, Aeq, Beq, lb, ub)
Presuming, that is, that b, c, d, and AP are to be considered constants for the purpose of minimization with changing a, and x0 is the same size as a is.
If instead you are trying to find the values of a, b, c, d, AP that together minimize erreurtest and they are all scalars, then you should be using
fmincon(@(x) erreurtest(x(1),x(2),x(3),x(4),x(5)), x0, A, B, Aeq, Beq, lb, ub)
and x0 would have to be a vector of length 5.
Thank you very much it works now!!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by