comnum.Ostbc#
- class comnum.Ostbc#
An orthogonal space-time block code (Alamouti, or the rate-3/4 codes for 3 and 4 antennas), with linear maximum-likelihood decoding.
A block sends
n_symbolssymbols overn_slotschannel uses fromn_txantennas, with a unit average transmitted energy per channel use. Decoding turns the block into one scalar channel per symbol of noise varianceσ²/(c² ‖H‖_F²), a diversity ofn_tx · n_rx. Build it withOstbc.alamouti()orOstbc.rate_3_4(n_tx).Examples
>>> import comnum, numpy as np >>> code = comnum.Ostbc.alamouti() >>> s = np.array([1 + 1j, -1 + 1j]) / np.sqrt(2) >>> h = comnum.mimo_channel(1, 2, comnum.Rng(2)) >>> est, var = code.decode(h, h @ code.encode(s), 0.01) >>> np.allclose(est, s) True
- static rate_3_4(n_tx)#
The rate-3/4 code for 3 or 4 antennas.
- Parameters:
n_tx (int) – 3 or 4.
- Returns:
the code.
- Return type:
- Raises:
ValueError – for an invalid parameter (the message names it).
- decode(h, y, noise_var)#
Decode the received blocks (linear maximum likelihood).
- Parameters:
h (array_like) – the channel,
(n_rx, n_tx), or(blocks, n_rx, n_tx).y (array_like) – the received blocks,
(n_rx, n_slots · blocks).noise_var (float) – noise variance per receive antenna.
- Returns:
the symbol estimates and their noise variances.
- Return type:
- Raises:
ValueError – for an invalid parameter or input (the message names it).
- encode(symbols)#
The signal of the antennas.
- Parameters:
symbols (array_like) – a multiple of
n_symbolssymbols.- Returns:
(n_tx, n_slots · blocks)(complex128).- Return type:
- Raises:
ValueError – for an invalid parameter or input (the message names it).