BandFilter Class Reference

Algorithm to create and apply several types of low pass, high pass, band pass and band stop filters. More...

#include <BandFilter.h>

Collaboration diagram for BandFilter:

Collaboration graph
[legend]

List of all members.

Public Types

enum  FilterType { CHEBYSHEVI = 0, CHEBYSHEVII = 1, BUTTERWORTH = 2, BESSEL = 3 }
 Specifies the type of the filter. More...
enum  BandType { LOWPASS = 0, HIGHPASS = 1, BANDPASS = 2, BANDSTOP = 3 }
 Specifies the type of the band. More...

Public Member Functions

 BandFilter (int order=4, Real lowFrequency=0.0, Real highFrequency=1.0, BandType bandType=LOWPASS, FilterType filterType=CHEBYSHEVII, Real ripplePass=0.05, Real attenuationStop=40.0)
void process (const MatrixXR &samples, MatrixXR *filtered)
void a (MatrixXR *a) const
void b (MatrixXR *b) const
int order () const
void setOrder (int order, bool callSetup=true)
Real lowFrequency () const
void setLowFrequency (Real frequency, bool callSetup=true)
Real highFrequency () const
void setHighFrequency (Real frequency, bool callSetup=true)
FilterType filterType () const
void setFilterType (FilterType type, bool callSetup=true)
BandType bandType () const
void setBandType (BandType type, bool callSetup=true)
Real passRipple () const
void setPassRipple (Real rippleDB, bool callSetup=true)
Real stopAttenuation () const
void setStopAttenuation (Real attenuationDB, bool callSetup=true)


Detailed Description

Algorithm to create and apply several types of low pass, high pass, band pass and band stop filters.

This class represents an object to create and apply several types of band filters. Additionally the coefficients, zeros, poles and gains of the created filters can be retrieved.

4 types of bands are implemented:

  1. Low Pass
  2. High Pass
  3. Band Pass
  4. Band Stop

The band type can be selected using the setBandType() taking as argument a BandType.

The critical frequencies are specified using setLowFrequency() and setHighFrequency(). Note that for low pass and high pass filters which have one single critical frequency only setLowFrequency() has an effect.

4 types of filters are implemented:

  1. Chebyshev I
  2. Chebyshev II
  3. Bessel
  4. Butterworth

The filter type can be selected using the setFilterType() taking as argument a FilterType.

The order of the filters can be specified using setOrder().

For Chebyshev I filters the pass band ripple can be specified using setPassRipple(). Note that this method has no effect if a different type of filter is used.

For Chebyshev II filters the stop band attenuation is specified using setStopAttenuation(). Note that this method has no effect if a different type of filter is used.

Author:
Ricard Marxer
See also:
Filter

Member Enumeration Documentation

enum FilterType

Specifies the type of the filter.

See also:
filterType
Enumerator:
CHEBYSHEVI  Chebyshev Type-I filter
CHEBYSHEVII  Chebyshev Type-II filter
BUTTERWORTH  Butterworth filter
BESSEL  Bessel filter

enum BandType

Specifies the type of the band.

See also:
bandType
Enumerator:
LOWPASS  Low pass filter
HIGHPASS  High pass filter
BANDPASS  Band pass filter
BANDSTOP  Band stop filter


Constructor & Destructor Documentation

BandFilter ( int  order = 4,
Real  lowFrequency = 0.0,
Real  highFrequency = 1.0,
BandType  bandType = LOWPASS,
FilterType  filterType = CHEBYSHEVII,
Real  ripplePass = 0.05,
Real  attenuationStop = 40.0 
)

Constructs a band pass filter object with the given order, lowFrequency, highFrequency, filterType, ripplePass and attenuationStop parameters given.

References setBandType(), setFilterType(), setHighFrequency(), setLowFrequency(), setOrder(), setPassRipple(), and setStopAttenuation().


Member Function Documentation

void process ( const MatrixXR &  samples,
MatrixXR *  filtered 
)

Performs a filtering of each of the columns of samples. Puts the resulting filtered in the columns of filtered.

Parameters:
samples matrix of Real values. A column represents a channel and a row represents a time index.
filtered pointer to a matrix of Real values for the output. The matrix should have the same number of rows and columns as samples.
Note that if the output matrix is not of the required size it will be resized, reallocating a new memory space if necessary.

See also:
Filter::process

References Filter::process().

void a ( MatrixXR *  a  )  const

Return in a the single column matrix a coefficients.

See also:
b

References Filter::a().

void b ( MatrixXR *  b  )  const

Return in b the single column matrix b coefficients.

See also:
a

References Filter::b().

int order (  )  const

Return the order of the filter. The default is 4.

See also:
setOrder

void setOrder ( int  order,
bool  callSetup = true 
)

Specifies the order of the filter. The given order must be higher than 0. Note that orders higher than 25 are not allowed for Bessel filters.

See also:
order

Referenced by BandFilter().

Real lowFrequency (  )  const

Return the low frequency of the filter. The default is 0.0.

See also:
lowFrequency, highFrequency, setLowFrequency, setHighFrequency

void setLowFrequency ( Real  frequency,
bool  callSetup = true 
)

Specifies the low normalized frequency of the filter. The given frequency must be in the range of 0 to 1.

See also:
lowFrequency, highFrequency, setHighFrequency

Referenced by BandFilter().

Real highFrequency (  )  const

Return the stop frequency of the filter. The default is 1.0.

See also:
lowFrequency, setLowFrequency, setHighFrequency

void setHighFrequency ( Real  frequency,
bool  callSetup = true 
)

Specifies the stop normalized frequency of the filter. The given frequency must be in the range of 0 to 1.

See also:
lowFrequency, highFrequency, setLowFrequency

Referenced by BandFilter().

BandFilter::FilterType filterType (  )  const

Return the filter type. The default is CHEBYSHEVII. The given frequency must be in the range of 0 to 1.

See also:
setFilterType, order, setOrder

void setFilterType ( FilterType  type,
bool  callSetup = true 
)

Specifies the filter type.

See also:
lowFrequency, highFrequency, setLowFrequency

Referenced by BandFilter().

BandFilter::BandType bandType (  )  const

Return the type of the band of the filter.

By default it is LOWPASS.

See also:
setBandType()

void setBandType ( BandType  type,
bool  callSetup = true 
)

Specifies the type of the band of the filter.

See also:
bandType()

Referenced by BandFilter().

Real passRipple (  )  const

Returns the ripple of the pass band in dB

Note that this property only has an effect if the filter type used is CHEBYSHEVI. By default it is 0.05.

See also:
setPassRipple(), stopAttenuation(), setStopAttenuation()

void setPassRipple ( Real  rippleDB,
bool  callSetup = true 
)

Specifies the ripple of the pass band in dB

Note that this property only has an effect if the filter type used is CHEBYSHEVI.

See also:
passRipple(), stopAttenuation(), setStopAttenuation()

Referenced by BandFilter().

Real stopAttenuation (  )  const

Returns the attenuation of the stop band in dB

Note that this property only has an effect if the filter type used is CHEBYSHEVII. By default it is 40.0.

See also:
passRipple(), setPassRipple(), setStopAttenuation()

void setStopAttenuation ( Real  attenuationDB,
bool  callSetup = true 
)

Specifies the attenuation of the stop band in dB

Note that this property only has an effect if the filter type used is CHEBYSHEVII.

See also:
passRipple(), setPassRipple(), stopAttenuation()

Referenced by BandFilter().


The documentation for this class was generated from the following files:

Generated on Tue Mar 31 20:38:33 2009 for Loudia by  doxygen 1.5.6