function gaussian mu1=10; % mean of the first gaussian sigma1=3; % standard deviation n1 = 20; % number of examples from the first Gaussian x1=normrnd(mu1, sigma1, n1, 1); % generate 20 random numbers from the above gaussian mu2=20; % mean of the second gaussian sigma2=5; % standard deviation n2 = 10; % number of examples x2=normrnd(mu2, sigma2, n2, 1); % generate 20 random numbers from the above gaussian compute(x1, x2, n1, n2); end function compute(x1, x2, n1, n2) xbar1 = mean(x1) sx1 = std(x1)/sqrt(n1) xbar2 = mean(x2) sx2 = std(x2)/sqrt(n2) %decision boundary dec = (sx1*xbar2 + sx2*xbar1) / (sx1 + sx2) end