From: student melaku fekadu on
hellow users,
i am not a matlab user, but i need to use it to do numerical optimization. ineed to estimate 54 parameters and fminsearch is not helping. i am really having a hard time with fminsearch. so i wanted to use fminunc instead. i just replaced fminunc instead of fminsearch as seen below. my question: is the way i use fminunc as written below okay?

if not, how should i write it?
if yes, how fast is fminunc compared to fminsearch!

i really appreciate any help.
thanks,
melaku

my_options = optimset;
my_options.Display = 'iter';
my_options.TolFun = 1e-3;
my_options.MaxIter = 500;
my_func = @(x) objective_function(x, bla, blabla, blablabla)
disp(sprintf('now minimizing (simplex) %s parameters...')
[x fval exitflag output] = fminunc(my_func, x0, my_options)
From: John D'Errico on
"student melaku fekadu" <melaku.fekadu(a)gmail.com> wrote in message <i2daf3$237$1(a)fred.mathworks.com>...
> hellow users,
> i am not a matlab user, but i need to use it to do numerical optimization. ineed to estimate 54 parameters and fminsearch is not helping. i am really having a hard time with fminsearch. so i wanted to use fminunc instead. i just replaced fminunc instead of fminsearch as seen below. my question: is the way i use fminunc as written below okay?
>
> if not, how should i write it?
> if yes, how fast is fminunc compared to fminsearch!
>
> i really appreciate any help.
> thanks,
> melaku
>
> my_options = optimset;
> my_options.Display = 'iter';
> my_options.TolFun = 1e-3;
> my_options.MaxIter = 500;
> my_func = @(x) objective_function(x, bla, blabla, blablabla)
> disp(sprintf('now minimizing (simplex) %s parameters...')
> [x fval exitflag output] = fminunc(my_func, x0, my_options)

You were wasting your time trying to optimize over 54
parameters with fminsearch. 6 is my recommended
upper limit. In a desperate moment, 8 or so will run.

54 parameters in fminsearch will run like a dog with
1 leg.

Your call to fminunc is fine.

John
From: student melaku fekadu on

John,

thanks for your swift response.

As my problem is numerical opt, I am not giving derivatives. so with fminunc I get some warning which says that line search method is used. I am running it now just for an hour, and it did not do yet the first iteration. Does it take a long time until it does the first iteration? Fminsearch does this within 5 minutes or so.

Should I wait or I am missing something?



Thanks John,
Melaku


"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <i2dc2k$8kn$1(a)fred.mathworks.com>...
> "student melaku fekadu" <melaku.fekadu(a)gmail.com> wrote in message <i2daf3$237$1(a)fred.mathworks.com>...
> > hellow users,
> > i am not a matlab user, but i need to use it to do numerical optimization. ineed to estimate 54 parameters and fminsearch is not helping. i am really having a hard time with fminsearch. so i wanted to use fminunc instead. i just replaced fminunc instead of fminsearch as seen below. my question: is the way i use fminunc as written below okay?
> >
> > if not, how should i write it?
> > if yes, how fast is fminunc compared to fminsearch!
> >
> > i really appreciate any help.
> > thanks,
> > melaku
> >
> > my_options = optimset;
> > my_options.Display = 'iter';
> > my_options.TolFun = 1e-3;
> > my_options.MaxIter = 500;
> > my_func = @(x) objective_function(x, bla, blabla, blablabla)
> > disp(sprintf('now minimizing (simplex) %s parameters...')
> > [x fval exitflag output] = fminunc(my_func, x0, my_options)
>
> You were wasting your time trying to optimize over 54
> parameters with fminsearch. 6 is my recommended
> upper limit. In a desperate moment, 8 or so will run.
>
> 54 parameters in fminsearch will run like a dog with
> 1 leg.
>
> Your call to fminunc is fine.
>
> John