function [min, ind] = imin(x)

n = length(x);
ind = 1;

min = inf;

for k= 1:n
    if min >= x(k) && x(k) >=0
        min = x(k);
        ind = k;
    end;
end;