Fixed-Point Blockset    

Worst Case Error for a Lookup Table

This section explains the worst case error of a lookup table, and how to find the worst case error using the function fixpt_look1_func_plot. It gives a simple example of the worst case error of a lookup table for the square root function.

The error at any point of a function lookup table is the absolute value of the difference between the ideal function at the point and the corresponding Y value found by linearly interpolating between the adjacent breakpoints. The worst case error, or maximum absolute error, of a lookup table is the maximum absolute value of all errors in the interval containing the breakpoints.

For example, if the ideal function is the square root, and the breakpoints of the lookup table are 0, .25 and 1, then in a perfect implementation of the lookup table, the worst case error is 1/8 = .125, which occurs at the point 1/16 = .0625. In practice, the error could be greater, depending on the fixed point quantization and other factors.

Example: Square Root Function

This example shows how to use the function fixpt_look1_func_plot to find the maximum absolute error for the simple lookup table whose breakpoints are 0, .25, and 1. The corresponding Y data points of the lookup table, which you find by taking the square roots of the breakpoints, are 0, .5 and 1.

To use the function fixpt_look1_func_plot, you need to first define its parameters. To do so, type the following at the MATLAB prompt:

Next, type

This returns the worst case error of the lookup table as the variable errworst:

It also generates the plots shown below. The upper box (Outputs) displays a plot of the square root function, and a plot of the fixed-point lookup approximation underneath. The approximation is found by linear interpolation between the breakpoints. The lower box (Absolute Error) displays the errors at all points in the interval from 0 to 1. Notice that the maximum absolute error occurs at .0625. The error at the breakpoints is 0.


  Overview Creating Lookup Tables for a Sine Function