Quantcast
Channel: MATLAB Central Newsreader - tag:"optimization"
Viewing all articles
Browse latest Browse all 130

Re: Return additional output in optimization

$
0
0
Alan Weiss <aweiss@mathworks.com> wrote in message <ne5m6f$k02$2@newscl01ah.mathworks.com>...
> 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

Hi Alan,

Can you give an explicit example to do it using nested function? Because on the link you gave me only return x and fval as outputs.

Viewing all articles
Browse latest Browse all 130

Trending Articles