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,金宝app®Coder™generated code can exclude breakpoints from memory.

xdatais the breakpoint vector of a lookup table to make evenly spaced, such as0:0.005:1.xdtis the data type of the breakpoints, such assfix(16).xscaleis the scaling of the breakpoints, such as2^-12. Using these three inputs,fixpt_evenspace_cleanupreturns the modified breakpoints inxdata_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, thefixpt_evenspace_cleanupfunction 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)
Introduced before R2006a