Does that seem correct?
top_x = pop(b(1:options.topSize),:)
The code for Generating the initial population is This:
M = 50; % population size
n = 2;
pop = -50 + 100.*rand(M,n);
. This is done in a for loop. See Here for the entire code figure;
scatter(pop(:,1), pop(:,2), 'x'); and
figure;
scatter(top_x(:,1),top_x(:,2), 'x');
% Criteria for selecting top 'topSize' individuals based on fitness
% values(eval)
if strcmp(options.optmType, 'min')
[void, b] = sort(eval, 'descend'); % maximising
else
[void, b] = sort(eval, 'ascend'); % minimising
end
pop = pop(void);
top_x = pop(b(1:options.topSize),:); % select top individuals
optm_x = pop(b(1),:); % save optimal parameter
fv = eval(b(1)); % save optimal func. value
Subscript indices must either be real positive integers or logicals.
Error in ==> Imp
pop = pop(void);
void = round(void)
pop = pop(void)
??? Index exceeds matrix dimensions.
Error in ==> Imp at
pop = pop(void);
pop = mvnrnd(mu,Sigma,M)
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
split53 challenge | 7 | 77 | |
c++ reading data from file into two dimensional array | 3 | 93 | |
Plain Text Editor for iPad | 6 | 55 | |
Remove Password Protection from pdf (with password) using an command line executable | 5 | 22 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!