Package xal.tools.dsp
Class ExpFilter
java.lang.Object
xal.tools.dsp.ExpFilter
Discrete filter based upon the FourierExpTransform
class.
When the filters are described as "perfect", we are implying that they do not roll off with frequency (thus, they are of infinite order). The transfer function of the filter has values of either unity or zero. This may or may not correspond to a linear phase filter.
- Author:
- Christopher K. Allen
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExpFilter
(int szData) Create a new filter object for processing discrete functions (i.e., objects of typedouble[]
) with the given size. -
Method Summary
Modifier and TypeMethodDescriptionint
Return the expected size of the discrete function to be processed.int
Return the maximum discrete frequency processed by this filter.double[]
parabolicLowPass
(int intFreq, double[] arrFunc) Parabolic low-pass filter.double[]
perfectBandPass
(int intFreqLow, int intFreqHigh, double[] arrFunc) Perfect band-pass filter.double[]
perfectHighPass
(int intFreq, double[] arrFunc) Perfect high-pass filter.double[]
perfectLowPass
(int intFreq, double[] arrFunc) Perfect low-pass filter.double[]
perfectNotch
(int intFreq, double[] arrFunc) Perfect notch filter.double[]
perfectNotch
(int intFreqLow, int intFreqHigh, double[] arrFunc) Perfect notch filter.
-
Constructor Details
-
ExpFilter
public ExpFilter(int szData) Create a new filter object for processing discrete functions (i.e., objects of typedouble[]
) with the given size.- Parameters:
szData
- size of the functions this filter can process
-
-
Method Details
-
getDataSize
public int getDataSize()Return the expected size of the discrete function to be processed.- Returns:
- array size for functions this filter object can process
-
getMaximumFrequency
public int getMaximumFrequency()Return the maximum discrete frequency processed by this filter.- Returns:
- maximum (positive) filter frequency
-
perfectLowPass
public double[] perfectLowPass(int intFreq, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Perfect low-pass filter. Any frequency components greater than the given (discrete) cut off frequency are complete removed. The filtered function is returned.- Parameters:
intFreq
- discrete cut off frequencyarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than max frequencyIllegalArgumentException
- discrete function size is not equal to filter dimensions
-
perfectHighPass
public double[] perfectHighPass(int intFreq, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Perfect high-pass filter. Any frequency components less than the given (discrete) cut off frequency are complete removed. The filtered function is returned.- Parameters:
intFreq
- discrete cut off frequencyarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than max frequencyIllegalArgumentException
- discrete function size is not equal to filter dimensions
-
perfectBandPass
public double[] perfectBandPass(int intFreqLow, int intFreqHigh, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Perfect band-pass filter. Any frequency components outside the the given (discrete) cut off frequencies (exclusive) are complete removed. That is, only discrete frequency components inside the interval [intFreqLow,intFreqHigh] are contained in the returned function.- Parameters:
intFreqLow
- discrete low-band cut off frequencyintFreqHigh
- discrete high-band cut off frequencyarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than data sizeIllegalArgumentException
- discrete function size is not equal to filter dimensions
-
perfectNotch
public double[] perfectNotch(int intFreqLow, int intFreqHigh, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Perfect notch filter. Any frequency components inside the the given (discrete) cut off frequencies (inclusive) are complete removed. That is, only discrete frequency components outside the interval [intFreqLow,intFreqHigh] are contained in the returned function.- Parameters:
intFreqLow
- discrete low-band cut off frequencyintFreqHigh
- discrete high-band cut off frequencyarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than data sizeIllegalArgumentException
- discrete function size is not equal to filter dimensions
-
perfectNotch
public double[] perfectNotch(int intFreq, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Perfect notch filter. Removes a single (discrete) frequency component from the given function.- Parameters:
intFreq
- discrete frequency to be removedarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than data sizeIllegalArgumentException
- discrete function size is not equal to filter dimensions
-
parabolicLowPass
public double[] parabolicLowPass(int intFreq, double[] arrFunc) throws IndexOutOfBoundsException, IllegalArgumentException Parabolic low-pass filter. Any frequency components greater than the given (discrete) cut off frequency are complete removed. Frequencies in the pass-band are attenuated by a transfer function with unit high and parabolic shape with value zero at the cut off frequency.- Parameters:
intFreq
- discrete cut off frequencyarrFunc
- discrete function to be filtered- Returns:
- filtered discrete function
- Throws:
IndexOutOfBoundsException
- cut off frequency either negative or greater than max frequencyIllegalArgumentException
- discrete function size is not equal to filter dimensions
-