|
On 2008-03-18 12:05:37 -0400, jimpx <falloncolm@gmail.com> said:
> Hello,
>
> I want to pass a number of variables through fminsearch. Because of the
> structure of the program, some of those variables must be held constant
> while the others are minimized. Is there a way to do this with
> fminsearch, or is there another minimization program which allows this?
>
> Thanks,
>
> jimpx
Write another (possibly anonymous) function that you use with
fminsearch. This anonymous function has for its inputs only those
variables you want to minimize with respect to, and others are help
constant. Here's an example using anonymous functions:
f = @(x,y) (x-y).^2; % A function of two variables
g = @(y) f(3, y); % Function "f", with x=3
yOpt = fminsearch(g, 0);
--Arthur
|