AMMCLib integration with MATLAB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AMMCLib integration with MATLAB

882 Views
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 Kudos
1 Reply

864 Views
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 Kudos