STM32F1 CMSIS DSP Fast Math Functions

Started by tha, July 16, 2021, 07:31:12 AM

Previous topic - Next topic

tha

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



Description

คำนวณ the square root ของ a number. มีฟังัช่นที่แยกกันสำหรับ Q15, Q31, and floating-point data types. The square root function ถูกคำนวณโดยใช้ the Newton-Raphson algorithm. นี้คือ an iterative algorithm ของ the form:

x1 = x0 - f(x0)/f'(x0)

โดยที่ x1 คือค่าประมาณปัจจุบัน x0 คือค่าประมาณก่อนหน้า และ f'(x0) คืออนุพันธ์ของ f() ที่ประเมินที่ x0 สำหรับฟังก์ชันสแควร์รูท อัลกอริธึมจะลดลงเป็น:

x0 = in/2                         [การเดาเบื้องต้น]
x1 = 1/2 * ( x0 + in / x0)        [การวนซ้ำแต่ละครั้ง]

tha



Returns

The function ส่งคืน ARM_MATH_SUCCESS ถ้า input value เป็นค่าบวกหรือ ARM_MATH_ARGUMENT_ERROR ถ้า in เป็นค่าลบและส่งคืน zero output สำหรับค่าลบ.

References ARM_MATH_ARGUMENT_ERROR, and ARM_MATH_SUCCESS.

Referenced by arm_cmplx_mag_f32(), arm_rms_f32(), and arm_std_f32().

tha



Returns

The function ส่งคืน ARM_MATH_SUCCESS ถ้า input value เป็นค่าบวกหรือ ARM_MATH_ARGUMENT_ERROR ถ้า in เป็นค่าลบและส่งคืน zero output สำหรับค่าลบ.

Parameters

[in]   in   input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
[out]   *pOut   square root of input value.

Returns

The function ส่งคืน ARM_MATH_SUCCESS ถ้า input value เป็นค่าบวกหรือ ARM_MATH_ARGUMENT_ERROR ถ้า in เป็นค่าลบ สำหรับ negative inputs, the function ส่งคืน *pOut = 0.

References ARM_MATH_ARGUMENT_ERROR, and ARM_MATH_SUCCESS.

Referenced by arm_cmplx_mag_q15(), arm_rms_q15(), and arm_std_q15().


tha


tha

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



Description

คำนวณ the trigonometric cosine function โดยใช้การรวมของ table lookup และ linear interpolation. มี separate functions สำหรับ Q15, Q31, and floating-point data types. The input ไปยัง the floating-point version อยู่ใน radians และใน the range [0 2*pi) ในขณะที่ the fixed-point Q15 and Q31 มี a scaled input ด้วย the range [0 +0.9999] แม็ปไปยัง [0 2*pi). The fixed-point range ถูกเลือกดังนั้นค่าของ 2*pi พันรอบเป็น 0.

การจัดให้มีใช้ขึ้นอยู่กับ table lookup โดยใช้ 256 values พร้อมด้วย linear interpolation. ขั้นตอนนี้ถูกใช้ :

1.    การคำนวณของ the nearest integer table index
2.    คำนวณ the fractional portion (fract) of the table index.
3.    The final result เท่ากับ (1.0f-fract)*a + fract*b;

โดยที่

   b=Table[index+0];
   c=Table[index+1];

tha


tha


tha