LoginSignup
0
0

More than 3 years have passed since last update.

python3で振幅復調

Last updated at Posted at 2017-05-30

概要

python3で振幅復調してみた。
復調アルゴリズムは、hilbert

写真

上 sin信号
中 AM信号
下 復調
am4.png

サンプルコード

import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hilbert

sample_rate = 48000.
nsamples = 320
F_1KHz = 1000.
A_1KHz = 1.0
F_15KHz = 15000.
A_15KHz = 0.5
F_14KHz = 14800.
t = np.arange(nsamples) / sample_rate
vin = A_1KHz * np.sin(2 * np.pi * F_1KHz * t) 
vam = (A_1KHz * np.sin(2 * np.pi * F_1KHz * t) + 1.0) * A_15KHz * np.sin(2 * np.pi * F_15KHz * t)
hil = hilbert(vam)
o = np.abs(hil)
fig = plt.figure(1)
ax = fig.add_subplot(311)
ax.plot(vin[1: 300])
ax = fig.add_subplot(312)
ax.plot(vam[1: 300])
ax = fig.add_subplot(313)
ax.plot(o[1: 300])
fig.set_tight_layout(True)
plt.savefig("am4.png")
plt.show()


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0