![]() |
CMSIS-DSP
Verison 1.1.0
CMSIS DSP Software Library
|
Variables | |
| static const float32_t | sinTable [259] |
| static const q15_t | sinTableQ15 [259] |
| static const q31_t | sinTableQ31 [259] |
Functions | |
| float32_t | arm_sin_f32 (float32_t x) |
| Fast approximation to the trigonometric sine function for floating-point data. | |
| q15_t | arm_sin_q15 (q15_t x) |
| Fast approximation to the trigonometric sine function for Q15 data. | |
| q31_t | arm_sin_q31 (q31_t x) |
| Fast approximation to the trigonometric sine function for Q31 data. | |
Computes the trigonometric sine function using a combination of table lookup and cubic interpolation. There are separate functions for Q15, Q31, and floating-point data types. The input to the floating-point version is in radians while the fixed-point Q15 and Q31 have a scaled input with the range [0 +0.9999] mapping to [0 2*pi), Where range excludes 2*pi.
The implementation is based on table lookup using 256 values together with cubic interpolation. The steps used are:
a*wa + b*wb + c*wc + d*wdwhere
a=Table[index-1];
b=Table[index+0];
c=Table[index+1];
d=Table[index+2];
and
wa=-(1/6)*fract.^3 + (1/2)*fract.^2 - (1/3)*fract;
wb=(1/2)*fract.^3 - fract.^2 - (1/2)*fract + 1;
wc=-(1/2)*fract.^3+(1/2)*fract.^2+fract;
wd=(1/6)*fract.^3 - (1/6)*fract;
for(n = -1; n < (tableSize + 1); n++)
{
sinTable[n+1]=sin(2*pi*n/tableSize);
} Referenced by arm_sin_f32().
const q15_t sinTableQ15[259] [static] |
tableSize = 256;
for(n = -1; n < (tableSize + 1); n++)
{
sinTable[n+1]=sin(2*pi*n/tableSize);
} where pi value is 3.14159265358979 Referenced by arm_sin_q15().
const q31_t sinTableQ31[259] [static] |
tableSize = 256;
for(n = -1; n < (tableSize + 1); n++)
{
sinTable[n+1]= sin(2*pi*n/tableSize);
} where pi value is 3.14159265358979 Referenced by arm_sin_q31().
| [in] | x | input value in radians. |
References sinTable, and TABLE_SIZE.
Referenced by main().
| [in] | x | Scaled input value in radians. |
The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*pi), Here range excludes 2*pi.
References sinTableQ15, and TABLE_SPACING_Q15.
| [in] | x | Scaled input value in radians. |
The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*pi), Here range excludes 2*pi.
References sinTableQ31, and TABLE_SPACING_Q31.