FILTER Function
Applies an IIR or FIR filter to a sequence.
Usage
result = FILTER(h, x)
Input Parameters
h—A valid FIR or IIR filter structure.
x—A one-dimensional array to be filtered.
Returned Value
result—A one-dimensional array containing the filtered values of x.
Keywords
None.
Discussion
FILTER simplifies access to the filtering methods available in the PV‑WAVE Signal Processing Toolkit. FILTER determines whether the filter structure being used, h, is an FIR or an IIR filter type. It then calls the specific filtering routine appropriate for the filter structure used (FIRFILT or IIRFILT).
The particular FIR or IIR filtering routine called by FILTER uses all the default settings for the keyword parameters of that routine. For greater control of the filtering method used, however, it is recommended that you use the appropriate filter function directly (see FIRFILT, IIRFILT).
Example
The following example shows a typical application of FILTER. The results are shown in Figure 2-4: Combined Signal and Filtered SIgnal Plot, where (a) is the plot of the magnitude frequency response of the combined signal and (b) is the plot of the magnitude frequency response of the filtered signal.
!P.Multi = [0, 1, 2]
t = FINDGEN(1024)
; Generate three bandpass signals.
s1 = SIN(0.6*t)
s2 = SIN(1.2*t)
s3 = SIN(1.9*t)
; Combine the three signals.
x = s1 + s2 + s3
; Generate abscissa values for the normalized frequency.
f = FINDGEN(512)/511
; Plot magnitude frequency response of combined signal.
PLOT, f, (ABS(FFTCOMP(x, /Complex)))(0:512), $
Title = 'Original', XStyle = 1
; Approximate a bandpass filter to isolate the first signal.
h = FIRDESIGN(101, 0.3, 0.5, /Bandpass)
; Apply the filter to the signal.
y = FIRFILT(h, x)
; Plot magnitude frequency response of filtered signal.
PLOT, f, (ABS(FFTCOMP(y, /Complex)))(0:512), $
Title = 'Filtered', XStyle = 1
 
Figure 2-4: Combined Signal and Filtered SIgnal Plot
 
See Also