function Plot_GMM(X, pri, mu, sigma)
% Plot_GMM      Plot the original score distribution and their approximation
%               by using two Gaussian distributions
%
% Synopsis:     Plot_GMM(X, pri, mu, sigma);
%
% Input:        X           = the scores of the whole class
%               pri         = prior of two groups
%               mu          = mean of two groups
%               sigma       = standard deviation of two groups

x = 0:0.1:100;
y1=(1/((2*pi)^(1/2)*sigma(1)))*exp((-1/2)*((x-mu(1))/sigma(1)).^2)*pri(1);
y2=(1/((2*pi)^(1/2)*sigma(2)))*exp((-1/2)*((x-mu(2))/sigma(2)).^2)*pri(2);

histogram = hist(X, 20);

figure;
subplot(121), hist(X,20), axis([0 100 0 max(histogram) + 1]);
subplot(122), plot(x, y1,'-b', x, y2, '-r');
legend(['\pi_1 = ' num2str(pri(1))], ['\pi_2 = ' num2str(pri(2))]);
set(legend,'Location','NorthEast');
