Hi again,
The GDFLIB_FilterIIR2_FLT function is designed for periodic use and the GDFLIB_FilterIIR2Init_FLT function only needs to be called once at the beginning.
Here is a simplified example of how to use this filter periodically:
//---------------------------------------------------------------------
float fltIn[10] = {0, 0.3211, 0.7427, 0.6645, 0.2892, 0.3374, 0.9086, 0.0323, 0.6964, 0.2088};
float fltOut;
flttrMyIIR2.trFiltCoeff.fltB0 = (float)(0.066122101544579);
flttrMyIIR2.trFiltCoeff.fltB1 = (float)(0.0);
flttrMyIIR2.trFiltCoeff.fltB2 = (float)(-0.066122101544579);
flttrMyIIR2.trFiltCoeff.fltA1 = (float)(-1.776189018043779);
flttrMyIIR2.trFiltCoeff.fltA2 = (float)(0.867755796910841);
GDFLIB_FilterIIR2Init_FLT(&flttrMyIIR2);
for (int i = 0; i < 10; i++){
fltOut = GDFLIB_FilterIIR2_FLT(fltIn[i], &flttrMyIIR2);
}
//---------------------------------------------------------------------
A NaN value may appear at the filter output for several reasons:
- Input values contain at least one denormalized number
- Input values contain at least one NaN, Inf, or –Inf
- Output overflow/underflow
- Intermediate result overflow/underflow
More details can be found in the document Accuracy of Floating-Point Functions (S32K3XXMCFLTACC).