-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawData.m
executable file
·33 lines (27 loc) · 992 Bytes
/
drawData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [] = drawData(dataCell, mu, sigma, compNo)
%This function plots the graphs for data and mixture of gaussians for each
%case
xCoordinates = dataCell{1}';
yCoordinates = dataCell{2}';
for k=1:3 % For each gaussian case
figure(k);
hold on;
plot(xCoordinates(1:1000), yCoordinates(1:1000), 'bo');
plot(xCoordinates(1001:2000), yCoordinates(1001:2000), 'r+');
plot(xCoordinates(2001:3000), yCoordinates(2001:3000), 'g*');
legend('sample A', 'sample B', 'sample C');
xlabel('x1')
ylabel('x2')
% Draw mixture of gaussians
for i=1:3 % For each class
muD = mu{i,k};
sigmaD = sigma{i,k};
for j=1:compNo % For each component
h = plotGaussianEllipsoid(muD(j,:), sigmaD(:,:,j));
plot(muD(j,1), muD(j,2), 'k.');
set(h, 'color' , 'k', 'linewidth', 2);
end
end
hold off;
end
end