Skip to content

Commit 349dbe9

Browse files
committed
4章 q10 を変更
1 parent 58fae63 commit 349dbe9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

khashimoto/chapter04/q10.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
from q03 import stft
66

77

8-
def fr_convert(x, fs, S):
8+
def convert(x, fs, S):
99
L = (len(x) - 1) * 2
1010
f = np.arange(len(x)) * fs / L
11-
return f
12-
13-
14-
def t_convert(x, fs, S):
1511
t = np.arange(x.shape[1]) * S / fs
16-
return t
12+
return f, t
1713

1814

1915
# 4. の結果を再度プロット
@@ -30,8 +26,7 @@ def t_convert(x, fs, S):
3026

3127

3228
# プロット
33-
fr = fr_convert(x_stft.T, fs, S)
34-
t = t_convert(x_stft.T, fs, S)
29+
fr, t = convert(x_stft.T, fs, S)
3530

3631
plt.subplot(1, 2, 1)
3732
plt.pcolormesh(t, fr, abs(x_stft).T)

0 commit comments

Comments
 (0)