주파수 변조
개요
파이톤으로 FM을 변조하고 변조했습니다.
해조 알고리즘은 구글 방송국입니다.
사진.
샘플 코드 import scipy.signal as sg
import numpy as np
import matplotlib.pyplot as plt
sample_rate = 48000.0
nsamples = 320
F_1 = 440.0
F_2 = 10000.0
F_3 = 10000.0
nyq_rate = sample_rate / 2.0
cutoff_hz = 5000.0
numtaps = 29
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))
i1 = vfm * np.cos(2 * np.pi * F_3 * t)
q1 = vfm * np.sin(2 * np.pi * F_3 * t)
lpf = sg.firwin(numtaps, cutoff_hz / nyq_rate)
I2 = sg.lfilter(lpf, 1, i1)
Q2 = sg.lfilter(lpf, 1, q1)
pI = 0
pQ = 0
m = 0
vo = np.zeros(320)
for t in range(0, vfm.size):
real = pI * I2[t] + pQ * Q2[t]
imag = pI * Q2[t] - pQ * I2[t]
sgn = 1
circ = 0
ang = 0
div = 1
if (real < 0):
sgn = -sgn
real = -real
circ = np.pi
if (imag < 0):
sgn = -sgn
imag = -imag
circ = -circ
if (real > imag):
div = imag / real
else:
if (real != imag):
ang = -np.pi / 2
div = real / imag
sgn = -sgn
vo[t] = circ + sgn * (ang + div / (0.98419158358617365 + div * (0.093485702629671305 + div * 0.19556307900617517))) * 5
pI = I2[t]
pQ = Q2[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(vo[1:300])
fig.set_tight_layout(True)
plt.show()
Reference
이 문제에 관하여(주파수 변조), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ohisama@github/items/a424e62496d2d8d5d31b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
샘플 코드 import scipy.signal as sg
import numpy as np
import matplotlib.pyplot as plt
sample_rate = 48000.0
nsamples = 320
F_1 = 440.0
F_2 = 10000.0
F_3 = 10000.0
nyq_rate = sample_rate / 2.0
cutoff_hz = 5000.0
numtaps = 29
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))
i1 = vfm * np.cos(2 * np.pi * F_3 * t)
q1 = vfm * np.sin(2 * np.pi * F_3 * t)
lpf = sg.firwin(numtaps, cutoff_hz / nyq_rate)
I2 = sg.lfilter(lpf, 1, i1)
Q2 = sg.lfilter(lpf, 1, q1)
pI = 0
pQ = 0
m = 0
vo = np.zeros(320)
for t in range(0, vfm.size):
real = pI * I2[t] + pQ * Q2[t]
imag = pI * Q2[t] - pQ * I2[t]
sgn = 1
circ = 0
ang = 0
div = 1
if (real < 0):
sgn = -sgn
real = -real
circ = np.pi
if (imag < 0):
sgn = -sgn
imag = -imag
circ = -circ
if (real > imag):
div = imag / real
else:
if (real != imag):
ang = -np.pi / 2
div = real / imag
sgn = -sgn
vo[t] = circ + sgn * (ang + div / (0.98419158358617365 + div * (0.093485702629671305 + div * 0.19556307900617517))) * 5
pI = I2[t]
pQ = Q2[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(vo[1:300])
fig.set_tight_layout(True)
plt.show()
Reference
이 문제에 관하여(주파수 변조), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ohisama@github/items/a424e62496d2d8d5d31b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
import scipy.signal as sg
import numpy as np
import matplotlib.pyplot as plt
sample_rate = 48000.0
nsamples = 320
F_1 = 440.0
F_2 = 10000.0
F_3 = 10000.0
nyq_rate = sample_rate / 2.0
cutoff_hz = 5000.0
numtaps = 29
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))
i1 = vfm * np.cos(2 * np.pi * F_3 * t)
q1 = vfm * np.sin(2 * np.pi * F_3 * t)
lpf = sg.firwin(numtaps, cutoff_hz / nyq_rate)
I2 = sg.lfilter(lpf, 1, i1)
Q2 = sg.lfilter(lpf, 1, q1)
pI = 0
pQ = 0
m = 0
vo = np.zeros(320)
for t in range(0, vfm.size):
real = pI * I2[t] + pQ * Q2[t]
imag = pI * Q2[t] - pQ * I2[t]
sgn = 1
circ = 0
ang = 0
div = 1
if (real < 0):
sgn = -sgn
real = -real
circ = np.pi
if (imag < 0):
sgn = -sgn
imag = -imag
circ = -circ
if (real > imag):
div = imag / real
else:
if (real != imag):
ang = -np.pi / 2
div = real / imag
sgn = -sgn
vo[t] = circ + sgn * (ang + div / (0.98419158358617365 + div * (0.093485702629671305 + div * 0.19556307900617517))) * 5
pI = I2[t]
pQ = Q2[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(vo[1:300])
fig.set_tight_layout(True)
plt.show()
Reference
이 문제에 관하여(주파수 변조), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ohisama@github/items/a424e62496d2d8d5d31b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)