fixpt_interp1
Implement 1-D lookup table
Syntax
y
= fixpt_interp1(xdata
,ydata
,x
,xdt
,xscale
,ydt
,yscale
,rndmeth
)
Description
implements a one-dimensional lookup table to find outputy
= fixpt_interp1(xdata
,ydata
,x
,xdt
,xscale
,ydt
,yscale
,rndmeth
)y
for inputx
. Ifx
falls between twoxdata
values (breakpoints),y
is the result of interpolating between the correspondingydata
values. Ifx
is greater than the maximum value inxdata
,y
is the maximumydata
value. Ifx
is less than the minimum value inxdata
,y
is the minimumydata
value.
If the input data typexdt
or the output data typeydt
is floating point,fixpt_interp1
performs the interpolation using floating-point calculations. Otherwise,fixpt_interp1
uses integer-only calculations. These calculations handle the input scalingxscale
and the output scalingyscale
and obey the rounding methodrndmeth
.
Input Arguments
|
Vector of breakpoints for the lookup table, such as |
||||||||
|
Vector of table data that correspond to the breakpoints for the lookup table, such as |
||||||||
|
Vector of input values for the lookup table to process, such as |
||||||||
|
Data type of input |
||||||||
|
Scaling for input |
||||||||
|
Data type of output |
||||||||
|
Scaling for output |
||||||||
|
Rounding mode supported by fixed-point Simulink®blocks:
|
Examples
Interpolate outputs forx
using a 1-D lookup table that approximates the sine function:
xdata = linspace(0,8,33).'; ydata = sin(xdata); % Define input x as a vector of 201 evenly % spaced points between -1 and 9 (includes % values both lower and higher than the range % of breakpoints in xdata) x = linspace(-1,9,201).'; % Interpolate output values for x y = fixpt_interp1(xdata,ydata,x,sfix(8),2^-3,sfix(16),... 2^-14,'Floor')
See Also
fixpt_evenspace_cleanup
|fixpt_look1_func_approx
|fixpt_look1_func_plot
Topics
- Producing Lookup Table Data(Fixed-Point Designer)