Not enough input arguments

3 次查看(过去 30 天)
Rakesh Jain
Rakesh Jain 2017-2-23
I simply did copy and paste of the program given in the following link as below. But it is showed an error "Not enough input arguments'
function y = simple_fitness(x)
y = 100 * (x(1)^2 - x(2)) ^2 + (1 - x(1))^2
FitnessFunction = @simple_fitness
numberOfVariables = 2
[x,fval] = ga(FitnessFunction,numberOfVariables)
What is the mistake which I am doing ?
  3 个评论
Rakesh Jain
Rakesh Jain 2017-2-23
Instead of running in a command window, can I make a separate file of it and then run it?
Walter Roberson
Walter Roberson 2017-2-23
Yes, you need to put functions into files; you cannot use the "function" keyword at the command line.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by