function rbf2(x, y, xt, yt)

sigmas = 0.5:0.5:2;
figure; hold on;
plotstr = ['bo-';'r^-';'k+:'];
for k = 2:4,
	errs = zeros(size(sigmas));
	for si = 1:length(sigmas), sigma = sigmas(si);
		tit = ['K = ', int2str(k), ', sigma = ', num2str(sigma)];
	
		u = cluster(x, k);
		w = rbf2weight(x, y, u, sigma);
	
		ye = yt' - exp(-dist2(xt, u)/(2*sigma^2)) * w;
		err = sqrt(mean(ye .* ye))^2; errs(si) = err;
		disp([tit ', err = ', num2str(err)]);
	end
	plot(sigmas, errs, plotstr(k-1,:));
end

legend('K = 2', 'K = 3', 'K = 4');
xlabel('sigma');
ylabel('mean squared error');
