From: Hugo on
hi everybody
I´m new in this forum.
What I would like to know is how can I fix an error on my Matlab program.
The program is a Finite element updating program for structural static analysis that controls Ansys and get the results to Matlab that optimizes it with an objective function.
The error message is about the objective function: The errors are:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%
End diagnostic information

??? Error using ==> c:/matlab6p5/toolbox/optim/private/nlconst
FUN must return a non-empty objective function.

Error in ==> C:\MATLAB6p5\toolbox\optim\fmincon.m
On line 458 ==> [X,FVAL,lambda,EXITFLAG,OUTPUT,GRAD,HESSIAN]=...

Error in ==> C:\hUGO_rar\exper33x.m
On line 206 ==> [x, fval, exitflag, output, lambda] = ...


My objective function code is defined as:

options = optimset('LargeScale','off','Display','iter','Diag nostics','on'...
,'MaxFunEvals',300,'MaxIter',4,'DiffMaxChange',1e+ 1,'DiffMinChange',1.0e-001,'TolFun',1.0e-04);
[x, fval, exitflag, output, lambda] = ...
fmincon(@MACfun6x,x0,[],[],[],[],LB,UB,[],options)

can you please tell me what might be wrong?
thanks and regards
Lopessilva
From: Alan Weiss on
On 5/14/2010 1:25 PM, Hugo wrote:
> hi everybody
> I´m new in this forum.
> What I would like to know is how can I fix an error on my Matlab program.
> The program is a Finite element updating program for structural static
> analysis that controls Ansys and get the results to Matlab that
> optimizes it with an objective function. The error message is about the
> objective function: The errors are:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%
> End diagnostic information
> ??? Error using ==> c:/matlab6p5/toolbox/optim/private/nlconst
> FUN must return a non-empty objective function.
>
> Error in ==> C:\MATLAB6p5\toolbox\optim\fmincon.m
> On line 458 ==> [X,FVAL,lambda,EXITFLAG,OUTPUT,GRAD,HESSIAN]=...
>
> Error in ==> C:\hUGO_rar\exper33x.m
> On line 206 ==> [x, fval, exitflag, output, lambda] = ...
>
>
> My objective function code is defined as:
>
> options = optimset('LargeScale','off','Display','iter','Diag
> nostics','on'...
> ,'MaxFunEvals',300,'MaxIter',4,'DiffMaxChange',1e+
> 1,'DiffMinChange',1.0e-001,'TolFun',1.0e-04);
> [x, fval, exitflag, output, lambda] = ...
> fmincon(@MACfun6x,x0,[],[],[],[],LB,UB,[],options)
>
> can you please tell me what might be wrong?
> thanks and regards
> Lopessilva

Your function file MACfun6x.m is not returning a value.
Check its definition.

Alan Weiss
MATLAB mathematical toolbox documentation