function x=pulse(L,M,N)
%    x=pulse(L,M,N)
% build a pulse shape
% L = duration in sampling periods of generic square pulse
% M = number of convolutions ( M > 0 )
% N = number of derivatives
% The time duration depends on the sampling frequency
% and is (1/fs)*( M*(L-1)+N+1 ), roughly M*L/fs.
% The amplitude will be one. 
    p=ones(1,L);x=1;
    for k=1:M
        x=conv(p,x);
    end 
    if N > 0
        for k=1:N
            x=conv([1 -1],x); % 'derivative' operator
    end
    end	
    x=(1/max(abs(x)))*x;