Hello Everybody!
I'm quite new to pso matlab toolbox and I would like to call some help.
I can't get this follow code working:
f = @(x,y)sin(sqrt(x.^2+y.^2))/sqrt(x.^2+y.^2);
nvar = 2;
[x,fval] = particleswarm(f, nvar);
Then the errors appears:
Error using particleswarm>makeState (line 700)
Failure in initial objective function evaluation. PARTICLESWARM cannot continue.
Error in particleswarm>pswcore (line 170)
state = makeState(nvars,lbMatrix,ubMatrix,objFcn,options);
Error in particleswarm (line 152)
[x,fval,exitFlag,output] = pswcore(objFcn,nvars,lbRow,ubRow,output,options);
Error in Untitled (line 5)
[x,fval] = particleswarm(f, nvar);
Caused by:
Not enough input arguments.
Despite it says that there's "Not enough input arguments.", I saw many examples that only required the function and the number of variables. What should I do?
I'm quite new to pso matlab toolbox and I would like to call some help.
I can't get this follow code working:
f = @(x,y)sin(sqrt(x.^2+y.^2))/sqrt(x.^2+y.^2);
nvar = 2;
[x,fval] = particleswarm(f, nvar);
Then the errors appears:
Error using particleswarm>makeState (line 700)
Failure in initial objective function evaluation. PARTICLESWARM cannot continue.
Error in particleswarm>pswcore (line 170)
state = makeState(nvars,lbMatrix,ubMatrix,objFcn,options);
Error in particleswarm (line 152)
[x,fval,exitFlag,output] = pswcore(objFcn,nvars,lbRow,ubRow,output,options);
Error in Untitled (line 5)
[x,fval] = particleswarm(f, nvar);
Caused by:
Not enough input arguments.
Despite it says that there's "Not enough input arguments.", I saw many examples that only required the function and the number of variables. What should I do?