CoherentMIMO-IdealRayleigh-BER.py¶
This webpage introduces an API example for the cohrent scenario, which uses CoherentMLDSimulator
.
Other examples are found in tests/CoherentMLDSimulatorTest.py.
This example compares the BER performance of the coherent BLAST and spatial modulation schemes, where the simulation parameters are given in the table below.
Performance Results¶
Simulation Parameters¶
Parameter |
Value |
---|---|
Channel |
Ideal Rayleigh fading |
Number of transmit antennas |
\(M=4\) |
Number of receive antennas |
\(N=4\) |
Constellation size |
\(L=2,4\) |
Transmission rate |
\(R=4\) [bit/symbol] |
Reproducible Code¶
import sys
import matplotlib.pyplot as plt
from imtoolkit import Parameters, IMCode, IdealRayleighChannel, CoherentMLDSimulator
plt.switch_backend('agg')
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['markers.fillstyle'] = 'none'
def simulateBER(argstr):
params = Parameters(argstr)
code = IMCode(params.dm, params.M, params.K, params.Q, params.mod, params.L, meanPower=1)
channel = IdealRayleighChannel(params.ITi, params.M, params.N)
sim = CoherentMLDSimulator(code.codes, channel)
return sim.simulateBERParallel(params, outputFile=False, printValue=False)
if __name__ == '__main__':
fig, ax = plt.subplots()
ax.set_xlabel("SNR [dB]")
ax.set_ylabel("BER")
ax.set_xlim(0, 20)
plt.ylim(1e-7, 1e0)
plt.yscale("log")
ax.tick_params(pad=8)
ret = simulateBER("BERP_sim=coh_code=index_dm=dic_M=4_K=4_Q=1_L=2_mod=PSK_N=4_ITo=1e3_ITi=1e4_snrfrom=0.00_to=20.00_len=11")
ax.plot(ret["snr_dB"], ret["ber"], color="k", marker="s", linestyle="-", label="BLAST")
ret = simulateBER("BERP_sim=coh_code=index_dm=opt_M=4_K=1_Q=4_L=4_mod=PSK_N=4_ITo=1e3_ITi=1e4_snrfrom=0.00_to=20.00_len=11")
ax.plot(ret["snr_dB"], ret["ber"], color="r", marker="o", linestyle="-", label="Spatial modulation")
handles, labels = ax.get_legend_handles_labels()
legend = ax.legend(handles, labels, loc="best", frameon=True)
frame = legend.get_frame()
frame.set_facecolor('white')
frame.set_edgecolor('white')
#plt.show()
plt.savefig(sys.argv[0].replace(".py", ".svg"))