function W = l1wght(res, scale, param) % function W = l1wght(res, scale, param) % % computes the weight function for minimum l_1 regression % for iteratively reweighted least squares: scale/|res| % % arguments: % res: vector of residuals % scale: robust estimate of scale such as MAD % param: not used--present only for consistent % calling signature with other weights % % returns: % W: the vector of l_1 weights % % % P.B. Stark stark@stat.berkeley.edu % 11 July 1997. thresh = eps^(1/3); unit = ones(size(res))*thresh; res(abs(res) <= thresh ) = unit(abs(res) <= thresh); W = (abs(res)).^(-1); return;