header image
[ # ] Unconstrained Optimization
August 13th, 2015 under Programming

MATLAB/GNU Octave offers simple ways to find the minimum of any function. The two easiest methods are

1
fminsearch
fminsearch
and
1
fminunc
fminunc
. The former uses a simplex search method while the latter uses a gradient based method.

Here is a simple example for a lognormal parameter estimation:

1
2
3
4
x = sort([0.0027400 0.0093730 0.0458460 0.0135300])
y = (1:length(x))./(length(x)+1)
fun = @(p) sum( (logninv(y,p(1),p(2)) - x).^2)
estimate = fminsearch(fun,[-5;2])
x = sort([0.0027400 0.0093730 0.0458460 0.0135300])
y = (1:length(x))./(length(x)+1)
fun = @(p) sum( (logninv(y,p(1),p(2)) - x).^2)
estimate = fminsearch(fun,[-5;2])



Flickr
Scuba DivingEigerEiger, MönchKleine Scheidegg

View All Photos

Recent Posts
Quotes
Boyd: God says you look for excuses to be alone.
Dr. House: See, that is exactly the kind of brilliance that sounds deep, but you could say it about any person who doesn't pine for the social approval of everyone he meets - which you were cleverly able to deduce about me by not being a moron. Next time, tell God to be more specific.”
IP
[FSF Associate Member]
[FSF Associate Member]
Michael Pfeuti
Profil von Michael Pfeuti auf LinkedIn anzeigen
profile for Michael Pfeuti at Stack Overflow, Q&A for professional and enthusiast programmers