LoginSignup
4
1

More than 5 years have passed since last update.

python3で周波数変調、位相変調

Last updated at Posted at 2017-05-30

概要

python3で周波数変調、位相変調、やってみた。

写真

上 sin
中 周波数変調
下 位相変調
fm2.png

サンプルコード

import scipy.signal as sg
import numpy as np
import matplotlib.pyplot as plt

sample_rate = 44100.0
nsamples = 320
F_1 = 440.0
F_2 = 5000.0
t = np.arange(nsamples) / sample_rate
vin = np.sin(2 * np.pi * F_1 * t)
vfm = np.sin(2 * np.pi * F_2 * t + 6.0 * -np.cos(2 * np.pi * F_1 * t))
vpm = np.sin(2 * np.pi * F_2 * t + 6.0 * -np.sin(2 * np.pi * F_1 * t))
fig = plt.figure(1)
ax = fig.add_subplot(311)
ax.plot(vin[1: 300])
ax = fig.add_subplot(312)
ax.plot(vfm[1: 300])
ax = fig.add_subplot(313)
ax.plot(vpm[1: 300])
fig.set_tight_layout(True)
plt.savefig("fm2.png")
plt.show()
4
1
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
4
1