m = -20:1:60;
gn = 1./(sqrt(2*pi));
x1g = (gn./2)*exp((-1/2).*((m-8).^2)./4);
x1b = (gn./3)*exp((-1/2).*((m).^2)./9);
x2g = (gn./3)*exp((-1/2).*((m-10).^2)./9);
x2b = (gn./4)*exp((-1/2).*((m).^2)./16);

g = x1g'*x2g;
b = x1b'*x2b;
tot = (.8*g)+(.2*b);


for tct = 70:74
	thresh = 72*(tct-1)/10;
	perr = 0;
	for ct1 = 1:81
		x1 = ct1-21;
		for ct2 = 1:81
			x2 = ct2-21;
			d = 5*x1^2+(7/4)*x2^2-144*x1-80*x2+855.4752;
			d = -d;
			if(d > thresh)
				perr = perr + .2*b(ct1, ct2);
			end
		end
	end
	thv(tct) = perr;
end

return
for ct1 = 1:41
	x1 = ((ct1-1)*1)-10;
	for ct2 = 1:41
		x2 = ((ct2-1)*1)-10;
		pg(ct1, ct2) = (.8*g(ct1, ct2)./tot(ct1,ct2));
	end
end

%surf(m,m,pg);
shading('interp')
ylabel('NDIR')
xlabel('NDCR')
