com.oregondsp.signalProcessing.filter.iir
Class IIRFilter

java.lang.Object
  extended by com.oregondsp.signalProcessing.filter.iir.IIRFilter
Direct Known Subclasses:
Butterworth, ChebyshevI, ChebyshevII

public class IIRFilter
extends java.lang.Object

Class to implement an Infinite Impulse Response digital filter. Implements the filter as a cascade of second-order sections. The filter is obtained using a bilinear transformation of a prototype analog filter. This implementation saves internal states from one invocation of the filter methods to the next allowing continuous processing of real time data streams or very large files in consecutive, contiguous blocks.

Author:
David B. Harris, Deschutes Signal Processing LLC

Constructor Summary
IIRFilter(AnalogPrototype baseFilter, PassbandType type, double f1, double f2, double delta)
          Instantiates a new IIR filter.
 
Method Summary
 Complex evaluate(double Omega)
          Evaluates the transfer function of this IIR filter at a specified discrete time frequency.
 float filter(float x)
          Filters a single sample of a sequence.
 void filter(float[] x)
          Filters an array of sequence samples in-place.
 void filter(float[] x, float[] y)
          Filters an array of sequence samples.
 double groupDelay(double Omega)
          Computes the group delay of the IIR filter at a specified discrete time frequency.
 void initialize()
          Initializes the states of the filter, i.e.
 void print(java.io.PrintStream ps)
          Prints the coefficients and states of this IIR filter, section by section.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IIRFilter

public IIRFilter(AnalogPrototype baseFilter,
                 PassbandType type,
                 double f1,
                 double f2,
                 double delta)
Instantiates a new IIR filter.

Parameters:
baseFilter - The AnalogPrototype for this digital filter.
type - PassbandType object specifying lowpass, highpass or bandpass type response.
f1 - double specifying the low cutoff frequency - used by highpass and bandpass types.
f2 - double specifying the high cutoff frequency - used by lowpass and bandpass types.
delta - double specifying the sampling interval for which the filter is designed.
Method Detail

initialize

public void initialize()
Initializes the states of the filter, i.e. of each of the second-order sections.


filter

public float filter(float x)
Filters a single sample of a sequence.

Parameters:
x - float containing the sequence sample.
Returns:
float value of the resulting filtered sequence.

filter

public void filter(float[] x,
                   float[] y)
Filters an array of sequence samples. Suitable for use in filtering a long file or continuous data stream broken into consecutive, contiguous blocks. Maintains state between invocations, allowing continuous processing.

Parameters:
x - float[] containing samples of the sequence to be filtered.
y - float[] containing samples of the resulting filtered sequence.

filter

public void filter(float[] x)
Filters an array of sequence samples in-place. In this implementation, the source and destination arrays are identical, conserving storage.

Parameters:
x - float[] contains samples of the sequence to be filtered upon call and the filtered samples following execution

evaluate

public Complex evaluate(double Omega)
Evaluates the transfer function of this IIR filter at a specified discrete time frequency.

Parameters:
Omega - double containing the discrete frequency (in [0, pi]) for evaluation of the transfer function.
Returns:
Complex object containing the value of the transfer function at frequency Omega.

groupDelay

public double groupDelay(double Omega)
Computes the group delay of the IIR filter at a specified discrete time frequency.

Parameters:
Omega - double containing the discrete frequency (in [0, pi]) for evaluation of the group delay.
Returns:
double containing the resulting group delay.

print

public void print(java.io.PrintStream ps)
Prints the coefficients and states of this IIR filter, section by section.

Parameters:
ps - PrintStream object to which this filters coefficients and states are printed.