I have to find an optimal gradient and intercept of a straight to minimize the sum of squared deviations to fit a 2D data points set, with linear constraints.
So, i have to solve the binary quadratic optimization problem: minF(ki,bi)=min(sum(ki*xj+bi-yj))^2 where (xj,yj) are the coordinates of the j-th data set point.
i have also to define some constraints, such as:
Hmin <= ki*xj+bi-yj <= Hmax
i've tried to use fmincon and quadprog but i was not able to solve my problem. could someone give me some tips?