![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ファンクション・ジェネレータ このプログラムの説明は,CQ出版社「トランジスタ技術」の2021年10月号から開始された連載記事「STM32マイコンではじめるPC計測」の中にあります.このプログラムといっしょに使うPC側のプログラムについても同誌を参照してください.
Dependencies: Array_Matrix mbed SerialTxRxIntr MyTicker7
FastSin.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2021-10-06
- Revision:
- 1:0430f1ed6c2c
- Parent:
- 0:53c0fa8a9aa2
File content as of revision 1:0430f1ed6c2c:
//----------------------------------------------------------- // FastSin() 関数 // sin(πx/2) の値の計算 // // 2020/06/01, Copyright (c) 2020 MIKAMI, Naoki //----------------------------------------------------------- #ifndef FASTSIN_POLYNOMIAL_HPP #define FASTSIN_POLYNOMIAL_HPP namespace Mikami { // 引数の範囲: -2 <= x <= 2 inline float FastSin(float x) { static const float A1 = 1.570320019210f; static const float A3 = -0.642113166941f; static const float A5 = 0.071860854119f; if (x > 1.0f) x = 2.0f - x; if (x < -1.0f) x = -2.0f - x; float x2 = x*x; return ((A5*x2 + A3)*x2 + A1)*x; } } #endif // FASTSIN_POLYNOMIAL_HPP