fminsearch and multiple inputs to function

  • Follow


I am editing some legacy code in which fminsearch is implemented as,
[x, fval] = fminsearch('myfun', x, options, arg1, arg2, arg3) ;
where 'myfun' is the name of a saved function myfun.m that takes input
arguments x, arg1, arg2, and arg3, each of which are vectors (though
most with just one element).  myfun.m returns the value fval.  In the
input list to to fminsearch, x is the initial guess to start the
minimization of fval with respect to x.

The fminsearch documentation does not mention that the input arguments
to myfun can be listed after the optimization options.  Is it valid?
The code does work.  Is there a limit to how many input arguments
could be passed in?
0
Reply ke 5/12/2010 4:18:31 PM

ke <kateedwards11@hotmail.com> wrote in message <d799ad45-d7ef-42b6-b8d9-c92df98ae52a@e2g2000yqn.googlegroups.com>...
 
> The fminsearch documentation does not mention that the input arguments
> to myfun can be listed after the optimization options.  Is it valid?
> The code does work.  Is there a limit to how many input arguments
> could be passed in?

It's an older style now depreated, but still enabled for backward compatibility's sake.
0
Reply Matt 5/12/2010 4:26:08 PM


On 5/12/2010 12:26 PM, Matt J wrote:
> ke <kateedwards11@hotmail.com> wrote in message
> <d799ad45-d7ef-42b6-b8d9-c92df98ae52a@e2g2000yqn.googlegroups.com>...
>
>> The fminsearch documentation does not mention that the input arguments
>> to myfun can be listed after the optimization options. Is it valid?
>> The code does work. Is there a limit to how many input arguments
>> could be passed in?
>
> It's an older style now depreated, but still enabled for backward
> compatibility's sake.
To see the recommended way of passing extra parameters, see
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brhkghv-7.html

Alan Weiss
MATLAB mathematical toolbox documentation
0
Reply Alan 5/12/2010 6:55:34 PM

On May 12, 2:55=A0pm, Alan Weiss <awe...@mathworks.com> wrote:
> On 5/12/2010 12:26 PM, Matt J wrote:> ke <kateedward...@hotmail.com> wrot=
e in message
> > <d799ad45-d7ef-42b6-b8d9-c92df98ae...@e2g2000yqn.googlegroups.com>...
>
> >> The fminsearch documentation does not mention that the input arguments
> >> to myfun can be listed after the optimization options. Is it valid?
> >> The code does work. Is there a limit to how many input arguments
> >> could be passed in?
>
> > It's an older style now depreated, but still enabled for backward
> > compatibility's sake.
>
> To see the recommended way of passing extra parameters, seehttp://www.mat=
hworks.com/access/helpdesk/help/toolbox/optim/ug/brhkgh...
>
> Alan Weiss
> MATLAB mathematical toolbox documentation

Thanks to both of you!  Mystery solved.
0
Reply ke 5/12/2010 7:11:57 PM

3 Replies
591 Views

(page loaded in 0.663 seconds)

Similiar Articles:







7/21/2012 9:17:03 PM


Reply: