Use simulannealbnd without specifying the Upper andd lower bound
1 view (last 30 days)
Show older comments
Is it possible to use the simulannealbnd without actually specifying the lowerbound and upper bound, yet adding ither options to the functions?
For ex for: [x,fval,exitflag,output] = simulannealbnd(fun,x0,lb,ub,options), I specified lb=[],ub=[]
I got error saying LB must be a double.
What could've been the problem?
0 Comments
Answers (2)
Sam Chak
on 1 Sep 2022
There is no issue in this example. Perhaps, try clearing lb and ub variables from the Workspace.
fun = @(x) x.^4 - 16*x.^2 + 5*x;
fplot(fun), grid on, xlabel('x'), ylabel('f(x)')
x0 = 0;
% lb = -5;
% ub = 5;
options = optimoptions(@simulannealbnd, 'MaxIterations', 150)
% x = simulannealbnd(fun, x0, lb, ub, options)
x = simulannealbnd(fun, x0, [], [], options)
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!