I am writing a maximum likelihood classifier using Matlab. it takes a 150x5 matrix as an argument, where 150 is the number of points and 5 is the number of features each point has, and picks 2 features that separate the points into different classes. The data points are generated from 2D normal distribution. My code so far separates the classes, calculates the probability that a particular point belongs to a certain class and plots the standard contouring. I am stuck on how to implement the code in Matlab that plots the decision regions. Here is my code so far:
Code:
function classifier (A)

B = find_features(A);
V = kmeans (B, 3);
separate_class(V);

mean_calc (Class_1, Class_2, Class_3);
covar_calc (Class_1, Class_2,Class_3);

x = [0:0.1:10]';
y = [0:0.1:10]';

Prob_cl1 = [];
Prob_cl2 = [];
Prob_cl2 = [];

calc_prob(mean_1, mean_2, mean_3, cov_1, cov_2, cov_3);

Pclass_1 = (1/(2*pi*sqrt(det(cov_1))))*exp(-1/2);
Pclass_2 = (1/(2*pi*sqrt(det(cov_2))))*exp(-1/2);
Pclass_3 = (1/(2*pi*sqrt(det(cov_3))))*exp(-1/2);

% plots the scatter and standard deviation
hold;
axis square;
plot(Class_1(:,1), Class_1(:,2), 'k.');
plot(Class_2(:,1), Class_2(:,2), 'r.');
plot(Class_3(:,1), Class_3(:,2), 'g.');
contour(x, y, Prob_cl1, [Pclass_1, Pclass_1], 'k.');
contour(x, y, Prob_cl2, [Pclass_2, Pclass_2], 'k.');
contour(x, y, Prob_cl3, [Pclass_3, Pclass_3], 'k.');

    % calculates probability for each point
    function calc_prob (mean_1, mean_2, mean_3, cov_1, cov_2, cov_3)
        for i = 1:length(x)
            for j = 1:length(y)
                Prob_cl1(j,i) = getprob(x(i), y(j), mean_1', cov_1);
                Prob_cl2(j,i) = getprob(x(i), y(j), mean_2', cov_2);
                Prob_cl3(j,i) = getprob(x(i), y(j), mean_3', cov_3);
            end
        end  
    end

    function separate_class(V)
        ind_1 = find (V == 1);
        ind_2 = find (V == 2);
        ind_3 = find (V == 3);
        
        for i = 1:1:50
            Class_1(i,:) = B(ind_1(i,:), :);
            Class_2(i,:) = B(ind_2(i,:), :);
            Class_3(i,:) = B(ind_3(i,:), :);
        end
            
    end
    
    % extracts the unique features into a new matrix
    function F = find_features(A)
        F = [A(:,3) A(:,5)];
    end
    
    % calculates mean for each class
    function mean_calc (class1, class2, class3)
        mean_1 = mean(class1);
        mean_2 = mean(class2);
        mean_3 = mean(class3);
    end

    % calculates covariance for each class
    function covar_calc (class1, class2, class3)
        cov_1 = cov(class1);
        cov_2 = cov(class2);
        cov_3 = cov(class3);
    end

    % calculates probability for each point
    function P = getprob(x, y, mean, covariance)
        vector = [x y]';
        E = 2*pi * sqrt(det(covariance));
        P = (1/E) * exp(-((vector-mean)' * inv(covariance) * (vector-mean) / 2));
    end

 end
How can I plot the decision regions for those three classes in Matlab?
Thanks