Alamouti Coding Based MIMO Transmitter using USRP Radio
This example demonstrates the implementation of a 2x2 Multiple Input Multiple Output (MIMO) transmitter based on Alamouti based Space-Time Block Coding (STBC) using a USRP™ radio. The MIMO transmitter combines a training signal with a QPSK-modulated payload and then transmits over the air. The Alamouti Coding Based MIMO Receiver using USRP Radio example receives and demodulates the signal transmitted by this example
Required Hardware and Software
To run this example, you require one of the following hardware:
A B210 radio or two bundled N210 radios and Communications Toolbox Support Package for USRP Radio, required when using the radio as the transmitter. For information on mapping an NI™ USRP device to an Ettus Research 200-series USRP device, see Supported Hardware and Required Software.
A 300-Series USRP radio (X3xx or N3xx) and Wireless Testbench Support Package for NI USRP Radios. For information on mapping an NI USRP device to an Ettus Research 300-series USRP device, see Supported Radio Devices (Wireless Testbench).
A MIMO cable for use with two N210 radios.
The example requires two MATLAB™ sessions, one for the transmitter and one for the receiver. You run the Alamouti Coding Based MIMO Receiver using USRP Radio example in another MATLAB session to receive the transmitted signal.
Configure USRP Radio Parameters
Define the USRP radio parameters including the platform type, radio address, gain, center frequency, and sample rate. If you use two N200 or N210 radios, specify radioAddress
for two radios separated by a comma. Example: "192.168.10.2,192.168.10.3"
platform = "B210"; % Select radio for Transmission radioAddress = "30F59A1"; % Serial number/IP Address of USRP radio. gain = 45; % Set radio gain centerFrequency = 3200000000; % Set RF center frequency sampleRate = 1000000; % Set sample rate stopTime = 100; % Set stop time
Transmitter Design
Initialize Transmitter Parameters
The sdruOSTBCTransmitterInit
function initializes the USRP radio System object and returns the initialization parameters. Initialize the system objects required for the transmitter, including the radio object, scrambler, Alamouti encoder, and raised cosine transmit filter:
[radio, initParams] = sdruOSTBCTransmitterInit(platform, radioAddress,... gain, centerFrequency, sampleRate); % Create a scrambler object to scramble the input bits scrambler = comm.Scrambler(initParams.ScramblerBase, initParams.ScramblerPolynomial, ... initParams.ScramblerInitialConditions); % Create Alamouti encoder object to perform Alamouti encoding on input % symbols alamoutiEnc = comm.OSTBCEncoder( ... 'NumTransmitAntennas', initParams.NTx); % Create Raised cosine transmit filter object to interpolate input signal % using raised cosine FIR filter txFilter = comm.RaisedCosineTransmitFilter('RolloffFactor' , initParams.RolloffFactor ,... 'OutputSamplesPerSymbol', initParams.UpSamplingFactor);
Construct Training Signal and Payload
Generate a training signal based on Gold sequences, scramble the message bits, modulate the data, and encode it using the Alamouti space-time Block Encoder
trainingSignal = sdruOSTBCInitGoldSeq; % Based on Gold Sequences % Scramble the message scrambledBits = scrambler(initParams.MessageBits); % Modulate data modOut = pskmod(scrambledBits, initParams.ModulationOrder, pi/4, ... InputType="bit", OutputDataType="double"); % Alamouti Space-Time Block Encoder payload = alamoutiEnc(modOut);
Transmit Signal
Prepend the training signal to the payload. Pulse shape the data and transmit it using the configured USRP radio. Repeat this process until the specified stop time is reached.
% Prepend training signal to the payload data = [trainingSignal; payload; zeros(10,2)]; % Pulse shape data txSig = txFilter(data); currentTime = 0; underrun = uint32(0)
underrun = uint32
0
USRPFrameTime = length(txSig(:,1))/sampleRate; % Transmit signal over the air while currentTime < stopTime % Data transmission tunderrun = radio(txSig); underrun = underrun + tunderrun; if tunderrun underrun end % Update simulation time currentTime=currentTime+USRPFrameTime; end
Finally, release the system objects to free up resources
release(radio); release(scrambler); release(alamoutiEnc); release(txFilter);
Helper Functions
The following scripts are used in this example.
sdruOSTBCInitGoldSeq.m
sdruOSTBCTransmitterInit.m