FIR Function

Performs "Finite Impulse Response" digital filtering on supplied vector. This function performs the operation:

\[ y_n = x_n \cdot c_0 + x_{n-1} \cdot c_1 + x_{n-2} \cdot c_2 + \dots \]

Where:
$x$ is the input vector (argument 1)
$c$ is the coefficient vector (argument 2)
$y$ is the result (returned value)

The third argument provide the 'history' of $x$ i.e. $x_{-1}$, $x_{-2}$ etc. as required. Below is the simple case of a four sample rolling average. In principle an almost unlimited range of FIR filtering operations may be performed using this function. A text on Digital Signal Processing will provide further details.

User's should note that using this function applied to raw transient analysis data will not produce meaningful results as the values are unevenly spaced. If you apply this function to simulation data, you must either specify that the simulator outputs at fixed intervals (select the Output at .PRINT step option in the Simulator > Choose Analysis... dialog box) or you must interpolate the results using the Interp function.

Arguments

Number Type Compulsory Default Description
1 real array Yes vector to be filtered
2 real array Yes filter coefficients
3 real array No All zero initial conditions

Returns

Return type: real array

See Also

Example

Suppose a vector VOUT exist in the current group (simulation results). The following will plot VOUT with a 4 sample rolling average applied
Plot FIR(vout, [0.25, 0.25, 0.25, 0.25])
Alternatively, the following does the same
Plot FIR(vout, 0.25*unitvec(4))