1function [w1]=CCAF(phi,psi,order,w,snrThresh,amcInds)
 2   
 3   if ~isempty(phi)
 4        % Expand bound vectors and run weight comparison
 5        uBoundInds = w > phi;  lBoundInds = w < psi;
 6        % Include AMC thresholding if specified
 7        if ~isempty(snrThresh)
 8            amcIndMat = ones(order,1) * amcInds;
 9            uBoundInds = uBoundInds & amcIndMat;
10            lBoundInds = lBoundInds & amcIndMat;
11        end
12        % Apply bounds to tap matrix
13        w(uBoundInds) = phi(uBoundInds);
14        w(lBoundInds) = psi(lBoundInds);
15   end
16   
17   
18  w1=w;
19end