function x = delta(n)
% Discrete-time DELTA function, unit impulse function
%
% Usage: x = delta(n)
%
%      n      time index vector from N_1 to N_2
%      x      sequence of zeros and ones according to
%             definition:
%                 delta(n) = 1, n == 0
%                          = 0, n ~= 0
%
% Example:
%  n = [-6 : 6];
%  stem(n, delta(n));  % unit impulse function
%
% Example: 
%  n = [-5 : 5];
%  x = delta(n+2) + delta(n-1) - 3*delta(n-2)
%  stem(n, x)
%
%  numX   = num2str([n; delta(n+2); delta(n-1); -3*delta(n-2); x]);
%  colX   = ['  n | ';' x1 | ';' x2 | ';' x3 | ';'  x | '];
%  tableX = [colX numX]
%
%  imp2latex(x,20,-5)
%
%  Jukka Parviainen, 10.2.2006 / 5.1.2006

x = (n == 0);

% Can also be generated by for loops, etc.
%
%for k=1:length(n)
%  if (n(k) == 0)
%    x(k) = 1;
%  else
%    x(k) = 0;
%  end
%end;


