Skip to main content

InfiniteImpulseResponse

The InfiniteImpulseResponse operator implements a general-purpose IIR (Infinite Impulse Response) digital filter. It combines feed-forward terms from the input signal with feedback terms from previous outputs.

Port Configuration

  • Input Port 0: Accepts NumberData messages containing the input signal values
  • Output Port 0: Emits NumberData messages containing the filtered output values

Operation

The filter implements the difference equation:

y(n) = {b₀x[n] + b₁x[n-1] + ... + bₘ₋₁x[n-M+1]} - {a₁y[n-1] + a₂y[n-2] + ... + aₙy[n-N]}

Where:

  • x[n]: Input values
  • y[n]: Output values
  • b: Feed-forward coefficients (M coefficients)
  • a: Feedback coefficients (N coefficients)
  • M: Length of b vector
  • N: Length of a vector

Behavior

  1. Input Handling:
    • Maintains a buffer of M most recent input values
    • Requires M input samples before producing first output
  2. Output Generation:
    • Uses available feedback terms (gradually incorporating up to N terms)
    • Maintains a buffer of N most recent output values
    • Uses same timestamp as corresponding input message

Example Operation

Consider a first-order IIR filter with b=[1.0], a=[0.5]:

TimeInputOutputCalculation
11.01.0y = 1.0 (no feedback yet)
21.00.5y = 1.0 - 0.5×1.0
31.00.75y = 1.0 - 0.5×0.5
41.00.625y = 1.0 - 0.5×0.75

Implementation Notes

  1. Buffer Management:

    • Input buffer (x_) limited to size M
    • Output buffer (y_) limited to size N
    • FIFO behavior: oldest values removed first
  2. Error Handling:

    • Requires at least one coefficient in both b and a vectors
    • Validates message types
  3. State Persistence:

    • Serializes both input and output buffers
    • Maintains filter state across save/restore operations

Common Applications

  • Low-pass filtering
  • High-pass filtering
  • Band-pass filtering
  • Signal smoothing
  • Audio processing
  • Control systems