How do I solve this problem at the optimization toolbox?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2021-7-1
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!