Objective function
function z=my_fun(x)z=x(1)+2*x(2)+56*x(3)+100;
constrain function
function [c]=const(x)x=[6,3,4];c1=(6<=x(1)<=100);c2=(2<=x(2)<=4);c3=(2<=x(3)<=4);c=[c1;c2;c3];
main script
clear allclcnvars=3;LB=[6 2 2];UB=[100 4 4];[x, fval]=ga(my_fun,nvars,[],[],[],[],[],[],LB,UB,@const)
when excecuted getting error
Error using ga (line 305)Tenth input argument must be a valid structure created with GAOPTIMSET.Error in start (line 6)[x, fval]=ga(@my_fun,nvars,[],[],[],[],[],[],LB,UB,@const)
please help me by necessary changes to coding..
Best Answer