libiir  1.1.1
Public Member Functions
IIR::Coeff Class Reference

IIR filter coefficient set More...

Public Member Functions

 Coeff (int nc, const double *c, int nd, const double *d)
 Constructor with raw coefficients.
 Coeff (const std::vector< double > &c, const std::vector< double > &d)
 Constructor with raw coefficients.
 Coeff (const struct iir_coeff_t *cc)
 Constructor from C library object.
 Coeff (const Coeff &other)
 Copy constructor.
virtual ~Coeff ()
 Destructor.
int nc () const
 Count number of c coefficients.
double c (int idx) const
 Retrieve c coefficient by index.
int nd () const
 Count number of d coefficients.
double d (int idx) const
 Retrieve d coefficient by index.
std::complex< double > response (double freq) const
 Evaluate response of filter at given frequency.

Detailed Description

IIR filter coefficient set

An instance of this class represents the set of coefficients used to implement a single-phase IIR filter. See Structure of IIR filter for more information.

Constructor & Destructor Documentation

IIR::Coeff::Coeff ( int  nc,
const double *  c,
int  nd,
const double *  d 
)

Constructor with raw coefficients.

Parameters
ncNumber of c coefficients, ≥ 1.
cArray of c coefficients.
ndNumber of d coefficients, ≥ 1.
dArray of d coefficients.
IIR::Coeff::Coeff ( const std::vector< double > &  c,
const std::vector< double > &  d 
)

Constructor with raw coefficients.

Parameters
cArray of c coefficients, size ≥ 1.
dArray of d coefficients, size ≥ 1.
IIR::Coeff::Coeff ( const struct iir_coeff_t *  cc)

Constructor from C library object.

Parameters
ccPointer to existing coefficient object.
IIR::Coeff::Coeff ( const Coeff other)

Copy constructor.

Parameters
otherObject to copy.

Performs a full deep copy of the set of coefficients from other.

Member Function Documentation

int IIR::Coeff::nc ( ) const

Count number of c coefficients.

Returns
Number of c coefficients, ≥ 1.
double IIR::Coeff::c ( int  idx) const

Retrieve c coefficient by index.

Parameters
idxIndex of coefficient (0 ≤ idx < nc()).
Returns
Value of c coefficient at index idx.
int IIR::Coeff::nd ( ) const

Count number of d coefficients.

Returns
Number of d coefficients, ≥ 1.
double IIR::Coeff::d ( int  idx) const

Retrieve d coefficient by index.

Parameters
idxIndex of coefficient (0 ≤ idx < nd()).
Returns
Value of d coefficient at index idx.
std::complex<double> IIR::Coeff::response ( double  freq) const

Evaluate response of filter at given frequency.

Parameters
freqFrequency (0 ≤ freq ≤ 1).
Returns
Complex response of filter at given frequency.

Returns the steady-state response of the filter to a pure input signal of the given frequency. freq is expressed as a fraction of the intended sampling rate (with 0.5 being the Nyquist frequency).