teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

6

画像の修正

2019/01/24 06:03

投稿

naoya7076
naoya7076

スコア28

title CHANGED
File without changes
body CHANGED
@@ -88,4 +88,4 @@
88
88
  ```
89
89
 
90
90
  ###結果
91
- ![イメージ説明](250d638cef8648236257668035cd4baa.png)
91
+ ![イメージ説明](489203095b53959d23c05f4c2ab6b563.png)

5

dc成分を除去したときのコードと結果を追加

2019/01/24 06:03

投稿

naoya7076
naoya7076

スコア28

title CHANGED
File without changes
body CHANGED
@@ -45,4 +45,47 @@
45
45
 
46
46
 
47
47
 
48
- [電圧データ](https://www.dropbox.com/s/cnr26ac09seqw0j/398Hz.csv?dl=0)
48
+ [電圧データ](https://www.dropbox.com/s/cnr26ac09seqw0j/398Hz.csv?dl=0)
49
+
50
+ ## DC成分を引いた場合
51
+ ```remove_dc.ipynb
52
+ test_data_middle = pd.read_csv("CSVファイルへのパス")
53
+ x = test_data_middle["time"]
54
+ y = test_data_middle["volt"]
55
+ N = len(y)
56
+ dt = x[1]-x[0]
57
+
58
+ t = np.arange(0,N*dt,dt)
59
+ #DCを削除する為に元データの平均を引く
60
+ Y = np.array(y)
61
+ Y_block_offset = Y - Y.mean()
62
+
63
+
64
+ F = np.fft.fft(Y_block_offset)
65
+ Amp = np.abs(F)
66
+ freq = np.fft.fftfreq(N,d=dt)
67
+
68
+ #PLot
69
+ plt.figure(figsize=(18,3),facecolor="white")
70
+ plt.plot(x,Y_block_offset,'b-', linewidth=1)
71
+ plt.xlabel('Time')
72
+ plt.ylabel('Volt')
73
+ plt.grid(True)
74
+
75
+ #FFT graph
76
+ fig, ax = plt.subplots(nrows=4, sharex=True, figsize=(6,6))
77
+ ax[0].plot(F.real[0:20], label="Real part")
78
+ ax[0].legend()
79
+ ax[1].plot(F.imag[0:20], label="Imaginary part")
80
+ ax[1].legend()
81
+ ax[2].plot(freq[0:20], label="Frequency")
82
+ ax[2].legend()
83
+ ax[3].plot(Amp[0:20], label="Amp")
84
+ ax[3].legend()
85
+ ax[3].set_xlabel("Number of data")
86
+
87
+ plt.show()
88
+ ```
89
+
90
+ ###結果
91
+ ![イメージ説明](250d638cef8648236257668035cd4baa.png)

4

1枚目のグラフを間違えていたので修正

2019/01/24 05:48

投稿

naoya7076
naoya7076

スコア28

title CHANGED
File without changes
body CHANGED
@@ -41,7 +41,7 @@
41
41
 
42
42
  ```
43
43
 
44
- ![イメージ説明](ec0f270691d2cbc05475ee68cf85b97e.png)
44
+ ![イメージ説明](fb100b90f2c374246fbd68eba35eee0f.png)
45
45
 
46
46
 
47
47
 

3

Ampのプロットと全範囲のプロット、それに伴う画像と#FFT graph以下のコード変更

2019/01/23 04:46

投稿

naoya7076
naoya7076

スコア28

title CHANGED
File without changes
body CHANGED
@@ -27,19 +27,21 @@
27
27
  plt.grid(True)
28
28
 
29
29
  #FFT graph
30
- fig, ax = plt.subplots(nrows=3, sharex=True, figsize=(6,6))
30
+ fig, ax = plt.subplots(nrows=4, sharex=True, figsize=(6,6))
31
- ax[0].plot(F.real[0:10], label="Real part")
31
+ ax[0].plot(F.real, label="Real part")
32
32
  ax[0].legend()
33
- ax[1].plot(F.imag[0:10], label="Imaginary part")
33
+ ax[1].plot(F.imag, label="Imaginary part")
34
34
  ax[1].legend()
35
- ax[2].plot(freq[0:10], label="Frequency")
35
+ ax[2].plot(freq, label="Frequency")
36
36
  ax[2].legend()
37
+ ax[3].plot(Amp, label="Amp")
38
+ ax[3].legend()
37
- ax[2].set_xlabel("Number of data")
39
+ ax[3].set_xlabel("Number of data")
38
40
  plt.show()
39
41
 
40
42
  ```
41
43
 
42
- ![イメージ説明](a2e06a0ce4a0261d07ca57507e0e7b16.png)
44
+ ![イメージ説明](ec0f270691d2cbc05475ee68cf85b97e.png)
43
45
 
44
46
 
45
47
 

2

タイトル修正

2019/01/23 04:24

投稿

naoya7076
naoya7076

スコア28

title CHANGED
@@ -1,1 +1,1 @@
1
- Python(Jupyter notebook)で高速フーリエ変換FFTをしたい
1
+ Pythonのnumpyで高速フーリエ変換(FFT)をしたい
body CHANGED
File without changes

1

タイトル修正

2019/01/23 03:16

投稿

naoya7076
naoya7076

スコア28

title CHANGED
@@ -1,1 +1,1 @@
1
- Python(Jupyter notebook)でFFTをしたい
1
+ Python(Jupyter notebook)で高速フーリエ変換FFTをしたい
body CHANGED
File without changes