function gradient = lsq_gradient(parameter, x, y)
h = 1e-6;

partial_m = (lsq_error([parameter(1)+h, parameter(2)],x,y) - lsq_error(parameter,x,y))/ h;
partial_n = (lsq_error([parameter(1), parameter(2)+h],x,y) - lsq_error(parameter,x,y))/ h;

gradient = [partial_m, partial_n];