The model about the GFLIB_Asin function comparing with the Asin Math Function in Matlab/Simulink:
As above Shown,The input paramater is 0.5 ,but the answer is difference,why?who can help us ,Thanks a lot.
Hi Eden Li,
With this question you have opened the Pandora's box of numerical methods on embedded system :-)
There are a lot of technical articles about numeric approximations in the field of transcendental functions. Since we are dealing with an embedded system where time matters - we need to take into account some "shortcuts" when computing a specific function. In other words, you do not want to spend a great amount of time computing a number with a high precision by introducing penalties to other critical processes.
For this particular case asin(x), the implementation is using the Taylor polynomial approximation for 2 different numerical intervals: [0, 0.4) with relative good precision using a specific set of polynomial coefficients and [0.4, 1) with "some" precision using a different set.
On the other hand, the Matlab is using the FDLIBM implementation (you can get details here: http://www.netlib.org/fdlibm/e_asin.c ) which gives much better results but the execution time is longer if implemented on MPC564x e200@150MHz.
Hence, the difference results depending on the value received as input between our implementation and the one from Matlab. If we compare the 2 methods over the entire range of inputs we get:
As said before, you need to accept a trade off between speed vs. precision.
If we compare the output dynamically for an input sine signal [-1,1] we get the following:
For the reference I've included a model to replicate this.
Hope this clarify your concern!
Hi，Dumitru-daniel.popa,thank you very much for your reply,Iam very grateful for your help!
Retrieving data ...