function I = outliers(x)
%OUTLIERS Indices of outliers in data vector
%  I = OUTLIERS(X) finds the indices of outliers in a data vector X.
%  Outliers are determined in the same manner as for botplot.

% find the first and third quartiles
q = prctile(x, [25 75]);
q1 = q(1);
q3 = q(2);

% inliers are in the range [lo, hi]
lo = q1 - 1.5 * (q3 - q1);
hi = q3 + 1.5 * (q3 - q1);

I = find(x < lo | x > hi);
