function x=expsin(n,k,l,phi)
% expsin - return real part of complex exponential.
%
% expsin :: 
%    N:natural ~'length of signal to return',
%    real      ~'normalised frequency 1=sample rate',
%    real      ~'decay rate, 1/time constant'
% -> [[N]].
%
% expsin :: 
%    N:natural ~'length of signal to return',
%    real      ~'normalised frequency 1=sample rate',
%    real      ~'decay rate, 1/time constant'
%    real      ~'initial phase'
% -> [[N]].
% 
% If initial phase not given, defaults to -pi/2 (so initial
% value is zero with +ve slope).

if nargin<4, phi=pi/2; end
t=0:n-1;
x=real(exp((2*pi*k*i-l)*t-phi*i));
