Why does my nonlinear constraint return "not enough input arguments"?
Show older comments
TranchesVIL takes a 1x4 input, fun3 takes a 1x3 input. par0 is 1x3.
fun3=@(X)sum(sum((TranchesVIL(phi,X0,sigma,[alpha,X],r,R,L(2:6),U(2:6),T,n,s)-CDO(2:6,:)).^2));
nonlcon2=@(X)nonlcon(sigma,X);
[X_j(k,:),SSE_CDO(k)]=fmincon(fun3,par0,[],[],[],[],lb_alpha(2:4),ub_alpha(2:4),@nonlcon,optionsT);
nonlcon is defined as follows:
function [c,ceq] = nonlcon(sigma,x)
ceq=0;
c=sigma+x(3)*(x(1)^2+x(2)^2)-0.7;
end
sigma is a 1x115 vector of variables.
The entire error I recieve is:
Not enough input arguments.
Error in nonlcon (line 3)
c=sigma+x(3)*(x(1)^2+x(2)^2)-0.7;
Error in fmincon (line 622)
[ctmp,ceqtmp] = feval(confcn{3},X,varargin{:});
Error in main (line 68)
[X_j(k,:),SSE_CDO(k)]=fmincon(fun3,par0,[],[],[],[],lb_alpha(2:4),ub_alpha(2:4),@nonlcon,optionsT);
Caused by:
Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.
Why do I recieve this error? If the x inserted in the objective function is a 1x3, then is it not the same 1x3 that is inserted into the nonlcon and hence there are sufficient input arguments?
Accepted Answer
More Answers (0)
Categories
Find more on Nonlinear Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!