1.4.4.59 LUTwInterpolation_Q15 Function

fract_q15_t LUTwInterpolation_Q15( fract_q15_t x,

const fract_q15_t * pX_LUT_Vector,

const fract_q15_t * pY_LUT_Vector,

const uint16_t nLUTSize );

Summary

Calculates calculates y = f(x) based on a lookup table with linear interpolation between table entries.

Description

Calculates calculates y = f(x) based on a lookup table with linear interpolation between table entries.

Preconditions

None.

Parameters

x Q15 value, independent variable

pX_LUT_Vector X column of LUT in Q15

pY_LUT_Vector Y column of LUT in Q15

nLutSize number of rows (entries) in the LUT

Returns

y = f(x) based on the LUT using linear interpolation between table entries.

Remarks

It is assumed that X LUT vector is in strictly monotonically increasing order.

That is: pX_LUT_Vector < pX_LUT_Vector for i = 0,1,...nLUTSize-2

Internal math is done in signed 32 integers and truncated to Q15.

If x <= pX_LUT_Vector then pY_LUT_Vector is returned.

if pX_LUT_Vector <= x then pY_LUT_Vector is returned.

Warning: It is strongly recommended that you test out the LUT and compare actual vs. desired values in Matlab/Octave or Excel! You may need to add additional rows where the interpolation does not produce the needed accuracy.

C

fract_q15_t LUTwInterpolation_Q15 (fract_q15_t x , const fract_q15_t * pX_LUT_Vector , const fract_q15_t * pY_LUT_Vector , const uint16_t nLUTSize );