% demo of steepest descent

A = [1 1 0 0; 0 0 1 1];
y = [4; 6];
% A \ y

x = zeros(size(A,2),1);
plot(x(1), x(2), 'o')
axis([0 1 0 1] * 3)
hold on

niter = 20;
reg = 0.5;
step = 0.8 / (2 + reg);

for iter=1:niter
	dir = A' * (y - A * x) - reg * x;
%	pr norm(dir)
	x = x + step * dir;
	plot(x(1), x(2), 'o')
end
