03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Table 4-71. Approximation polynomial coefficients<br />

a 0 a 1 a 2<br />

-0.000184881402886 0.008311899801389 -0.166655540927577<br />

Figure 4-27 depicts a floating point cosine function generated from Matlab <strong>and</strong> the<br />

approximated value of the cosine function obtained from GFLIB_Cos_FLT, plus their<br />

difference. The course of calculation accuracy as a function of the input angle can be<br />

observed from this figure.<br />

Figure 4-27. cos(x) vs. GFLIB_Cos(fltIn)<br />

Note<br />

The input angle (fltIn) is in single precision floating point<br />

<strong>for</strong>mat considering the input angle directly in radians. As<br />

during the computation the irrational value of π/2 is used <strong>for</strong><br />

subtraction, the correction constant is used to increase the<br />

calculation precision in boundary intervals. This correction<br />

constant is equal to the difference of π/2 computed in double<br />

<strong>and</strong> in single precision. The function call is slightly different<br />

from common approach in the library set. The function can be<br />

called in four different ways:<br />

• With implementation postfix (i.e. GFLIB_Cos_FLT(fltIn,<br />

&pParam)), where the &pParam is pointer to<br />

approximation coefficients. In case the default<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 329

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!