Main Content

fixpt_evenspace_cleanup

Modify breakpoints of lookup table to have even spacing

Syntax

xdata_modified = fixpt_evenspace_cleanup(xdata,xdt,xscale)

Description

xdata_modified = fixpt_evenspace_cleanup(xdata,xdt,xscale) modifies breakpoints of a lookup table to have even spacing after quantization. By adjusting breakpoints to have even spacing after quantization, Simulink® Coder™ generated code can exclude breakpoints from memory.

xdata is the breakpoint vector of a lookup table to make evenly spaced, such as 0:0.005:1. xdt is the data type of the breakpoints, such as sfix(16). xscale is the scaling of the breakpoints, such as 2^-12. Using these three inputs, fixpt_evenspace_cleanup returns the modified breakpoints in xdata_modified.

This function works only with nontunable data and considers data to have even spacing relative to the scaling slope. For example, the breakpoint vector [0 2 5], which has spacing value 2 and 3, appears to have uneven spacing. However, the difference between the maximum spacing 3 and the minimum spacing 2 equals 1. If the scaling slope is 1 or greater, a spacing variation of 1 represents a 1-bit change or less. In this case, the fixpt_evenspace_cleanup function considers a spacing variation of 1 bit or less to be even.

Modifications to breakpoints can change the numerical behavior of a lookup table. To check for changes, test the model using simulation, rapid prototyping, or other appropriate methods.

Examples

Modify breakpoints of a lookup table to have even spacing after quantization:

xdata = 0:0.005:1;
xdt = sfix(16);
xscale = 2^-12;
xdata_modified = fixpt_evenspace_cleanup(xdata,xdt,xscale)

Version History

Introduced before R2006a