|
"Steven Lord" <slord@mathworks.com> wrote in message <hcc8uh$h4$1@fred.mathworks.com>...
>
> "Q Zhang" <silence_qunzi@hotmail.com> wrote in message
> news:hcbsr1$icd$1@fred.mathworks.com...
> > Here is my optimization problem:
> > a is 3*1 vector which is equal to cap which is also a 3*1 vector with real
> > value.
> >
> > [a,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = ...
> > fmincon(@function,a0,aeqa,beqa,[],[],lba,uba,@mycon,...,
> > optionsa,b,c,d,e);
> >
> > function [c,ceq]=mycon(a)
> > ceq=a-cap;
> > c=[];
> >
> > "Error: Too many input arguments.
> >
> > Error in ==> equil_3investors_know_onlytype_new at 93
> > [a] = ..."
> >
> > I am wondering to use ceq to construct the linear constraint problem but
> > it doesnt work. Could someone help me a bit about this?
>
> If you specify additional inputs to FMINCON in this way, intending for them
> to be passed into your objective function, your nonlinear constraint
> function MUST also accept those additional inputs, even if it doesn't need
> or want to use them.
>
> If you're using MATLAB 7.0 (R14) or later and instead use an anonymous
> function to specify your objective function:
>
> a = 1;
> b = 2;
> c = 3;
> d = 4;
> e = 5;
> [a,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = ...
> fmincon(@(x) function(x, a, b, c, d,
> e),a0,aeqa,beqa,[],[],lba,uba,@mycon,...,
> options);
>
> then your constraint function doesn't have to accept any additional inputs.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
Many thanks Steven !! It works now:)
|