Evaluating the accuracy of an integrator

I'm designing a digital signal processing chain that includes integration of a periodic input followed by decimation/resampling. The processor is integer/fixed point only, so the primary source of error is numerical. I'm simulating the process in python in order to evaluate the accuracy of different algorithms and parameters.

I have a target maximum error of 0.3%, and I'm in conversation with the project owner about how to interpret that, but I'm curious about standard practices for evaluating accuracy in a signal processing chain.

I could take the absolute value of the difference between my signal and the target (in this case a synthesized ideal integral) and divide by the value of the target. But this doesn't work when the signal passes through 0.

If I divide instead by the peak value, I find that the primary contributor to the instantaneous error is a small phase discrepancy. If the two signals have the same shape, but one is delayed by half a sample, I somehow feel like that shouldn't count as much toward the real error.

• 3% of what? The project owner kindly must explain this vague error target in a more specific, unambigious, language, possibly using a mathematical formula... Commented Mar 22, 2022 at 22:12
• Regarding digital integrators, the material at the following web page may be of some interest to you: dsprelated.com/showarticle/1299.php Commented Mar 23, 2022 at 10:11
• @Fat32 Yes, this is really the key point. After more discussion we established that it was percentage of reading that they wanted measured and we were able to establish the minimum reading for which this threshold had to be met. Commented Apr 19, 2022 at 21:46

1 Answer

The standard practice for this is to develop the algorithm in floating point first test it and verify that it meets all performance requirements. Once that's signed off, you can start doing a fixed point implementation and compare the output to that of the floating point reference. In most cases a signal to noise metric is useful, i.e.

$$SNR = 10\cdot log_{10}(\frac{\sum x_{float}^2}{\sum (x_{fixed} -x_{float})^2})$$

You have to make sure that you have a good set of test vectors that cover not only the normal use cases but also the outliers and/or most challenging signals.

Integrators are tricky since they are only marginally stable and have infinite gain at 0Hz. The maximum gain is determined by the lowest frequency in your signal, so some sort of high pass or DC blocker would be useful. You need to know this maximum gain to scale your fixed point implementation properly and avoid clipping.

• Thank you. I was able to develop a simulator where I generated band limited test signals and their ideal mathematical integral in floating point, then compared this with the fixed point output of the simulated algorithm. What worked best was actually generating thousands of test signals randomized over the input space and scatter plotting the resulting error. Commented Apr 19, 2022 at 21:52