##################### Simulation BASEBAND ###################### t = np.arange(0, T_int, 1 / f_sampl) # time axis #f = ut.freq_fr_time (t) # frequency axis #cd = np.array([1,1,1,0,1,1,1,1,0,1,0,0,1,0,1]) # code x1 = 2 # tap 1 to generate G2 in goldcode generator x2 = 6 # tap 2 to generate G2 in goldcode generator cd = prn.gold_seq(x1, x2, 1) Tstr = 5e-6 # Nyquist's symbol interval tau = 0.35 # time acceleration factor Ts = Tstr / tau # transmitted symbol interval bitrate = 1 / Tstr td = 0.0 # initial delay of the sequence (time offset) # baseband signals a1 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=1.0, td=Tstr / 2) a2 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=0.5, td=Tstr / 2) a3 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=0.0, td=Tstr / 2) c = gen.rect_tr(t, Tstr, 0, td, cd) ##################### Simulation PASSBAND ###################### fc = 60e6 # carrier frequency in Hz a1_fc = upcon.quad_mod(a1, t, fc, 0, 0, 0) a2_fc = upcon.quad_mod(a2, t, fc, 0, 0, 0) a3_fc = upcon.quad_mod(a3, t, fc, 0, 0, 0) c_fc = upcon.quad_mod(c, t, fc, 0, 0, 0) ##################### files ###################### filename = "ts5_prn{0:1}{1:1}_tau{2:6.2}_a1.dat".format(x1, x2, tau)
##################### Parameters ###################### f_sampl = 900e3 # sampling frequency in kHz T_int = 1 # entire signal length in ms ##################### Simulation ###################### t = np.arange(0, T_int, 1 / f_sampl) # time axis # f = ut.freq_fr_time (t) # frequency axis cd = prn.gold_seq(2, 6, 1) # code Ts = 1 / 1023 # Nyquist's symbol interval tau = 1 # time acceleration factor Tstr = Ts * tau # transmitted symbol interval bitrate = 1 / Tstr td = 0.0 # initial delay of the sequence (time offset) # baseband signals a1 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=1.0) a2 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=0.5) a3 = mod.rcos_bpsk_map(t, cd, bitrate, pw=Ts, alpha=0.0) c = mod.rect_tr(t, Tstr, 0, td, cd) ##################### Plots ########################### plt.figure(1, figsize=(10, 15), dpi=300) # Time domain ax1 = plt.subplot(311) plt.plot(t, np.real(a1), '-r', label='$x_{rcos}(t), \\beta = 1.0$') plt.plot(t, np.real(a2), '-b', label='$x_{rcos}(t), \\beta = 0.5$') plt.plot(t, np.real(a3), '-g', label='$x_{rcos}(t), \\beta = 0.0$') plt.plot(t, c, '-k', label='$x_{rect}(t)$') plt.grid(True)