import snakerf as srf import matplotlib.pyplot as plt import numpy as np from math import inf, pi, log2 from scipy import signal # see https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.periodogram.html#scipy.signal.periodogram m = 5 data = '{0:0{1:d}b}'.format(srf.gold_codes(m)[2], 2**m - 1) print(data) n = 1 f = 5e6 f_bit = 9001 T_bit = 1 / f_bit t_max = len(data) * T_bit / n - T_bit / 100 fs = 10e6 ns = 100000 # t_max = ns/fs V1 = srf.Signal(ns, t_max) # V1.make_tone(10000, 0) V1.update_Vt(srf.V_msk(V1.ts, 25000, f_bit, data, 0)) V2 = srf.Signal(ns, t_max) V2.make_tone(100000, 0.1) mx = srf.Mixer() V3 = mx.mix(V1, V2)
import snakerf as srf import matplotlib.pyplot as plt import numpy as np from math import inf, pi, log2, ceil # f = np.logspace(5,9,1000) # w = srf.f2w(f) fc = 10002 f_sym = 1000 m = 11 random_data = '{0:0{1:d}b}'.format(srf.gold_codes(m)[9], 2**m - 1) + '0' P_dBm = 0 n = 6 test_bits = 2000 f_sim = 2e5 t_sim = test_bits / (f_sym * n) v1 = srf.Signal(f_sim * t_sim, t_sim) v1.update_Vt(srf.V_qam(v1.ts, fc, f_sym, random_data, P_dBm, n = n)) # + srf.Vt_thermal_noise(v1.ts, v1.fs) v1.add_noise() # t_sym_sample = np.arange(0, t_sim, 1/f_sym) # v_qam_sample = np.array(np.interp(t_sym_sample, v1.ts, v1.Vt)) # f, (ax1, ax2, ax3, ax4) = plt.subplots(4,1)#,sharex = True) f = plt.figure(figsize = (12,6)) gs = f.add_gridspec(3, 6) ax1 = f.add_subplot(gs[0,:3]) ax2 = f.add_subplot(gs[1,:3]) ax3 = f.add_subplot(gs[2,:3])