function WMFILT, filt, x ;+ ; NAME: ; WMFILT ; ; PURPOSE: ; This function performs a convolution operation that runs a window ; through a data set. The result is equivalent to Matlab's call: ; filter(filt, 1, x). ; ; CATEGORY: ; Wavelets ; ; CALLING SEQUENCE: ; y = WMFILT(filt, x) ; ; INPUTS: ; x: 1-d signal. ; filter: filter/window ; ; OUTPUTS: ; y: 1-d signal smeared with the filter/window function. ; ; EXAMPLE: ; ; SEE ALSO: ; wiconv, waconv ; ; MODIFICATION HISTORY: ; Written by Amara Graps with help from Jeff Scargle (NASA-Ames), ; October, 1994. ;- nfilt = N_ELEMENTS(filt) nx = N_ELEMENTS(x) CASE 1 OF (nfilt GT nx): BEGIN ;length of filter array > length of data array y = FLOAT( FFT( FFT(filt,1) * FFT( [x, FLTARR(nfilt - nx)],1),-1) ) y = y(0:n-1) END (nx - nfilt GT 0 ): BEGIN ;length of filter array < length of data array y = FLOAT( FFT( FFT(x,1) * FFT( [filt, FLTARR(nx - nfilt)],1),-1) ) END ELSE: BEGIN ;length of filter array = length of data array y = FLOAT( FFT( FFT(x,1) * FFT( [filt],1),-1) ) END ENDCASE ;Fix first element (Amara's fudge to match Matlab output!) y(0) = x(0)*filt(0) RETURN, y END ;function filter ;*************************************************************************************