BER calculation for BPSK¶
The Error Rate Calculation block calculates the bit error rate (BER). Using this block, we can get the BER data for the communication system and analyse the efficiency of our system. In this example, we will look at a simple BPSK receiver and transmitter model. It is shown in the figure below.

Next, let's define an auxiliary function to run the model.
Out[0]:
run_model (generic function with 1 method)
Next, we initialise the signal-to-noise ratios for our model and declare the bit error variable.
Now let's run the model at different values of signal-to-noise ratio.
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
Plot BER both from the model and from theoretical calculations.
__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]
Conclusion¶
As you can see from this example, the higher the signal to noise ratio, the smaller the error.
Here we have shown how to plot BER for a simple model of a communication system and how to apply this method to analyse the system.
{"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"}}}