質問編集履歴
6
画像の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -178,4 +178,4 @@
|
|
178
178
|
|
179
179
|
###結果
|
180
180
|
|
181
|
-
![イメージ説明](25
|
181
|
+
![イメージ説明](489203095b53959d23c05f4c2ab6b563.png)
|
5
dc成分を除去したときのコードと結果を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -93,3 +93,89 @@
|
|
93
93
|
|
94
94
|
|
95
95
|
[電圧データ](https://www.dropbox.com/s/cnr26ac09seqw0j/398Hz.csv?dl=0)
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
## DC成分を引いた場合
|
100
|
+
|
101
|
+
```remove_dc.ipynb
|
102
|
+
|
103
|
+
test_data_middle = pd.read_csv("CSVファイルへのパス")
|
104
|
+
|
105
|
+
x = test_data_middle["time"]
|
106
|
+
|
107
|
+
y = test_data_middle["volt"]
|
108
|
+
|
109
|
+
N = len(y)
|
110
|
+
|
111
|
+
dt = x[1]-x[0]
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
t = np.arange(0,N*dt,dt)
|
116
|
+
|
117
|
+
#DCを削除する為に元データの平均を引く
|
118
|
+
|
119
|
+
Y = np.array(y)
|
120
|
+
|
121
|
+
Y_block_offset = Y - Y.mean()
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
F = np.fft.fft(Y_block_offset)
|
128
|
+
|
129
|
+
Amp = np.abs(F)
|
130
|
+
|
131
|
+
freq = np.fft.fftfreq(N,d=dt)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
#PLot
|
136
|
+
|
137
|
+
plt.figure(figsize=(18,3),facecolor="white")
|
138
|
+
|
139
|
+
plt.plot(x,Y_block_offset,'b-', linewidth=1)
|
140
|
+
|
141
|
+
plt.xlabel('Time')
|
142
|
+
|
143
|
+
plt.ylabel('Volt')
|
144
|
+
|
145
|
+
plt.grid(True)
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
#FFT graph
|
150
|
+
|
151
|
+
fig, ax = plt.subplots(nrows=4, sharex=True, figsize=(6,6))
|
152
|
+
|
153
|
+
ax[0].plot(F.real[0:20], label="Real part")
|
154
|
+
|
155
|
+
ax[0].legend()
|
156
|
+
|
157
|
+
ax[1].plot(F.imag[0:20], label="Imaginary part")
|
158
|
+
|
159
|
+
ax[1].legend()
|
160
|
+
|
161
|
+
ax[2].plot(freq[0:20], label="Frequency")
|
162
|
+
|
163
|
+
ax[2].legend()
|
164
|
+
|
165
|
+
ax[3].plot(Amp[0:20], label="Amp")
|
166
|
+
|
167
|
+
ax[3].legend()
|
168
|
+
|
169
|
+
ax[3].set_xlabel("Number of data")
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
plt.show()
|
174
|
+
|
175
|
+
```
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
###結果
|
180
|
+
|
181
|
+
![イメージ説明](250d638cef8648236257668035cd4baa.png)
|
4
1枚目のグラフを間違えていたので修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
|
86
86
|
|
87
|
-
![イメージ説明](
|
87
|
+
![イメージ説明](fb100b90f2c374246fbd68eba35eee0f.png)
|
88
88
|
|
89
89
|
|
90
90
|
|
3
Ampのプロットと全範囲のプロット、それに伴う画像と#FFT graph以下のコード変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -56,21 +56,25 @@
|
|
56
56
|
|
57
57
|
#FFT graph
|
58
58
|
|
59
|
-
fig, ax = plt.subplots(nrows=
|
59
|
+
fig, ax = plt.subplots(nrows=4, sharex=True, figsize=(6,6))
|
60
60
|
|
61
|
-
ax[0].plot(F.real
|
61
|
+
ax[0].plot(F.real, label="Real part")
|
62
62
|
|
63
63
|
ax[0].legend()
|
64
64
|
|
65
|
-
ax[1].plot(F.imag
|
65
|
+
ax[1].plot(F.imag, label="Imaginary part")
|
66
66
|
|
67
67
|
ax[1].legend()
|
68
68
|
|
69
|
-
ax[2].plot(freq
|
69
|
+
ax[2].plot(freq, label="Frequency")
|
70
70
|
|
71
71
|
ax[2].legend()
|
72
72
|
|
73
|
+
ax[3].plot(Amp, label="Amp")
|
74
|
+
|
75
|
+
ax[3].legend()
|
76
|
+
|
73
|
-
ax[
|
77
|
+
ax[3].set_xlabel("Number of data")
|
74
78
|
|
75
79
|
plt.show()
|
76
80
|
|
@@ -80,7 +84,7 @@
|
|
80
84
|
|
81
85
|
|
82
86
|
|
83
|
-
![イメージ説明](
|
87
|
+
![イメージ説明](ec0f270691d2cbc05475ee68cf85b97e.png)
|
84
88
|
|
85
89
|
|
86
90
|
|
2
タイトル修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Python
|
1
|
+
Pythonのnumpyで高速フーリエ変換(FFT)をしたい
|
test
CHANGED
File without changes
|
1
タイトル修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Python(Jupyter notebook)でFFTをしたい
|
1
|
+
Python(Jupyter notebook)で高速フーリエ変換FFTをしたい
|
test
CHANGED
File without changes
|