function Y = tril(X,k)
%Y=tril(X,k)
%Lower triangle matrix of X

%       S.Halevy 7/31/92
%       Copyright (c) 1992 by the MathWizards

k=expr_sel(nargin==1,0,k);
[m,n] = size(X);
Y = zeros(m,n);
for i = max(1,1-k):m
   j = 1:min(n,i+k);
   Y(i,j) = X(i,j);
end
