com.oregondsp.signalProcessing.filter.iir
Class SecondOrderSection

java.lang.Object
  extended by com.oregondsp.signalProcessing.filter.iir.SecondOrderSection

public class SecondOrderSection
extends java.lang.Object

Class to implement a second order section - basic unit of an Infinite Impulse Response digital filter.

Implements the finite difference equation:

y[n] = -a[1]*y[n-1] - a[2]*y[n-2] + b[0]*x[n] + b[1]*x[n-1] + b[2]*x[n-2]

Author:
David B. Harris, Deschutes Signal Processing LLC

Constructor Summary
SecondOrderSection(double b0, double b1, double b2, double a1, double a2)
          Instantiates a new second order section, with values for the numerator and denominator coefficients.
 
Method Summary
 float filter(float x)
          Filters a single input sample (single-step filtering).
 void filter(float[] x, float[] y)
          Filters a sequence of input samples.
 void initialize()
          Initializes states to zero.
 void print(java.io.PrintStream ps)
          Prints the filter coefficients and states.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondOrderSection

public SecondOrderSection(double b0,
                          double b1,
                          double b2,
                          double a1,
                          double a2)
Instantiates a new second order section, with values for the numerator and denominator coefficients.

Parameters:
b0 - Numerator coefficient b[0].
b1 - Numerator coefficient b[1].
b2 - Numerator coefficient b[2].
a1 - Denominator coefficient a[1].
a2 - Denominator coefficient a[2].
Method Detail

initialize

public void initialize()
Initializes states to zero.


filter

public float filter(float x)
Filters a single input sample (single-step filtering).

Parameters:
x - float containing value of the single input sample.
Returns:
float result of the filter for one time step.

filter

public void filter(float[] x,
                   float[] y)
Filters a sequence of input samples.

Parameters:
x - float[] containing the sequence of input samples.
y - float[] containing the filtered result. May be the same array as x.

print

public void print(java.io.PrintStream ps)
Prints the filter coefficients and states.

Parameters:
ps - PrintStream to which the filter coefficients and states are printed.