GA Optimization running. Error running optimization. Not enough input arguments. what to do

3 views (last 30 days)
my function is simple 3 variables as shown bellow
function x = material(s,f,d)
x = (-0.552042 - (6.39734e-005*(s)) + (14.3154 (f)) + (0.261111 (d))); end and while running GA i get "not enough input arguments" This is the first time iam using GA tool so any one please help me with this problem. And specify any other steps that has to done in GA optimization tool.

Answers (1)

A Jenkins
A Jenkins on 8 Jan 2015
function [s_star,f_star,d_star]=find_optim()
nvars=3; %s, f, d
options=gaoptimset(@ga); % defaults, but you will need to change things
options=gaoptimset(options,'PlotFcns',{@gaplotbestf,@gaplotbestindiv});
x_star=ga(@material,nvars,options);
s_star=x_star(1); f_star=x_star(2); d_star=x_star(3);
end
function x = material(x)
s=x(1); f=x(2); d=x(3);
x = (-0.552042 - (6.39734e-005*s) + (14.3154*f) + (0.261111*d));
end

Categories

Find more on Get Started with Optimization Toolbox 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!