function r = rcf(t, iter)
% Generate values at a point t, of a recursively-defined
% rising cutoff function, generated by "iter" iterations
% from sine.  Expect nonnegative integer "iter".
%
%
% M.V.Wickerhauser, 2017-02-20
%
  r=t;   % initialize output array
  for(i=1:length(t))
    s=t(i);
    if(s>1)
      r(i)=1;
    else
      if (s<-1)
        r(i)=0;
      else
        if(iter<1)
	  s = sin(pi*(1+s)/4);
        else
	  s = rcf(sin(pi*s/2),iter-1);
        endif
	r(i)=s;
      endif
    endif
  end
end
