%
% FUNCTION X = GETSWEEP (N, FSTART, FSTOP)
%
% DESCRIPTION
%   return a sweep of N samples with a flat magnitude
%   spectrum between normalized frequencies FSTART and FSTOP
%
% ... Dr. Hoffer ...


function X = getsweep (Nsweep, fstart, fstop)

% patchwork: Lowpeak generates a sweep of 2N samples for 
%            a magitude spectrum of N samples

N = round(0.5*Nsweep);

% OK, now let's fill that magnitude spectrum

Magnitude  = zeros(1,N);

nstart = max(1, round(N*fstart));
nstop  = min(N, round(N*fstop));
Magnitude(nstart:nstop) = ones(1,(nstop-nstart+1));

% yoopee

X = lowpeak(Magnitude);
  
