Fixed-Point Blockset    

Effect of Spacing on Speed, Error, and Memory Usage

This section compares the implementations of lookup tables that use breakpoints whose spacing is uneven, even, and power of two. This comparison is only valid when the breakpoints are not tunable. If the breakpoints can be tuned in the generated code, then all three cases generate the same code. The comparison will focus on the amount of read-only memory (ROM) used for data, the amount of ROM used for commands, and the speed with which the commands are executed.

As a specific example, this comparison uses the demo fxpdemo_approx_sin. There are three fixed-point lookup tables in this model. All three lookup tables approximate the function sin(2*pi*u) over the first quadrant. All three achieve a worst case error of less than 2^-8. However, they have different restrictions on their breakpoint spacing.

You can use the model fxpdemo_approx, which this demo opens, to generate code with Real-Time Workshop. This section presents several segments of the generated code. These segments of code were edited and arranged for clarity and to emphasize key differences.

This section covers the following topics:

To open the demo, type at the MATLAB prompt

This opens the model shown below.


  Summary: Using the Lookup Table Functions Data ROM Required