HTBasic Help
×
Menu
Index
Filter
Filter a sequence.
 
Loading        LOADSUB ALL FROM "FFT.HTS"
or LOADSUB FROM "MATHLIB.HTS"
or LOADSUB Filter FROM "MATHLIB.HTS"
 
Usage                INTEGER Logn
REAL A(*),C(*)
COMPLEX F(*)
CALL Filter(Logn,A(*),F(*),C(*))
 
Description                
Filter calculates the sequence produced by filtering the time-domain (or space-domain) sequence in A by the filter whose frequency-domain coefficients are in F. It returns the resulting sequence in the array C. Logn is the base-2 log of the number of points in the sequences in A and F. The arrays A and F must contain at least 2Logn elements. The array C must contain at least 2Logn+1 elements. If the arrays have extra elements, the extra elements are ignored and unmodified.
 
The values in F are the amounts by which to scale the corresponding frequency components of A to produce the resultant sequence. These values are stored in (real,imaginary) [rectangular] form. If filter coefficients are to be used that are specified in the more usual (magnitude,angle) [polar] form, they must be converted to rectangular form when stored in the elements of F (the Polar routine can do this conversion). If filter coefficients are to be used that have all zero phase, the related Rfilter function can be used to save converting the phase data to complex form.
 
The first element in F represents the amount by which the zero-frequency (d. c.) term in A is to be scaled, the second the amount by which the 1/N frequency component is scaled, the third the amount by which the 2/N frequency component is scaled, etc. The meaning of each frequency component is the same for Filter as for Fft and is explained in the entry for the Fft routine.
 
If the sequence to be used as a filter is specified as an impulse response, the Convolve function may be used instead of Filter to filter using the impulse response as input.
 
Errors                
Filter causes an HTBasic error if its arguments are not of the types shown in the USAGE section, above, if Logn is not between 2 and 15, inclusive, if the size of A or C is smaller than 2Logn, or if the size of F is smaller than 2Logn-1.
 
See Also
Cfft, Convolve, Rfilter, Fft