Path: news.mathworks.com!not-for-mail
From: Alan_Weiss <aweiss@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: passing constraint parameters
Date: Tue, 04 Dec 2012 08:45:14 -0500
Organization: MathWorks
Lines: 34
Message-ID: <k9kupa$mla$1@newscl01ah.mathworks.com>
References: <k9kark$hfr$1@newscl01ah.mathworks.com> <k9kp70$44b$1@newscl01ah.mathworks.com>
Reply-To: aweiss@mathworks.com
NNTP-Posting-Host: ah-aweiss.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1354628714 23210 172.28.17.56 (4 Dec 2012 13:45:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Dec 2012 13:45:14 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2
In-Reply-To: <k9kp70$44b$1@newscl01ah.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:784142

On 12/4/2012 7:10 AM, Torsten wrote:
> "Frank " <allinone_2003@yahoo.com.hk> wrote in message 
> <k9kark$hfr$1@newscl01ah.mathworks.com>...
>> Hello, I want to pass extra parameters to constraint functions using 
>> fmincon.
>>
>> K = 1;
>> nonlin = @(x) fcon(x, K);
>>
>> My code is
>> y = fmincon(@(x)myfun5(x,t), x0, [], [], [], [], zeros(Lt^2+1, 1), 
>> [], nonlin, options);
>>
>> But an error occurs:
>>
>> Too many output arguments.
>> Caused by:
>>     Failure in initial user-supplied nonlinear constraint function 
>> evaluation. FMINCON cannot continue.
>>
>> Can anyone help?
>>
>> Thanks.
>
> Can you show us your "fcon"-function ?
>
> Best wishes
> Torsten.

Does fcon return both c and ceq?
http://www.mathworks.com/help/optim/ug/writing-constraints.html#brhkghv-16

Alan Weiss
MATLAB mathematical toolbox documentation