i'm getting Error using ga (line 305) help me
Show older comments
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 all
clc
nvars=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..
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots 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!