I am trying to solve a bar optimization problem, passing the initial conditions (the area of each bar) and all variables as a struct but I am facing the following problem:
"Failure in initial objective function evaluation. FMINCON cannot continue."fem = struct(... 'x',x0,... % Initial set of points 'NODE',NODE,... % [NNode x 2] array of nodes 'ELEM',ELEM,... % [NElem x 2] array of elements 'v',{v},... % Cell defining the variables 'NNode',size(NODE,1),... % Number of nodes 'NElem',size(ELEM,1),... % Number of elements 'NVar',size(v,1)... % Number of variables ); Plot10bar(fem); mass = GetMass10bar(fem); fprintf('Initial Mass = %f\n',mass); [x,fval,exitflag,output,lambda,grad,hessian] = ... fmincon(@GetMass10bar,x0,[],[],[],[],lb,ub,@GetConstraints10bar,options); mass = GetMass10bar(fem); fprintf('Final Mass = %f\n',mass); Plot10bar(fem);
Thank you,
André Leitão
Best Answer