Functions

Common types of IIR filter

Functions

struct iir_coeff_t * iir_butterworth_lowpass (int order, double gain, double corner)
 nth-order Butterworth low-pass
struct iir_coeff_t * iir_butterworth_highpass (int order, double gain, double corner)
 nth-order Butterworth high-pass
struct iir_coeff_t * iir_butterworth_bandpass (int order, double gain, double c1, double c2)
 nth-order Butterworth band-pass
struct iir_coeff_t * iir_butterworth_bandstop (int order, double gain, double c1, double c2)
 nth-order Butterworth band-stop

Detailed Description

Functions to create coefficients for various common types of IIR filter. The coefficient structures which are returned may be used to instantiate IIR filters using iir_filter_new().

The Butterworth filter code comes from the Exstrom Labs LLC code available under GPLv2 or later and published at http://www.exstrom.com/journal/sigproc/ . There is a copy of the original code available in the top level of this project.


Function Documentation

struct iir_coeff_t* iir_butterworth_lowpass ( int  order,
double  gain,
double  corner 
) [read]

nth-order Butterworth low-pass

Parameters:
order Order of filter (≥1).
gain Linear gain of filter.
corner Corner frequency expressed as a fraction of Nyquist (0 ≤ corner ≤ 1)
Returns:
Newly-allocated IIR filter coefficients.

Uses the Exstrom labs code to compute the coefficients of an nth-order (param order) Butterworth-type low pass filter with gain gain and corner frequency corner.

Note it is recommended to chain multiple filters together to build anything greater than a 4th-order filter. This function won't do that directly for you. gain will usually be set to be 1.0.

The corner frequency corner is expressed as a fraction of the sampling frequency (which is of course not known by the IIR code). It should lie between 0 (0Hz) and 1 (the Nyquist frequency, or ½ the sampling frequency).

struct iir_coeff_t* iir_butterworth_highpass ( int  order,
double  gain,
double  corner 
) [read]

nth-order Butterworth high-pass

Parameters:
order Order of filter (≥1).
gain Linear gain of filter.
corner Corner frequency expressed as a fraction of Nyquist (0 ≤ corner ≤ 1)
Returns:
Newly-allocated IIR filter coefficients.

Uses the Exstrom labs code to compute the coefficients of an nth-order (param order) Butterworth-type high pass filter with gain gain and corner frequency corner.

Note it is recommended to chain multiple filters together to build anything greater than a 4th-order filter. This function won't do that directly for you. gain will usually be set to be 1.0.

The corner frequency corner is expressed as a fraction of the sampling frequency (which is of course not known by the IIR code). It should lie between 0 (0Hz) and 1 (the Nyquist frequency, or ½ the sampling frequency).

struct iir_coeff_t* iir_butterworth_bandpass ( int  order,
double  gain,
double  c1,
double  c2 
) [read]

nth-order Butterworth band-pass

Parameters:
order Order of filter (≥1).
gain Linear gain of filter.
c1 Low corner frequency expressed as a fraction of Nyquist (0 ≤ c1 ≤ 1)
c2 High corner frequency expressed as a fraction of Nyquist (0 ≤ c2 ≤ 1, and c1 < c2)
Returns:
Newly-allocated IIR filter coefficients.

Uses the Exstrom labs code to compute the coefficients of an nth-order (param order) Butterworth-type band pass filter with gain gain and corner frequencies c1 and c2.

Note it is recommended to chain multiple filters together to build anything greater than a 4th-order filter. This function won't do that directly for you. gain will usually be set to be 1.0.

The corner frequencies c1 and c2 are expressed as a fraction of the sampling frequency (which is of course not known by the IIR code). They should lie between 0 (0Hz) and 1 (the Nyquist frequency, or ½ the sampling frequency), and c2 should be greater than c1.

struct iir_coeff_t* iir_butterworth_bandstop ( int  order,
double  gain,
double  c1,
double  c2 
) [read]

nth-order Butterworth band-stop

Parameters:
order Order of filter (≥1).
gain Linear gain of filter.
c1 Low corner frequency expressed as a fraction of Nyquist (0 ≤ c1 ≤ 1)
c2 High corner frequency expressed as a fraction of Nyquist (0 ≤ c2 ≤ 1, and c1 < c2)
Returns:
Newly-allocated IIR filter coefficients.

Uses the Exstrom labs code to compute the coefficients of an nth-order (param order) Butterworth-type band stop filter with gain gain and corner frequencies c1 and c2.

Note it is recommended to chain multiple filters together to build anything greater than a 4th-order filter. This function won't do that directly for you. gain will usually be set to be 1.0.

The corner frequencies c1 and c2 are expressed as a fraction of the sampling frequency (which is of course not known by the IIR code). They should lie between 0 (0Hz) and 1 (the Nyquist frequency, or ½ the sampling frequency), and c2 should be greater than c1.