function x = linfmin(A,b)
%  x = linfmin(A,b)
% find x such that norm(A*x-b,Inf) is minimal

% convert to linear programming problem
%   find xh with Ah*xh<=bh such that f'*xh is minimal
m = size(A,1); n = size(A,2);
v1 = ones(m,1);
Ah = [A,-v1;-A,-v1];
bh = [b;-b];
f = [zeros(n,1); 1];
xh = linprog(f,Ah,bh);  % solve linear programming problem
x = xh(1:n);

