How can I use fminunc or fminsearch to minimize and f-divergence measure?
3 views (last 30 days)
Show older comments
I am trying to solve a non-linear optimization problem but I see that fminunc and fminsearch take scaler inputs and give scaler outputs.
I'd like to use non-linear optimization functions to compute distance measure between two curves as follows :
KL(t, X) = sum(input(t) * (log(input(t)) - output(t, X))
I would like to determine X such that the entire function is minimized where X is a vector.
Accepted Answer
Alan Weiss
on 22 Feb 2016
I don't know why you think that fminunc and fminsearch take scalar inputs, when their documentation clearly states that they take vector (or even array) inputs. They do insist on objective functions that return real scalar outputs, but that is different.
You are free to minimize your function using either of these minimizers. fminunc would almost certainly be faster and more reliable.
Alan Weiss
MATLAB mathematical toolbox documentation
2 Comments
Alan Weiss
on 23 Feb 2016
Perhaps you are confused about what a scalar objective function is. Your objFun returns a vector. An objective function needs to be a scalar. The reason for this is that only scalars are ordered, meaning you cannot say whether one vector is greater than another. Is [1,2] larger or smaller than [2,1]? The question makes no sense.
So if you want to find a minimum of something, that something has to be a scalar, not a vector or array.
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (0)
See Also
Categories
Find more on Problem-Based Optimization Setup in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!