Tuesday, 15 May 2012

What do the Brackets in MATLAB's ga function do? -



What do the Brackets in MATLAB's ga function do? -

on this page, matlab's genetic algorithm used as:

objectivefunction = @simple_fitness; nvars = 2; % number of variables lb = [0 0]; % lower bound ub = [1 13]; % upper bound constraintfunction = @simple_constraint; [x,fval] = ga(objectivefunction,nvars,[],[],[],[],lb,ub, ... constraintfunction)

what brackets in function, , why there 4 of them? noticed if remove [], error ga requires next inputs of info type double: 'ub'.

i have been trying utilize ga solve optimization problem different constraints, not input them function , not find info on brackets do.

[] means not specify inputs, squared brackets required because define other inputs after non-specified ones. reason many functions input arguments identified 'number', order. if remove [] above illustration matlab think defined different input argument intended/original.

matlab

No comments:

Post a Comment