質問編集履歴
6
画像の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -88,4 +88,4 @@
|
|
88
88
|
```
|
89
89
|
|
90
90
|
###結果
|
91
|
-

|
5
dc成分を除去したときのコードと結果を追加
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
|
+

|
4
1枚目のグラフを間違えていたので修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
|
42
42
|
```
|
43
43
|
|
44
|
-

|
45
45
|
|
46
46
|
|
47
47
|
|
3
Ampのプロットと全範囲のプロット、それに伴う画像と#FFT graph以下のコード変更
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=
|
30
|
+
fig, ax = plt.subplots(nrows=4, sharex=True, figsize=(6,6))
|
31
|
-
ax[0].plot(F.real
|
31
|
+
ax[0].plot(F.real, label="Real part")
|
32
32
|
ax[0].legend()
|
33
|
-
ax[1].plot(F.imag
|
33
|
+
ax[1].plot(F.imag, label="Imaginary part")
|
34
34
|
ax[1].legend()
|
35
|
-
ax[2].plot(freq
|
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[
|
39
|
+
ax[3].set_xlabel("Number of data")
|
38
40
|
plt.show()
|
39
41
|
|
40
42
|
```
|
41
43
|
|
42
|
-

|
43
45
|
|
44
46
|
|
45
47
|
|
2
タイトル修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Python
|
1
|
+
Pythonのnumpyで高速フーリエ変換(FFT)をしたい
|
body
CHANGED
File without changes
|
1
タイトル修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Python(Jupyter notebook)でFFTをしたい
|
1
|
+
Python(Jupyter notebook)で高速フーリエ変換FFTをしたい
|
body
CHANGED
File without changes
|