Given points on graph, the popular method of fitting a line is by using the least-squares method. I need a different method - I need the worst error, i.e. the largest distance from a point to the line, to be as small as possible.
I need to implement it in Matlab, so if it provides relevant functions, that would be awesome.
Example:

The least-squares method would bring the line near the bottom dots, but the method that I need should bring it in the middle, because that would minimize the worst error.