fminsearch, problem with option specification
1 view (last 30 days)
Show older comments
Hello,
I have a vector V. I have an error depending on the components. I want the error to be as lower as possible so I though of using fminsearch.
V = fminsearch(@(V) myerror(V,par_1,par_2,par_3),Vo)
The problem is that I need V1<V2<...<Vn and Vi∈[1,1000](for all i). By the moment, I think there is not possibility to include such conditions with "optimset"
I would appreciate any advice.
Thanks a lot
0 Comments
Accepted Answer
Alan Weiss
on 14 May 2014
This type of constraint (V1 < V2 < ...) is called a linear constraint. Generally, Optimization Toolbox solvers can include linear constraints by using a constraint matrix of the form
A*x <= b
where
A = [1,-1,0,0,0...
0,1,-1,0,0,...
...
0,0,...,1,-1]
and b is a vector of zeros. The fmincon function can handle this kind of nonlinear problem with linear constraints.
The bounds on the V(i) can be handled by passing lb = ones(size(x0)) and ub = 1000*lb .
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!