V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Embed: (wiki syntax)

« Back to documentation index

Sine Cosine

Computes the trigonometric sine and cosine values using a combination of table lookup and linear interpolation. More...

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.

Detailed Description

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 +180] degrees.

The floating point function also allows values that are out of the usual range. When this happens, the function will take extra time to adjust the input value to the range of [-180 180].

The implementation is based on table lookup using 360 values together with linear interpolation. The steps used are:

  1. Calculation of the nearest integer table index.
  2. Compute the fractional portion (fract) of the input.
  3. Fetch the value corresponding to index from sine table to y0 and also value from index+1 to y1.
  4. Sine value is computed as *psinVal = y0 + (fract * (y1 - y0)).
  5. Fetch the value corresponding to index from cosine table to y0 and also value from index+1 to y1.
  6. Cosine value is computed as *pcosVal = y0 + (fract * (y1 - y0)).

Function Documentation

void arm_sin_cos_f32 ( float32_t  theta,
float32_t *  pSinVal,
float32_t *  pCosVal 
)

Floating-point sin_cos function.

Parameters:
[in]thetainput value in degrees
[out]*pSinValpoints to the processed sine output.
[out]*pCosValpoints to the processed cos output.
Returns:
none.

Definition at line 84 of file arm_sin_cos_f32.c.

void arm_sin_cos_q31 ( q31_t  theta,
q31_t *  pSinVal,
q31_t *  pCosVal 
)

Q31 sin_cos function.

Parameters:
[in]thetascaled input value in degrees
[out]*pSinValpoints to the processed sine output.
[out]*pCosValpoints to the processed cosine output.
Returns:
none.

The Q31 input value is in the range [-1 0.999999] and is mapped to a degree value in the range [-180 179].

Definition at line 64 of file arm_sin_cos_q31.c.