www.gusucode.com > GAVPai_Book_MathworksCntrlFileEx_May2019 > GAVPai_Book_MathworksCntrlFileEx_May2019/realnumber_unifrm_mutation.m
% Evolution Strategy: mutation operator % mutation ensures that the mutated gene lies within their respective bounds function mutated_popln = realnumber_unifrm_mutation(chromo_popln, gene_bounds, mut_rate) [popln_size,genes] = size(chromo_popln); for i = 1 : popln_size for j = 1 : genes rno = rand; if (rno < mut_rate) % mutate the gene chromo_popln(i,j) = gene_bounds(1,1) + rno * (gene_bounds(1,2)- gene_bounds(1,1)); end end end mutated_popln = chromo_popln;