FIR Filter Type: Custom
The custom filter lets you define the coefficients of the FIR filter.
Custom Coefficients
You can define the coefficients for the FIR filter and download them to the signal generator with the niFgen Configure Custom FIR Filter Coefficients VI or the niFgen_ConfigureCustomFIRFilterCoefficients function. Coefficients should be scaled correctly and compensate for the CIC Filter roll-off. To use the coefficients you define, specify a custom filter by setting the Filter Type property or the NIFGEN_ATTR_OSP_FIR_FILTER_TYPE attribute. The NI 5441 has 95 symmetrical coefficients defined for the FIR filter.
FIR Coefficient Scaling
The coefficients should be scaled between -1 and 1. NI-FGEN quantizes the floating point inputs and downloads them into the OSP block. The coerced coefficients can be queried with the niFgen Get FIR Filter Coefficients VI or the niFgen_GetFIRFilterCoefficients function. When scaling the coefficients, consider that the FIR is architected for unity gain. This means that if a data set of all full-scale positive values is passed into the FIR and the sum of the coefficients is equal to 1, then positive full scale is output from the FIR. In general, the coefficients should be scaled as high as possible so that the FIR does not overflow the incoming data set and the coefficients are still within the range of -1 to 1.
CIC Compensation in the FIR
In order to flatten the OSP block in the passband, the FIR coefficients should compensate for the roll-off in the CIC filter. The frequency response (in dB) of the CIC follows the following formula:
where
R = CIC Interpolation Rate
f = Frequency (fraction of CIC input sample rate)
The first zero of the CIC filter is always at the same frequency as the output of the FIR filter. The FIR response should be peaked the same amount that the CIC rolls off in the passband of your FIR response. For example, the following diagram shows the desired response from the FIR with 4x interpolation.
But, the CIC has the following response:
The CIC compensated FIR response is:
The final response after the FIR (with CIC compensation) and CIC filters: