function modw = removelevel(w,levels) % FUNCTION: removelevel Part of DPWT Toolbox % % USAGE: MODW = removelevel(W,LEVELS) % % DESCRIPTION: Make wavelet coefficients zero at levels % in vector levels. LEVELS must contain integers % greater than or equal to -1 and less than or % equal to the base 2 log of the length of W. A % level of -1 refers to the first coefficient in % W. % % EXAMPLE: removelevel([1 2 3 4 5 6 7 8], [0 2]) % ans = % 1 0 3 4 0 0 0 0 % % % AUTHOR: Neil Getz % DATE: 2-12-92 % % COPYRIGHT 1992, Neil Getz % if (nargin ~= 2), help removelevel; return; end n = length(w); pp = log(n)/log(2); if( (levels=-1) & (levels == round(levels)) ), else s = ['arg2 must be integer and', ... '-1< = arg2 < log2(length( arg1))']; error(s); end; modw = w; if (sum( levels == -1 ) >= 1), modw(1)=0; end; for res = levels( find( levels > -1 ) ) modw([(2^res + 1):(2^(res+1))]) = zeros(2^res,1); end