![]()  | 
  
  
    CMSIS-DSP
    Verison 1.1.0
    
   CMSIS DSP Software Library 
   | 
  
  
  
 
Variables | |
| static const float32_t | cosTable [360] | 
| static const float32_t | sinTable [360] | 
| static const int32_t | sinTableQ31 [360] | 
| static const int32_t | cosTableQ31 [360] | 
Functions | |
| void | arm_sin_cos_f32 (float32_t theta, float32_t *pSinVal, float32_t *pCosVal) | 
| Floating-point sin_cos function.   | |
| void | arm_sin_cos_q31 (q31_t theta, q31_t *pSinVal, q31_t *pCosVal) | 
| Q31 sin_cos function.   | |
Computes the trigonometric sine and cosine values using a combination of table lookup and linear interpolation. There are separate functions for Q31 and floating-point data types. The input to the floating-point version is in degrees while the fixed-point Q31 have a scaled input with the range [-1 0.9999] mapping to [-180 179] degrees.
The implementation is based on table lookup using 360 values together with linear interpolation. The steps used are:
index from sine table to y0 and also value from index+1 to y1. *psinVal = y0 + (fract * (y1 - y0)).index from cosine table to y0 and also value from index+1 to y1. *pcosVal = y0 + (fract * (y1 - y0)). for(i = 0; i < 360; i++)    
 {    
    cosTable[i]= cos((i-180) * PI/180.0);    
 }  Referenced by arm_sin_cos_f32().
const int32_t cosTableQ31[360] [static] | 
        
for(i = 0; i < 360; i++)    
 {    
    cosTable[i]= cos((i-180) * PI/180.0);    
 }  Referenced by arm_sin_cos_q31().
for(i = 0; i < 360; i++)    
 {    
    sinTable[i]= sin((i-180) * PI/180.0);    
 }  Referenced by arm_sin_cos_f32().
const int32_t sinTableQ31[360] [static] | 
        
for(i = 0; i < 360; i++)    
 {    
    sinTable[i]= sin((i-180) * PI/180.0);    
 }  Convert above coefficients to fixed point 1.31 format. Referenced by arm_sin_cos_q31().
| [in] | theta | scaled input value in degrees | 
| [out] | *pSinVal | points to the processed sine output. | 
| [out] | *pCosVal | points to the processed cosine output. | 
The Q31 input value is in the range [-1 0.999999] and is mapped to a degree value in the range [-180 179].
References cosTableQ31, INPUT_SPACING, and sinTableQ31.