How do I solve this problem at the optimization toolbox?
2 views (last 30 days)
Show older comments
function Y = objective_function(X)
x1=X(1,1);
x2=X(1,2);
p00 = -9.601e+04;
p10 = -1031;
p01 = -4854;
p20 = 8810;
p11 = 404.4;
p02 = 359.8;
p21 = -228.4;
p12 = 165.8;
p03 = 356.1;
Y = p00 + p10*x(1) + p01*x(2) + p20*x(1).^2 + p11*x(1)*x(2) + p02*x(2).^2 + p21*x(1).^2*x(2) + p12*x(1)*x(2).^2 + p03*x(2).^3;
end
This is my code.
When I run a optimization toolbox, a problem such as the picture occur.
I'd appreciate your help. Thank you!
0 Comments
Accepted Answer
Star Strider
on 1 Jul 2021
It would llikely be easier to just call ga from a script —
lb = [-10 -6];
ub = [ 10 6];
nvars = 2;
[Xr,fval,exitflag,output,population,scores] = ga(@objective_function, nvars, [], [], [], [], lb, ub)
function Y = objective_function(X)
x(1)=X(1,1);
x(2)=X(1,2);
p00 = -9.601e+04;
p10 = -1031;
p01 = -4854;
p20 = 8810;
p11 = 404.4;
p02 = 359.8;
p21 = -228.4;
p12 = 165.8;
p03 = 356.1;
Y = p00 + p10*x(1) + p01*x(2) + p20*x(1).^2 + p11*x(1)*x(2) + p02*x(2).^2 + p21*x(1).^2*x(2) + p12*x(1)*x(2).^2 + p03*x(2).^3;
end
.
0 Comments
More Answers (0)
See Also
Categories
Find more on Nonlinear 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!