AMMCLib integration with MATLAB

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

AMMCLib integration with MATLAB

1,063 次查看
csr1981
Contributor I

We want to optimize the code containing trigonometric function so that execution time of the code is reduced.

We are using MPC5777C PowerPC microcontroller. 

0 项奖励
回复
1 回复

1,045 次查看
petrz_
NXP Employee
NXP Employee

Hi,

I assume that you are using single precision floating-point arithmetic. Trigonometric functions from the standard math.h library usually sacrifice performance to achieve high accuracy over the entire floating-point range.

The Automotive Math and Motor Control Library (AMMCLib) provides speed-optimized trigonometric functions for applications where the angle is limited to one revolution (i.e. ±π radians) and the accuracy of results does not need to be much higher than the resolution of the A/D converters. AMMCLib also provides a combination of sine and cosine in one function (GFLIB_SinCos) which further reduces the clock cycles. AMMCLib trigonometric functions don't rely on table look-up so the memory footprint remains minimal.

Function Input range Accuracy of results Max. CPU clock cycles on MPC5777C with a commercial compiler
GFLIB_Cos_FLT ±π error max. ±42 ulp 45
GFLIB_Sin_FLT ±π error max. ±42 ulp 56
GFLIB_SinCos_FLT ±π error max. ±42 ulp 81

 

0 项奖励
回复