Fixed-Point Blockset | ![]() ![]() |
Example 6: Using nptsmax with Power of Two Spacing
The next example shows how to create a lookup table that has power of two spacing and minimizes the worst case error for a specified maximum number of points. To try the example, you must first enter the parameter values given in the section Setting Function Parameters for the Lookup Table, if you have not already done so in this MATLAB session:
spacing ='pow2'; [xdata, errworst]= fixpt_look1_func_approx(funcstr,... xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,[],nptsmax,spacing);
The result requires 17 points to achieve a maximum absolute error of 2^-9.6267.
To plot the lookup table along with the errors, type
This produces the plots shown below.
![]() | Example 5: Using errmax with Power of Two Spacing | Specifying Both errmax and nptsmax | ![]() |