Documentation Center

  • Trial Software
  • Product Updates

comm.SphereDecoder System object

Package: comm

Decode input using sphere decoder


The Sphere Decoder System object™ decodes the symbols sent over Nt antennas using the sphere decoding algorithm.

To decode input symbols using a sphere decoder:

  1. Define and set up your sphere decoder object. See Construction.

  2. Call step to decode input symbols according to the properties of comm.SphereDecoder. The behavior of step is specific to each object in the toolbox.


H = comm.SphereDecoder creates a System object, H. This object uses the sphere decoding algorithm to find the maximum-likelihood solution for a set of received symbols over a MIMO channel with Nt transmit antennas and Nr receive antennas.

H = comm.SphereDecoder(Name,Value) creates a sphere decoder object, H, with the specified property name set to the specified value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.

H = comm.SphereDecoder(CONSTELLATION,BITTABLE) creates a sphere decoder object, H, with the Constellation property set to CONSTELLATION, and the BitTable property set to BITTABLE.



Signal constellation per transmit antenna

Specify the constellation as a complex column vector containing the constellation points to which the transmitted bits are mapped. The default setting is a QPSK constellation with an average power of 1. The length of the vector must be a power of two. The object assumes that each transmit antenna uses the same constellation.


Bit mapping used for each constellation point.

Specify the bit mapping for the symbols that the Constellation property specifies as a numerical matrix. The default is [0 0; 0 1; 1 0; 1 1], which matches the default Constellation property value.

The matrix size must be [ConstellationLength bitsPerSymbol]. ConstellationLength represents the length of the Constellation property. bitsPerSymbol represents the number of bits that each symbol encodes.


Initial search radius of the decoding algorithm.

Specify the initial search radius for the decoding algorithm as either Infinity | ZF Solution. The default is Infinity.

When you set this property to Infinity, the object sets the initial search radius to Inf.

When you set this property to ZF Solution, the object sets the initial search radius to the zero-forcing solution. This calculation uses the pseudo-inverse of the input channel when decoding. Large constellations and/or antenna counts can benefit from the initial reduction in the search radius. In most cases, however, the extra computation of the ZF Solution will not provide a benefit.


Specify the decoding decision method as either Soft | Hard. The default is Soft.

When you set this property to Soft, the decoder outputs log-likelihood ratios (LLRs), or soft bits.

When you set this property to Hard, the decoder converts the soft LLRs to bits. The hard-decision output logical array follows the mapping of a zero for a negative LLR and one for all other values.


cloneCreate SphereDecoder object with same property values
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepDecode received symbols using sphere decoding algorithm


Decode using a sphere decoder

Modulate a set of bits using 16-QAM constellation. Transmit the signal as two parallel streams over a MIMO channel. Then, decode using a sphere decoder, with perfect channel knowledge.

Define the modulation order, number of bits to transmit, and the noise variance. Variance is directly related to noise power. The greater the variance value, the smaller the signal-to-noise ratio.

 M = 16;
 nBits = 1e3*log2(M);
 noiseVariance = 1e-2;
 symMap = [11 10 14 15 9 8 12 13 1 0 4 5 3 2 6 7];

Create a Rectangular QAM modulator System object with the BitInput property set to true, the NormalizationMethod set to Average Power, the SymbolMapping set to Binary, and CustomSymbolMapping set to symMap.

 hMod = comm.RectangularQAMModulator('BitInput', true, ...
        'ModulationOrder', M, 'NormalizationMethod', 'Average power',...
        'SymbolMapping', 'Custom', 'CustomSymbolMapping', symMap);

Convert the decimal value of the symbol map to binary bits using the left bit as the most significant bit (msb).

  BitTable = de2bi(symMap, log2(M), 'left-msb');

Create a MIMO Channel System object with the RandomStream property set to mt19937ar with seed and PathGainsOutputPort set to true and a default configuration of 2-by-2.

hMIMO = comm.MIMOChannel('RandomStream', 'mt19937ar with seed',...
       'PathGainsOutputPort', true);

Create an AWGN Channel System object with the NoiseMethod property set to Variance, VarianceSource set to Property, and Variance set to noiseVariance.

 hAWGN = comm.AWGNChannel('NoiseMethod', 'Variance',...
        'VarianceSource', 'Property', 'Variance', noiseVariance);

Create a Sphere Decoder System object that processes bits using hard-decision decoding.

hSpDec = comm.SphereDecoder('Constellation', constellation(hMod),...
        'BitTable', BitTable, 'DecisionType', 'Hard');

Create an error rate System object.

hBER = comm.ErrorRate;

Generate a random data stream.

data = randi([0 1], nBits, 1);      

Modulate the data by calling the step method of the Rectangular QAM Modulator System object, hMod.

 yMod = step(hMod, data);               

Split the modulated data stream into two, and then transmit over a 2-by-2 MIMO fading channel.

yTx  = reshape(yMod, [], 2);
[yFad, yPG] = step(hMIMO, yTx);

Add noise to the received signal by calling the step method of the AWGN System object, hAWGN.

 yRec = step(hAWGN, yFad);

Decode the received signal.

 rxBits = step(hSpDec, yRec, squeeze(yPG));

Calculate and then display the bit error rate results.

ber = step(hBER, data, double(rxBits(:)));

LTE PHY Downlink with Spatial Multiplexing

For an additional example that uses this System object, see the LTE PHY Downlink with Spatial Multiplexing example. This example shows the Downlink Shared Channel (eNodeB to UE) processing of the Long Term Evolution (LTE) physical layer (PHY) specifications developed by the Third Generation Partnership Project (3GPP).


This object implements a soft-output max-log APP MIMO detector by means of a soft-output Schnorr-Euchner sphere decoder (SESD), implemented as single tree search (STS) tree traversal. The algorithm assumes the same constellation and bit table on all of the transmit antennas. Given as inputs, the received symbol vector and the estimated channel matrix, the algorithm outputs the log-likelihood ratios (LLRs) of the transmitted bits.

The algorithm assumes a MIMO system model with Nt transmit antennas and Nr receive antennas where Nt symbols are simultaneously sent, which is express as:

where the received symbols y are a function of the transmitted symbol vector s, the MIMO channel matrix, H, and the thermal noise, n.

The goal of the MIMO detector is to find the maximum-likelihood (ML) solution, for which it holds that

where O is the complex-valued constellation from which the Nt elements of s are chosen.

Soft detection additionally delivers, for each bit, estimates on how reliable the estimate is. For each of the sent bits, denoted as (the b-th bit of the j-th symbol), the reliability of the estimate is calculated by means of the log-likelihood ratio (LLR), which is denoted as L and is calculated as using the max-log approximation:

where and are the disjoint sets of vector symbols that have the b-th bit in the label of the j-th scalar symbol equal to 0 and 1, respectively. The symbol λ denotes the distance calculated as norm squared. The two terms can be expressed as the difference of:

  1. The distance to the ML solution , denoted as .

  2. The distance to the counter-hypothesis, which denotes the binary complement of the b-th bit in the binary label of the j-th entry of , i.e., the minimum of the symbol set , which contains all of the possible vectors for which the b-th bit of the j-th entry is flipped compared to the same entry of .

Thus, depending on whether is zero or one, the LLR for the bit is expressed as

The design of a decoder thus aims at efficiently finding , , and .

This search can be converted into a tree search by means of the sphere decoding algorithms. To this end, the channel matrix is decomposed into by means of a QR decomposition. Left-multiplying y by QH, the problem can be reformulated as

from which the triangular structure of R can be exploited to arrange a tree structure where each of the leaf nodes corresponds to a possible s vector and the partial distances to the nodes in the tree can be calculated cumulatively adding to the partial distance of the parent node.

In the STS algorithm, the and metrics are searched concurrently. The main idea is to have a list containing the metric , along with the corresponding bit sequence and the metrics of all counter-hypotheses. Then, we search the sub-tree originating from a given node only if the result can lead to an update of either or .

The STS algorithm flow can be summarized as:

  1. If when reaching a leaf node, a new ML hypothesis is found , all for which are set to which now turns into a valued counter-hypothesis. Then, is set to the current distance d(x).

  2. If the current partial distance d(x) satisfies , only the counter-hypotheses have to be checked. For all j and b for which and the decoder updates to be d(x).

  3. A sub-tree is pruned if the partial distance of the node is bigger than the current which may be affected when traversing the subtree.

  4. The algorithm finalizes once all of the tree nodes have been visited once or pruned.

Selected Bibliography

[1] Studer, C., M. Wenk, A. Burg, and H. Bölcskei. "Soft-output MIMO detection algorithms: Performance and implementation aspects" Proceedings of the 40th Asilomar Conference on signals, Systems, and Computers, October 2006.

[2] Cho, Y. S., "MIMO-OFDM Wireless communications with MATLAB," IEEE Press, 2011.

[3] Hochwald, B.M., S. ten Brink. "Achieving near-capacity on a multiple-antenna channel", IEEE Transactions on Communications, Vol. 51, No. 3, Mar 2003, pp. 389-399.

[4] Agrell, E., T. Eriksson, A. Vardy, K. Zeger. "Closest point search in lattices", IEEE Transactions on Information Theory, Vol. 48, No. 8, Aug 2002, pp. 2201-2214.

See Also

| |

Was this topic helpful?