Error in fmincon while I have the optimization toolbox
7 views (last 30 days)
Show older comments
I just registered a trial version and activated it today. When I use the "ver" command, I can see the "optimization toolbox" installed. However, I am unable to run the following code:
% Define the objective function
fun = @(x) (x(1) - 1)^2 + (x(2) - 2.5)^2;
% Set the initial point and bounds
x0 = [0,0]; lb = [-1,-1]; ub = [3,3];
% Run the optimizer
options = optimoptions('fmincon','Display','iter');
[x,fval] = fmincon(fun,x0,[],[],[],[],lb,ub,[],options);
% Display the results
disp(x); disp(fval);
The error message I receive is:
"Function or variable 'eml_option' is not recognized.
Error in optim.coder.validate.checkProducts
Error in fmincon
Error in bayes_al (line 11) [x,fval] = fmincon(fun,x0,[],[],[],[],lb,ub,[],options);"
Could you please help me with this issue?
4 Comments
Torsten
on 20 Feb 2023
You didn't anwer my question: Do you somewhere use a Function or variable 'eml_option' ?
As you can see above, your code works in R2022b, and I guess this is the same as your test version.
What if you use
% Define the objective function
fun = @(x) (x(1) - 1)^2 + (x(2) - 2.5)^2;
% Set the initial point and bounds
x0 = [0,0]; lb = [-1,-1]; ub = [3,3];
[x,fval] = fmincon(fun,x0,[],[],[],[],lb,ub);
% Display the results
disp(x); disp(fval);
Answers (0)
See Also
Categories
Find more on Surrogate Optimization 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!