2023-12-14 09:10 AM
Hi,
I have a general question regarding the problem I am facing.
Currently, the pSpeed Value is very small (for example 3.4E-7) and when I perform a square for such values it becomes smaller. When I pass the Square data value to the arm_sqrt_f32() function, the value is correct when I have small values in the pSpeed array.
To resolve it I Multiplied the Speed array values by 1000 and then divided the speed Value by 100 at the end and now my values become accurate as per the Excel sheet value (I passed those raw values to Excel to verify my results)
I assume that arm_sqrt_f32() is rounding up the value because of squareData. Is it correct?
If yes then I can safely use the technique of multiplying and dividing by 1000 or someone can help with any other strategy
I would appreciate help in this regard
2023-12-15 10:15 AM
What chip? If it has an FPU, it will be faster to use native sqrt functions.
2023-12-15 11:34 AM
>>When I pass the Square data value to the arm_sqrt_f32() function, the value is correct when I have small values in the pSpeed array.
Did you mean to say that it's incorrect for very small values?
Please show specific examples of inputs vis outputs, and the error as you square and subtract from the initial value
Which STM32 and CMSIS-DSP library version?
2023-12-17 08:51 PM
What chip?
STM32L4R9ZIJ6
If it has an FPU, it will be faster to use native sqrt functions
Yes, it has FPU. Thanks for the suggestion. I will use sqrtf() and will get back to you with the results
2023-12-17 09:08 PM
Did you mean to say that it's incorrect for very small values?
Yes. Sorry for the typo. I have updated my post now
Please show specific examples of inputs vis outputs, and the error as you square and subtract from the initial value
I have an array of float for 512 speed values we only use 256 values for calculating Speed RMS
Example Values are:
1.99908E-06, 3.61418E-06, 5.22994E-07, 1.18181E-06, 2.86142E-06
With square, the values become too much small, and the RMS value becomes incorrect by comparing the Speed RMS calculated by Excel. Keeping Speed Array data constant
Which STM32 and CMSIS-DSP library version?
STM32L4R9ZIJ6