计算ATAN2没有性病的功能或C99

计算ATAN2没有性病的功能或C99

本文介绍了计算ATAN2没有性病的功能或C99的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计算从3轴加速度计的角度,但我的编译器不具有ATAN ATAN2或功能。它有一个预留内存插槽,但它调用的功能,我不能在任何文件中找到。

我的编译器是Keil公司的μVision4运行ARMCC编译器。
该编译具有文件math.h中,但功能是extern和不存在

Is there a lib or function I can include that has the function arctan implemented?Or is there an alternative function to calculate angles from accelerometer? I need full 3-axis calibration of the angles.

Edit: I was hoping to avoid a table full of pre-calculated values.

解决方案

Its not very difficult to implement your own arctan2. Convert arctan2 to arctan using this formula. And you can then calculate arctan using this infinite series. If you sum sufficient number of terms of this infinite series, you will get very close to what the library function arctan2 does.

Here is one similar implementation for exp() that you could use as a reference.

这篇关于计算ATAN2没有性病的功能或C99的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:40