skip = 2;
xr = -180:skip:-80;
yr = -50:skip:200;
v=[];
p3 = [];
[blah xrange] = size(xr);
[blah yrange] = size(yr);
for xct = 1:xrange
	x = (xct-1)*skip-180;
	for yct = 1:yrange
		y=(yct-1)*skip-50;
		v = [x;y];		
		p1(xct, yct) = (1/((2*pi)^3/2))*exp((-1/2)*(v-m1')'*inv(sigg)*(v-m1'));
		p2(xct, yct) = (1/((2*pi)^3/2))*exp((-1/2)*(v-m2')'*inv(sigg)*(v-m2'));
		p3(xct, yct) = (1/((2*pi)^3/2))*exp((-1/2)*(v-m3')'*inv(sigg)*(v-m3'));
	end
end

return

%[aa bb q z v] = qz(Sb, Sw);


[vec val] = eig(inv(Sw)*Sb);
W = [vec(:,1) vec(:,2)];

y1 = W'*train1';
y2 = W'*train2';
y3 = W'*train3';
hold off
plot(y1(1,:), y1(2,:), 'x')
hold on
plot(y2(1,:), y2(2,:), 'red+')
plot(y3(1,:), y3(2,:), 'greenx')
return
if(1)
Sb = 0;
allmean = mean([mean(train1) mean(train2) mean(train3)]);
for i = 1:3
	if(i == 1)
		trainset = train1;
	else if(i==2)
		trainset = train2;
	else
		trainset = train3;
	end
	end
	[rows cols] = size(trainset);
	Sb = Sb + rows * ((mean(trainset)-allmean)'*(mean(trainset)-allmean));
	
end

else


Sw = 0;
for i = 1:3
	if(i == 1)
		trainset = train1;
	else if(i==2)
		trainset = train2;
	else
		trainset = train3;
	end
	end
	[rows cols] = size(trainset);
	m = mean(trainset);
	for r = 1:rows
		tmp = trainset(r,:)-m;
		Sw = Sw+(tmp'*tmp);
	end
end
end