Hi, can you help me in finding a solution for the error of last line in this program that deals with ACO. this step is (feval): the error text is ( no enough argument- noting that I have tried diferent functions like "Ackley"- Thanks
Show older comments
function [x,y, minvalue] = AA(func)
% Example [x, y,minvalue] = AA('Foxhole')
clc;
tic;
subplot(2,2,1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plot 1 draw(func); title([func, ' Function']);
Ant=100; ECHO=200;
step=0.01*rand(1); temp=[0,0];
start1=-100; end1=100; start2=-100; end2=100; Len1=(end1-start1)/Ant; Len2=(end2-start2)/Ant;
for i=1:Ant X(i,1)=(start1+(end1-start1)*rand(1)); X(i,2)=(start2+(end2-start2)*rand(1));
val=feval(func,[X(i,1),X(i,2)]);
3 Comments
Hatim Abood
on 16 Aug 2014
Geoff Hayes
on 16 Aug 2014
Hatim - please format the above code so that it is useable. Highlight the code and press the {} Code button.
As for the error message not enough input arguments, what is the signature for func? You are calling feval as
val=feval(func,[X(i,1),X(i,2)]);
passing in a single input vector. Are you sure that it is a vector that func requires and not two separate input parameters?
Hatim Abood
on 18 Aug 2014
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown 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!