| Fixed-Point Blockset | ![]() |
Specifying Both errmax and nptsmax
If you include both the errmax and the nptsmax parameters, the function fixpt_look1_func_approx tries to find a lookup table with at most nptsmax data points, whose worst case error is at most errmax. If it can find a lookup table meeting both conditions, it uses the following order of priority for spacing:
If the function cannot find any lookup table satisfying both conditions, it ignores nptsmax and returns a lookup table with unrestricted spacing, whose worst case error is at most errmax. In this case, the function behaves the same as if the nptsmax parameter were omitted.
Using the parameters described the section Setting Function Parameters for the Lookup Table, the following examples illustrate the results of using different values for nptsmax when you enter
[xdata ydata errworst]=fixpt_look1_func_approx(funcstr, xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,numptsmax);
The results for three different settings for nptsmax are as follows:
numptsmax=33 -- The function creates the lookup table with 33 points having power of two spacing as in Example 3.
numptsmax=21 -- Since the errmax and numptsmax conditions cannot be met with power of two spacing, the function creates the lookup table with 20 points having even spacing, as in Example 5.
numptsmax=16 -- Since the errmax and numptsmax conditions cannot be met with either power of two or even spacing, the function creates the lookup table with 16 points having unrestricted spacing, as in Example 1.
| Example 6: Using nptsmax with Power of Two Spacing | Comparing the Examples | ![]() |