# Copyright (c) 2002 Peter Guntert. All rights reserved. ## 7MACROS: suppress - suppress signals with zero frequency ## ## Usage: suppress [ []] ## ## suppress is a standard macro that suppresses signals with zero frequency ## (e.g. the water line) by subtracting smoothed time-domain data from ## the original time-domain data. To obtain the smoothed data s'(k) the ## a moving average over the original data s(k) is calculated: ## ## f(-n) s(k-n) + ... + f(0) s(k) + ... + f(n) s(k+n) ## s'(k) = --------------------------------------------------. ## f(-n) + ... + f(0) + ... + f(n) ## ## The default value for n is the number of data points in the active di- ## mension divided by 20. The following weighting functions are available: ## ## weighting f(k) remarks ## --------- ----------------- -------------------------- ## cos cos(pi/(2*n+2)*k) cosine weighting (default) ## gauss exp(-4*(k/n)**2) Gaussian weighting ## equal 1.0 equal weights ## ## See also: smooth parameter type nsmooth if (nparam.gt.2) error "*** Error: Illegal number of parameters." if (.not.def('type')) type := cos if (.not.def('nsmooth')) nsmooth = n/20 type := '$type' if (type.eq.'cos') then smooth nsmooth cos(0.5*pi/(nsmooth+1)*k) extrapolate=nsmooth+3 subtract else if (type.eq.'gauss') then smooth nsmooth exp(-4.0*(k/nsmooth)**2) extrapolate=nsmooth+3 subtract else if (type.eq.'equal') then smooth nsmooth 1.0 extrapolate=nsmooth+3 subtract else error "*** Error: Illegal weighting function \"$type\"." end if