Example #1
0
T_bit = 1 / f_bit

t = np.linspace(0, len(data) * T_bit / n - T_bit / 100, 100000)
fs = srf.fft_fs(t)
ws = srf.f2w(fs)

v1 = srf.V_psk(t, f, f_bit, data, -90, n=n)
v2 = srf.V_msk(t, f, f_bit, data, -90)

vn = srf.Vt_noise(t)
v1n = srf.power_combine([v1, vn], t, out_Pf=True)
v2n = srf.power_combine([v2, vn], t, out_Pf=True)

R1 = 1e3
C1 = 25e-11
v1f = v1n * srf.Pdiv(srf.R(R1, ws), srf.C(C1, ws))
v2f = v2n * srf.Pdiv(srf.R(R1, ws), srf.C(C1, ws))

# print(srf.w2f(1/(R1*C1)))

plt.subplot(2, 1, 1)
# plt.plot(fs, srf.dB(srf.mag(srf.Pdiv(srf.R(R1, ws), srf.C(C1, ws)))))
# plt.axvline(srf.w2f(1/(R1*C1)), ls = '-', c = 'black')
# srf.plot_power_spectrum(plt.gca(), t, v1, time = True)
# srf.plot_power_spectrum(plt.gca(), t, v2, time = True)
# plt.xlim(f-10*f_bit,f+10*f_bit)
plt.subplot(2, 1, 2)
# plt.plot(t, srf.Pf2Vt(v3f, len(t)))
plt.plot(t, srf.Pf2Vt(v1f, len(t)))
plt.plot(t, srf.Pf2Vt(v2f, len(t)))
for i in range(len(data)):
Example #2
0
import numpy as np
from math import inf, pi, log2

t = np.linspace(0, 0.01, 1000000)
f = 1000

fs = srf.fft_fs(t)
ws = srf.f2w(fs)

v1 = srf.dBm2Vp(-100) * np.sin(srf.f2w(f) * t)
v2 = srf.Vt_noise(t)
v3 = srf.power_combine([v1, v2], t, out_Pf=True)
# print(srf.C(1e-9, ws))
R1 = 1e3
C1 = 10e-9
v4 = v3 * srf.Vdiv(srf.R(R1, ws), srf.C(C1, ws))

# print(srf.w2f(1/(R1*C1)))

# plt.subplot(4,1,1)
# srf.plot_power_spectrum(plt.gca(), t, v1, time = True)
# plt.subplot(4,1,2)
# srf.plot_power_spectrum(plt.gca(), t, v2, time = True)
plt.subplot(2, 1, 1)
srf.plot_power_spectrum(plt.gca(), fs, v3, time=False)
srf.plot_power_spectrum(plt.gca(), fs, v4, time=False)
plt.subplot(2, 1, 2)
plt.plot(t, srf.Pf2Vt(v3, len(t)))
plt.plot(t, srf.Pf2Vt(v4, len(t)))
plt.show()
Example #3
0
import snakerf as srf
import matplotlib.pyplot as plt
import numpy as np
from math import inf, pi, log2

# f = np.logspace(5,9,1000)
# w = srf.f2w(f)

v1 = srf.Signal(25000, 0.001)
v1.make_tone(45000, 0)

stage1 = srf.Two_Port.from_network(v1.fs, [srf.L(2e-6, v1.ws)], [srf.C(2e-9, v1.ws)])

# print(np.asarray([stage1]))
sig_path = srf.Signal_Path(v1.fs, [stage1, stage1], Z_source = srf.R(500, v1.ws), Z_load = srf.R(500, v1.ws))

fig = plt.figure()
srf.spice_plot(plt.gca(), stage1.fs, sig_path.V_out())


# plt.subplot(2,1,1)
# v1.plot_t(plt.gca())
#
# plt.subplot(2,1,2)
# plt.plot(v1.fs, srf.mag(v1.Vf))
# srf.plot_power_spectrum(plt.gca(), v1.ts, v1.Vt, time = True)

plt.show()