On 4/7/2016 7:39 AM, Nana wrote:
> I want to optimize p from testfun(). However I want to return additional
> output variable (b) from the optimization.
>
> Function [p, b] = testfun()
>
> x = fmincon(@testfun, x0,options)
>
> where b is the additional variable passed to fsolve, I am looking to
> achieve something like this,
> [x,b] = fmincon(x0,options)
>
> How can I do that?
> Thx
> Nana
The easiest way might be to use a nested function along these lines:
http://www.mathworks.com/help/optim/ug/passing-extra-parameters.html#brhkghv-10
Alan Weiss
MATLAB mathematical toolbox documentation
> I want to optimize p from testfun(). However I want to return additional
> output variable (b) from the optimization.
>
> Function [p, b] = testfun()
>
> x = fmincon(@testfun, x0,options)
>
> where b is the additional variable passed to fsolve, I am looking to
> achieve something like this,
> [x,b] = fmincon(x0,options)
>
> How can I do that?
> Thx
> Nana
The easiest way might be to use a nested function along these lines:
http://www.mathworks.com/help/optim/ug/passing-extra-parameters.html#brhkghv-10
Alan Weiss
MATLAB mathematical toolbox documentation