STM32F1 CMSIS DSP Controller Functions

Started by tha, July 23, 2021, 07:40:16 AM

Previous topic - Next topic

tha

file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__SinCos.html



Description

คำนวณ the trigonometric sine and cosine values โดยใช้การรวมของ table lookup และ linear interpolation. มี separate functions สำหรับ Q31 และ floating-point data types. The input ไปยัง the floating-point version อยู่ในองศาในขณะที่ the fixed-point Q31 มี a scaled input ที่มี the range [-1 0.9999] แม็บกับ [-180 +180] degrees.

The floating point function ยอมให้ค่าที่อยู่นอกย่านปกติอีกด้วย. เมื่อสิ่งนี้เกิดขึ้น, the function จะใช้เวลาพิเศษเพื่อปรับ the input value เป็น the range of [-180 180].

ผลลัพธ์มีความถูกต้องถึง 5 หลักหลังจุดทศนิยม

การใช้งานจะขึ้นอยู่กับ table lookup โดยใช้ 360 values พร้อมกันกับ linear interpolation. ขั้นตอนการใช้คือ:
   1. การคำนวณของ the nearest integer table index.
   2. คำนวณ the fractional portion (fract) of the input.
   3. ดึงค่าที่ตรงกับ index จาก sine table ไปยัง y0 และค่าจาก index+1 ไปยัง y1 อีกด้วย.
   4. Sine value ถูกคำนวณอย่าง *psinVal = y0 + (fract * (y1 - y0)).
   5. ดึงค่าที่ตรงกับ index จาก cosine table ไปยัง y0 และค่าจาก index+1 ไปยัง y1 อีกด้วย.
   6. Cosine value ถูกคำนวณอย่าง *pcosVal = y0 + (fract * (y1 - y0)).

tha


tha