param0 = [1,1];
step = 0.01;

m = 50;
arange = linspace(0,1,m);
brange = linspace(.5,1.5, m);

[A,B] = meshgrid(arange, brange);

E = 0*A;

x = linspace(-5,5,20);
y = .5*x + 1 + randn(1, length(x));

U = 0*A;
V = 0*A;


for i = 1:m
    for j = 1:m
        E(i,j) = lserr([A(i,j), B(i,j)], x, y);
        grad = lserr_gradient([A(i,j), B(i,j)], x, y);
        U(i,j) = grad(1);
        V(i,j) = grad(2);   
        
    end
end
colormap('jet');

surf(A,B,E, 'FaceAlpha',.5);