diff --git a/gauss_class/gauss_class_2D.m b/gauss_class/gauss_class_2D.m index 473afbd..cdc8d2c 100644 --- a/gauss_class/gauss_class_2D.m +++ b/gauss_class/gauss_class_2D.m @@ -2,6 +2,10 @@ % Rui Kuang % Demonstration of Classification by 2-D Gaussians +clf; +prior1 = 0.3; +prior2 = 0.7; + mu1 = [-1 -1]; mu2 = [1 1]; @@ -27,13 +31,13 @@ mu2 = [1 1]; [X1,X2] = meshgrid(x1,x2); %pdf1 F1 = mvnpdf([X1(:) X2(:)],mu1,Sigma1); -F1 = reshape(F1,length(x2),length(x1)); +F1 = reshape(prior1 * F1,length(x2),length(x1)); subplot(1,2,1); surf(x1,x2,F1); hold on; %pdf2 F2 = mvnpdf([X1(:) X2(:)],mu2,Sigma2); -F2 = reshape(F2,length(x2),length(x1)); +F2 = reshape(prior2 * F2,length(x2),length(x1)); surf(x1,x2,F2); caxis([min(F2(:))-.5*range(F2(:)),max(F2(:))]); axis([-4 4 -4 4 0 .4])