計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です...
Post on 19-Dec-2015
256 views
TRANSCRIPT
![Page 1: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/1.jpg)
計算のスピードアップ• コンピュータでも、 sin、 cosの計算は大変です
• 足し算、引き算、掛け算、割り算は早いです
• 対称性を利用して sin、 cosを計算するとよい
![Page 2: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/2.jpg)
高速フーリエ変換( FFT)
![Page 3: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/3.jpg)
対称性の利用
![Page 4: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/4.jpg)
対称性を利用すると計算速度は上がるが、データ数に制限が付く
• 一周 (2π)を 4分割、8分割、 16分割、32分割、 64分割、 128分割、 256分割で考える
![Page 5: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/5.jpg)
Excelの FFT
32データにしましょう
![Page 6: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/6.jpg)
xをつくる
![Page 7: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/7.jpg)
これを例にしてみます
![Page 8: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/8.jpg)
![Page 9: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/9.jpg)
mの作成
![Page 10: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/10.jpg)
データ分析の利用
![Page 11: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/11.jpg)
入力データを選択
![Page 12: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/12.jpg)
![Page 13: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/13.jpg)
出力先を決める
![Page 14: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/14.jpg)
![Page 15: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/15.jpg)
フーリエ分析
![Page 16: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/16.jpg)
フーリエ係数の計算
![Page 17: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/17.jpg)
フーリエ係数の作成
![Page 18: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/18.jpg)
フーリエ係数
![Page 19: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/19.jpg)
わかりやすい例
a1=1それ以外は 0
![Page 20: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/20.jpg)
FFTの結果OK!
?
![Page 21: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/21.jpg)
![Page 22: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/22.jpg)
m=31の正体
エイリアシング
![Page 23: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/23.jpg)
信号解析• まず、1周期分を取り出す
![Page 24: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/24.jpg)
取り出し方によって、偶関数、奇関数、どちらでもない関数
それぞれでフーリエ係数も変わってしまう
![Page 25: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/25.jpg)
信号の作成
n=100まで
![Page 26: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/26.jpg)
n=0から 31まで貼り付ける
![Page 27: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/27.jpg)
n=8から n=39まで貼り付ける
![Page 28: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/28.jpg)
n=12から n=43まで貼り付ける
![Page 29: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/29.jpg)
それぞれをフーリエ解析してみる
やはり結果が違う
![Page 30: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/30.jpg)
ノルム /(データ数 /2) を計算してみる
ノルムは同じになる
![Page 31: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/31.jpg)
周期の取り出しについて
![Page 32: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/32.jpg)
こういう波が連続していると解釈できる
![Page 33: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/33.jpg)
実際の波では周期が厳密にわからないこともある
周期の取り方が少しでもおかしいと、結果がめちゃくちゃになるようでは困る
![Page 34: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/34.jpg)
周波数を使ったフーリエ解析データの作成
t: 0から 0.1刻みで 10秒まで
![Page 35: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/35.jpg)
![Page 36: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/36.jpg)
1周期分切り出す
0秒から 3.1秒まで
周期は 3.2秒
![Page 37: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/37.jpg)
フーリエ解析の準備
周期
![Page 38: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/38.jpg)
フーリエ解析とノルムの計算
![Page 39: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/39.jpg)
同様に、二周期分を取ってみる
周期は 6.4秒
0秒から 6.3秒まで
![Page 40: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/40.jpg)
![Page 41: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/41.jpg)
周波数で見たフーリエ解析の結果
どちらも周波数 0.3125[Hz]のところの振幅が1となる。周波数で考えれば、まちがえて2周期分を1周期としても問題ない
![Page 42: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/42.jpg)
周期に切れ目でうまく切り出せない場合
• 1周期がどこなのか、わかりにくい• 32、64、128などのデータ数にならない
![Page 43: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/43.jpg)
周期:約 4.19秒周波数 0.239[Hz]
周期:約 2.51秒周波数:0.398[Hz]
![Page 44: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/44.jpg)
周期は約 12.6秒だが(正確には4 π秒)そこで切ると FFTが出来ない
0秒から 12.7秒の 128データで FFTをしてみる
![Page 45: 計算のスピードアップ コンピュータでも、 sin 、 cos の計算は大変 です 足し算、引き算、掛け算、割り算は早い です 対称性を利用して](https://reader037.vdocuments.site/reader037/viewer/2022102513/56649d2e5503460f94a04e11/html5/thumbnails/45.jpg)
周波数 0.390625[Hz]の振幅が 1.919211周波数 0.234375[Hz]の振幅が 1.051395
正解は周波数 0.398[Hz]の振幅が 2周波数 0.239[Hz]の振幅が 1
まあまあ合っている