n = (1:500).' ; s = exp(-((n-200).^2)/100^2) ; plot(n,s) ; % slowly varying signal % % add noise in the stopband: % z = 0.3*cos(0.42*pi*n) + 0.1*cos(0.53*pi*n); x = s+z ; plot(n,x) b = firpm( 36, [0.0 0.12 0.15 0.5]*2, [1 1 0 0] ) y = filter(b,1,x) ; % run filter on x plot(n,y) hold plot(n,s) % note delay