Ng=100; % Number of genes w=randn(1,Ng); % IQ effect of each allele Np=1000; % Population size g=rand(Ng,Np)<.5; % Initial population, 50% mixture of all alleles ff=[]; % Store mean IQ change=1e6; % Generation to modify fitness. for generation=1:100 iq = 100+w*g*3; % Calculate individual IQ ff=[ff mean(iq)]; if (generation