Skip to main content

FiniteImpulseResponse

The Finite Impulse Response (FIR) operator implements a classical FIR filter, computing the weighted sum of a sliding window of input values.

Buffer Size

The buffer size equals the length of the coefficient vector. For N coefficients, the operator maintains an N-sample buffer.

Output Computation

For input sequence x[n] and coefficients b[k], the output y[n] is computed as:

y[n]=k=0N1b[k]x[nk]y[n] = \sum_{k=0}^{N-1} b[k] \cdot x[n-k]

Example Operation

Time series showing input values and corresponding outputs for coefficients [0.5, 0.3, 0.2]:

TimeInputOutputNotes
11.0-Buffering
22.0-Buffering
33.01.63.0×0.5 + 2.0×0.3 + 1.0×0.2
54.02.44.0×0.5 + 3.0×0.3 + 2.0×0.2
65.03.25.0×0.5 + 4.0×0.3 + 3.0×0.2

Note how output starts after buffer fills and continues with constant throughput.

Error Handling

Throws std::runtime_error if:

  • Coefficient vector is empty
  • Input message has invalid type