fixpt_look1_func_approx
通过插入查找表数据点来优化非线性函数的定点逼近
语法
[xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,nptsmax)
[xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,[])
[xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,[],nptsmax)
[xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydtydt,yscale,rndmeth,errmax,nptsmax,spacing)
说明
[ 返回查找表的最优断点、应用于断点的理想函数以及最差情形逼近误差。查找表满足您指定的最大可接受误差和最大点数。xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,nptsmax)
[ 返回查找表的最优断点、应用于断点的理想函数以及最差情形逼近误差。查找表满足您指定的最大可接受误差。xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,[])
[ 返回查找表的最优断点、应用于断点的理想函数以及最差情形逼近误差。查找表满足您指定的最大点数。xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,[],nptsmax)
[ 返回查找表的最优断点、应用于断点的理想函数以及最差情形逼近误差。查找表满足您指定的最大可接受误差、最大点数和断点间距。xdata,ydata,errworst] = fixpt_look1_func_approx('func',...
xmin,xmax,xdt,xscale,ydtydt,yscale,rndmeth,errmax,nptsmax,spacing)
在每种情况下,fixpt_look1_func_approx 都会在查找表数据点之间进行插值以优化定点逼近。xmin 和 xmax 输入值指定要逼近断点的范围。xdt、xscale、ydt、yscale 和 rndmeth 输入值遵循定点 Simulink® 模块使用的约定。
errmax、nptsmax 和 spacing 输入值为可选项。在这些输入中,必须至少指定 errmax 或 nptsmax。如果省略这两个输入中的一个,则必须使用方括号 [] 替代省略的输入。fixpt_look1_func_approx 会忽略查找表的该要求。
如果不指定间距,并且有多个间距满足 errmax 和 nptsmax,则 fixpt_look1_func_approx 按以下顺序选择:2 次幂间距、等间距、非等间距。当您同时指定 errmax 和 nptsmax 而不是仅指定两者之一时,此行为适用。
输入参数
| 用于逼近断点的 | ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
|
| ||||||||
| 定点 Simulink 模块支持的舍入模式:
| ||||||||
| 理想函数和查找表给出的逼近值之间的最大可接受误差。 | ||||||||
| 查找表的最大点数。 | ||||||||
| 查找表的断点间距:
|
| 如果您指定... | 查找表的断点... |
|---|---|
| 如果可能,同时满足这两个条件。
|
仅 | 满足误差条件,并且 |
仅 | 满足点数条件,并且 |
输出参量
| 查找表的断点向量。 |
| 将理想函数应用到断点所获得的值的向量。 |
| 最差情形误差,是理想函数和查找表给出的逼近值之间的最大绝对误差。 |
示例
使用查找表逼近定点正弦函数:
func = 'sin(2*pi*x)'; % Define the range over which to optimize breakpoints xmin = 0; xmax = 0.25; % Define the data type and scaling for the inputs xdt = ufix(16); xscale = 2^-16; % Define the data type and scaling for the outputs ydt = sfix(16); yscale = 2^-14; % Specify the rounding method rndmeth = 'Floor'; % Define the maximum acceptable error errmax = 2^-10; % Choose even, power-of-2 spacing for breakpoints spacing = 'pow2'; % Create the lookup table [xdata,ydata,errworst] = fixpt_look1_func_approx(func,... xmin,xmax,xdt,xscale,ydt,yscale,rndmeth,errmax,[],spacing);
版本历史记录
在 R2006a 之前推出
另请参阅
fixpt_evenspace_cleanup | fixpt_look1_func_plot
主题
- Producing Lookup Table Data (Fixed-Point Designer)
- Use Lookup Table Approximation Functions (Fixed-Point Designer)