BER calculation for 8-PSK¶
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 8-PSK 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 21%
Progress 100%
BER: 0.4042624042624043
Building...
Progress 0%
Progress 53%
Progress 100%
BER: 0.351981351981352
Building...
Progress 0%
Progress 43%
Progress 100%
BER: 0.3016983016983017
Building...
Progress 0%
Progress 40%
Progress 100%
BER: 0.20646020646020646
Building...
Progress 0%
Progress 38%
Progress 100%
BER: 0.10556110556110557
Building...
Progress 0%
Progress 34%
Progress 100%
Progress 100%
BER: 0.042624042624042624
Building...
Progress 0%
Progress 20%
Progress 100%
Progress 100%
BER: 0.004329004329004329
Plot BER both from the model and from theoretical calculations.
__Eb_No__: [-9, -6, -3, 0, 3, 6, 9]
_ber_ref_: [0.493, 0.426, 0.338, 0.232, 0.124, 0.041, 0.005]
ber_model: [0.404, 0.352, 0.302, 0.206, 0.106, 0.043, 0.004]
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": "c8ba43dd-03b8-4b27-a953-d344256a2f61", "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.4929601779320147, 0.4256641048485105, 0.3379584285510779, 0.23237571066524076, 0.12365026917933548, 0.040959847782405794, 0.005496267059305334], "type": "scatter", "x": [-9, -6, -3, 0, 3, 6, 9]}, {"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.4042624042624043, 0.351981351981352, 0.3016983016983017, 0.20646020646020646, 0.10556110556110557, 0.042624042624042624, 0.004329004329004329], "type": "scatter", "x": [-9, -6, -3, 0, 3, 6, 9]}, {"showlegend": true, "mode": "markers", "xaxis": "x2", "colorbar": {"y": 0.26822916666666663, "title": {"text": ""}, "len": 0.3848288495188102, "x": 0.9960629921259843}, "name": "Theoretical QPSK", "yaxis": "y2", "legendgroup": "Theoretical QPSK", "marker": {"symbol": "square", "color": "rgba(0, 154, 250, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.4929601779320147, 0.4256641048485105, 0.3379584285510779, 0.23237571066524076, 0.12365026917933548, 0.040959847782405794, 0.005496267059305334], "type": "scatter", "x": [-9, -6, -3, 0, 3, 6, 9]}, {"showlegend": true, "mode": "markers", "xaxis": "x2", "colorbar": {"y": 0.26822916666666663, "title": {"text": ""}, "len": 0.3848288495188102, "x": 0.9960629921259843}, "name": "Model QPSK", "yaxis": "y2", "legendgroup": "Model QPSK", "marker": {"symbol": "diamond", "color": "rgba(227, 111, 71, 1.000)", "line": {"color": "rgba(0, 0, 0, 1)", "width": 1}, "size": 8}, "y": [0.4042624042624043, 0.351981351981352, 0.3016983016983017, 0.20646020646020646, 0.10556110556110557, 0.042624042624042624, 0.004329004329004329], "type": "scatter", "x": [-9, -6, -3, 0, 3, 6, 9]}], "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.4253046944208014, -0.24549544774158405], "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": [-7.5, -5, -2.5, 0, 2.5, 5, 7.5], "range": [-9.540000000000001, 9.540000000000001], "domain": [0.06365923009623797, 0.9960629921259843], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["-7.5", "-5.0", "-2.5", "0.0", "2.5", "5.0", "7.5"], "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": 706.921875, "xaxis": {"showticklabels": true, "gridwidth": 0.5, "tickvals": [-7.5, -5, -2.5, 0, 2.5, 5, 7.5], "range": [-9.540000000000001, 9.540000000000001], "domain": [0.06365923009623797, 0.9960629921259843], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["-7.5", "-5.0", "-2.5", "0.0", "2.5", "5.0", "7.5"], "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.1, 0.2, 0.30000000000000004, 0.4, 0.5], "range": [-0.010329930879085958, 0.507619113140105], "domain": [0.5567175196850394, 0.9415463692038495], "mirror": false, "tickangle": 0, "showline": true, "ticktext": ["0.0", "0.1", "0.2", "0.3", "0.4", "0.5"], "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"}}}