function u = apodize_window(N,M,fsmp)
  % Returns an apodizing window of total width {N} with  
  % smooth up transition from {1} to {M} and
  % smooth down transition from {N+1-M} to {N}.
  assert(2*M < N)
  u = ones(N,1);
  for k = 1:N
    vlo = shoulder(k,1,M+1);
    vhi = shoulder(k,N,N-M);
    u(k,1) = vlo*vhi;
  end
  % figure 21; timeplot(u,1,M+11,fsmp,'');   title('apodize low')
  % figure 22; timeplot(u,N-M-10,N,fsmp,''); title('apodize high')