BPSK 的误码率计算¶
误码率计算模块计算误码率(BER)。利用该模块,我们可以获得通信系统的误码率数据,并分析系统的效率。在本例中,我们将研究一个简单的 BPSK 接收机和发射机模型。如下图所示。

Out[0]:
run_model (generic function with 1 method)
接下来,我们初始化模型的信噪比,并声明比特误差变量。
Building...
Progress 0%
Progress 100%
Progress 100%
BER: 0.28515625
Building...
Progress 0%
Progress 100%
Progress 100%
BER: 0.2021484375
Building...
Progress 0%
Progress 100%
Progress 100%
BER: 0.091796875
Building...
Progress 0%
Progress 100%
Progress 100%
BER: 0.03515625
Building...
Progress 0%
Progress 100%
Progress 100%
BER: 0.005859375
__Eb_No__: [-7, -4, -1, 2, 5]
_ber_ref_: [0.264, 0.186, 0.104, 0.038, 0.006]
ber_model: [0.285, 0.202, 0.092, 0.035, 0.006]
从这个例子中可以看出,信噪比越高,误差越小。
在这里,我们展示了如何绘制通信系统简单模型的误码率图,以及如何应用这种方法来分析系统。
{"id": "91302867-f476-49cb-abb2-fb8c94c08934", "data": [{"showlegend": false, "mode": "markers", "xaxis": "x", "colorbar": {"y": 0.7491319444444444, "title": {"text": ""}, "len": 0.38482884951881013, "x": 0.9960629921259843}, "name": "", "yaxis": "y", "legendgroup": "", "marker": {"symbol": "square", "color": "rgba(0, 154, 250, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.26378950525626593, 0.186113817483389, 0.1037590959534063, 0.03750612835892598, 0.00595386714777866], "type": "scatter", "x": [-7, -4, -1, 2, 5]}, {"showlegend": false, "mode": "markers", "xaxis": "x", "colorbar": {"y": 0.7491319444444444, "title": {"text": ""}, "len": 0.38482884951881013, "x": 0.9960629921259843}, "name": "", "yaxis": "y", "legendgroup": "", "marker": {"symbol": "diamond", "color": "rgba(227, 111, 71, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.28515625, 0.2021484375, 0.091796875, 0.03515625, 0.005859375], "type": "scatter", "x": [-7, -4, -1, 2, 5]}, {"showlegend": true, "mode": "markers", "xaxis": "x2", "colorbar": {"y": 0.26822916666666663, "title": {"text": ""}, "len": 0.3848288495188102, "x": 0.9960629921259843}, "name": "Theoretical BPSK", "yaxis": "y2", "legendgroup": "Theoretical BPSK", "marker": {"symbol": "square", "color": "rgba(0, 154, 250, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.26378950525626593, 0.186113817483389, 0.1037590959534063, 0.03750612835892598, 0.00595386714777866], "type": "scatter", "x": [-7, -4, -1, 2, 5]}, {"showlegend": true, "mode": "markers", "xaxis": "x2", "colorbar": {"y": 0.26822916666666663, "title": {"text": ""}, "len": 0.3848288495188102, "x": 0.9960629921259843}, "name": "Model BPSK", "yaxis": "y2", "legendgroup": "Model BPSK", "marker": {"symbol": "diamond", "color": "rgba(227, 111, 71, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.28515625, 0.2021484375, 0.091796875, 0.03515625, 0.005859375], "type": "scatter", "x": [-7, -4, -1, 2, 5]}], "config": {"showlegend": true, "paper_bgcolor": "rgba(255, 255, 255, 1.000)", "legend": {"yanchor": "auto", "xanchor": "auto", "bordercolor": "rgba(0, 0, 0, 1)", "bgcolor": "rgba(255, 255, 255, 1.000)", "borderwidth": 1, "tracegroupgap": 0, "y": 1, "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "title": {"font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}, "text": ""}, "traceorder": "normal", "x": 1}, "height": 400, "yaxis2": {"showticklabels": true, "gridwidth": 0.5, "tickvals": [0.01, 0.1], "range": [-2.2827656542881116, -0.4943001571594504], "domain": [0.07581474190726151, 0.4606435914260717], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["10^-2", "10^-1"], "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "x2", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "BER", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "log"}, "xaxis2": {"showticklabels": true, "gridwidth": 0.5, "tickvals": [-5, -2.5, 0, 2.5, 5], "range": [-7.36, 5.36], "domain": [0.06365923009623797, 0.9960629921259843], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["-5.0", "-2.5", "0.0", "2.5", "5.0"], "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "y2", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "Eb/No (dB)", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "linear"}, "annotations": [{"yanchor": "top", "xanchor": "center", "rotation": 0, "y": 1, "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 20}, "yref": "paper", "showarrow": false, "text": "Bit Error Rate (Linear Scale)", "xref": "paper", "x": 0.5298611111111111}, {"yanchor": "top", "xanchor": "center", "rotation": 0, "y": 0.5190972222222222, "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 20}, "yref": "paper", "showarrow": false, "text": "Bit Error Rate (Log Scale)", "xref": "paper", "x": 0.5298611111111111}], "plot_bgcolor": "rgba(255, 255, 255, 1.000)", "margin": {"l": 0, "b": 20, "r": 0, "t": 20}, "width": 421.921875, "xaxis": {"showticklabels": true, "gridwidth": 0.5, "tickvals": [-5, -2.5, 0, 2.5, 5], "range": [-7.36, 5.36], "domain": [0.06365923009623797, 0.9960629921259843], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["-5.0", "-2.5", "0.0", "2.5", "5.0"], "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "y", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "linear"}, "yaxis": {"showticklabels": true, "gridwidth": 0.5, "tickvals": [0, 0.05000000000000001, 0.10000000000000002, 0.15000000000000002, 0.20000000000000004, 0.25000000000000006], "range": [-0.002519531250000012, 0.29353515625000004], "domain": [0.5567175196850394, 0.9415463692038495], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["0.00", "0.05", "0.10", "0.15", "0.20", "0.25"], "zeroline": false, "tickfont": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 11}, "zerolinecolor": "rgba(0, 0, 0, 1)", "anchor": "x", "visible": true, "ticks": "inside", "tickmode": "array", "linecolor": "rgba(0, 0, 0, 1)", "showgrid": true, "title": {"text": "BER", "font": {"color": "rgba(0, 0, 0, 1)", "family": "sans-serif", "size": 15}}, "gridcolor": "rgba(0, 0, 0, 0.1)", "tickcolor": "rgb(0, 0, 0)", "type": "linear"}}}