% Filename: Albinism.m
% M-file for determining the probability of child with two albinism
% carrying parents being
% (a) an albinism carrier (Aa,aA)
% (b) have no albinism alleles (AA)
% (c) albino (aa)
% Set how many times to run the experiment
N = 1000;
% Set variables to sum up probabilities
A = 0; % sum of heterozygous probabilities
B = 0; % sum of homozygous dominant probabilities
C = 0; % sum of homozygous recessive probabilities
for i = 1:N
% Set counters
a = 0; % heterozygous counter
b = 0; % homozygous dominant counter
c = 0; % homozygous recessive counter
for j = 1:N
% Get childs genotype if both parents are carriers
child = OneChild(1,1);
% Increase appropriate counter
if child == 1
a = a + 1;
elseif child == 2
b = b + 1;
else
c = c + 1;
end
end
% Add the probabilities for this set of N experiments
% to the running sum
A = A + a/N;
B = B + b/N;
C = C + c/N;
end
% Print out results
fprintf('P(carrier of albinism) = %6.4f\n',A/N);
fprintf('P(has albinism) = %6.4f\n',C/N);
fprintf('P(no recessive alleles) = %6.4f\n',B/N);