Simulink Reference Previous page   Next Page
fixpt_evenspace_cleanup

Modify lookup table input data to be evenly spaced

Syntax

Description

xdata_adjusted = fixpt_evenspace_cleanup(xdata_original, xdt, xscale) modifies lookup table input data to be evenly spaced if it is not quite evenly spaced after quantization. For example, 0:0.005:1 appears evenly spaced, but if it is quantized with scaling 2^-12, it is not evenly spaced. Loss of even spacing can make a significant impact on the efficiency of your implementation. Code generated by Real-Time Workshop to implement an uneven lookup table is more complicated. In addition, unevenly spaced input data is stored in data memory. If you modify the input data to remain evenly spaced after quantization, Real-Time Workshop generates simpler code and excludes the input data from memory, thereby saving significant amounts of data memory.

The modifications to the lookup table input data are likely to change the numerical behavior of the table. The numerical changes may or may not be trivial, so you should test the model using simulation, rapid prototyping, or other appropriate methods. This function is intended for use with nontunable data. Tunable data is always treated as if it were unevenly spaced. Even if tunable data starts out evenly spaced, it may later be tuned to values that are unevenly spaced.

It is important to note that the data is judged to be "almost" evenly spaced relative to the scaling slope. Consider the data vector [0 2 5], which has spacing value 2 and 3. A natural first impression is that the data has significantly 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, then a spacing variation of 1 represents a one bit change or less. A spacing variation of one bit or less is judged to be "almost" evenly spaced, and this function will adjust the data to force it to be evenly spaced.

The required input parameters of this function are as follows.

Input
Value
Example
xdata_original
Input lookup data
0:0.005:1
xdt
Input data type
sfix(16)
xscale
Input scaling
2^-12

See Also

fixdt, fixpt_interp1, fixpt_look1_func_approx, sfix, ufix


Previous page  fixptbestprec fixpt_interp1 Next page

© 1994-2005 The MathWorks, Inc.