# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# comm.MIMOChannel System object

Package: comm

Filter input signal through MIMO multipath fading channel

## Description

The `MIMOChannel` System object™ filters an input signal through a multiple-input multiple-output (MIMO) multipath fading channel. This object models both Rayleigh and Rician fading and employs the Kronecker model for modeling the spatial correlation between the links.

The fading processing per link is per the Methodology for Simulating Multipath Fading Channels section and assumes the same parameters for all NT × NR links of the MIMO channel. Each link comprises all multipaths for that link.

To filter an input signal using a MIMO multipath fading channel:

1. Define and set up your MIMO channel object. See Construction.

2. Call `step` to filter the input signal through a MIMO multipath fading channel according to the properties of `comm.MIMOChannel`. The behavior of `step` is specific to each object in the toolbox.

 Note:   Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`H = comm.MIMOChannel` creates a multiple-input multiple-output (MIMO) frequency selective or frequency flat fading channel System object, `H`. This object filters a real or complex input signal through the multipath MIMO channel to obtain the channel impaired signal.

`H = comm.MIMOChannel(Name,Value)` creates a MIMO channel object, `H`, with the specified property `Name` set to the specified `Value`. You can specify additional name-value pair arguments in any order as (`Name1`,`Value1`,...,`NameN`,`ValueN`).

## Properties

 `SampleRate` Input signal sample rate (hertz) Specify the sample rate of the input signal in hertz as a double-precision, real, positive scalar. The default value of this property is `1` Hz. `PathDelays` Discrete path delay vector (seconds) Specify the delays of the discrete paths in seconds as a double-precision, real, scalar or row vector. The default value of this property is 0. When you set `PathDelays` to a scalar, the MIMO channel is frequency flat. When you set `PathDelays` to a vector, the MIMO channel is frequency selective. `AveragePathGains` Average path gain vector (decibels) Specify the average gains of the discrete paths in decibels as a double-precision, real, scalar or row vector. The default value of this property is `0`. `AveragePathGains` must have the same size as `PathDelays`. `NormalizePathGains` Normalize path gains (logical) Set this property to `true` to normalize the fading processes such that the total power of the path gains, averaged over time, is `0` dB. The default value of this property is `true`. When you set this property to `false`, there is no normalization on path gains. The average powers of the path gains are specified by the `AveragePathGains` property. `FadingDistribution` Rayleigh or Rician fading Specify the fading distribution of the channel as one of `Rayleigh` or `Rician`. The default value of this property is `Rayleigh`, i.e., the channel is Rayleigh fading. `KFactor` Rician K-factor scalar or vector (linear scale) Specify the K-factor of a Rician fading channel as a double-precision, real, positive scalar or positive row vector of the same length as `PathDelays`. This property applies when you set the `FadingDistribution` property to `Rician`. The default value of this property is `3`. If `KFactor` is a scalar, the first discrete path is a Rician fading process with a Rician K-factor of `KFactor`. The remaining discrete paths are independent Rayleigh fading processes. If `KFactor` is a row vector, the discrete path corresponding to a positive element of the `KFactor` vector is a Rician fading process with a Rician K-factor specified by that element. The discrete path corresponding to a zero-valued element of the `KFactor` vector is a Rayleigh fading process. `DirectPathDopplerShift` Doppler shifts of line-of-sight components (hertz) Specify the Doppler shifts for the line-of-sight components of a Rician fading channel in hertz as a double-precision, real scalar or row vector. The default value of this property is `0`. This property applies when you set the `FadingDistribution` property to `Rician`. `DirectPathDopplerShift` must have the same size as `KFactor`. If `DirectPathDopplerShift` is a scalar, this value represents the line-of-sight component Doppler shift of the first discrete path. This path exhibits a Rician fading process. If `DirectPathDopplerShift` and `KFactor` are row vectors, the discrete path corresponding to a positive element of the `KFactor` vector is a Rician fading process. Its line-of-sight component Doppler shift is specified by the corresponding element of `DirectPathDopplerShift`. `DirectPathInitialPhase` Initial phases of line-of-sight components (radians) Specify the initial phases of the line-of-sight components of a Rician fading channel in radians as a double precision, real scalar or row vector. The default value of this property is `0`. This property applies when you set the `FadingDistribution` property to `Rician`. `DirectPathInitialPhase` must have the same size as `KFactor`. If `DirectPathInitialPhase` is a scalar, this value represents the line-of-sight component initial phase of the first discrete path. This path exhibits a Rician fading process. If `DirectPathInitialPhase` and `KFactor` are row vectors, the discrete path corresponding to a positive element of the `KFactor` vector is a Rician fading process. Its line-of-sight component initial phase is specified by the corresponding element of `DirectPathInitialPhase`. `MaximumDopplerShift` Maximum Doppler shift (hertz) Specify the maximum Doppler shift for all channel paths in hertz as a double precision, real, nonnegative scalar. The default value of this property is `0.001` Hz. The Doppler shift applies to all the paths of the channel. When you set the `MaximumDopplerShift` to `0`, the channel remains static for the entire input. You can use the `reset` method to generate a new channel realization. The `MaximumDopplerShift` must be smaller than `SampleRate`/10/fc for each path, where fc represents the cutoff frequency factor of the path. For a Doppler spectrum type other than Gaussian and BiGaussian, the value of fc is `1`. For these two Doppler spectrum types, fc is dependent on the Doppler spectrum structure fields. See Algorithms for more details about how fc is defined. `DopplerSpectrum` Doppler spectrum object Specify the Doppler spectrum shape for the path(s) of the channel. This property accepts a single Doppler spectrum structure returned from the `doppler` function or a row cell array of such structures. The maximum Doppler shift value necessary to specify the Doppler spectrum/spectra is given by the `MaximumDopplerShift` property. This property applies when you set the `MaximumDopplerShift` property value greater than `0`. The default value of this property is `doppler('Jakes')`. If you assign a single Doppler spectrum structure to `DopplerSpectrum`, all paths have the same specified Doppler spectrum. If you assign the `FadingTechnique` property to `Sum of sinusoids`, you must set `DopplerSpectrum` to `doppler('Jakes')`. Otherwise, if `FadingTechnique` is ```Filtered Gaussian noise```, select from the following: `doppler('Jakes')``doppler('Flat')``doppler('Rounded', ...)``doppler('Bell', ...)``doppler('Asymmetric Jakes', ...)``doppler('Restricted Jakes', ...)``doppler('Gaussian', ...)``doppler('BiGaussian', ...)` If you assign a row cell array of different Doppler spectrum structures to `DopplerSpectrum`, each path has the Doppler spectrum specified by the corresponding structure in the cell array. The elements can be chosen from the previous list. In this case, the length of `DopplerSpectrum` must be equal to the length of `PathDelays`. Alternatively, you can specify `DopplerSpectrum` as a single Doppler spectrum object or a row vector of such objects that must have a length equal to the length of `PathDelays`. The possible Doppler spectrum objects are `doppler.jakes``doppler.flat``doppler.rounded(...)``doppler.bell(...)``doppler.ajakes(...)``doppler.rjakes(...)``doppler.gaussian(...)``doppler.bigaussian(...)` This object supports C code generation. To generate C code, specify this property to a single Doppler spectrum structure. `SpatialCorrelation` Spatial correlation Set this property to `true` to specify the transmit and receive spatial correlation matrices from which the number of transmit and receive antennas can be derived. Set this property to `false` to specify the number of transmit and receive antennas instead. In this case, the transmit and receive spatial correlation matrices are both identity matrices. The default value of this property is `true`. `NumTransmitAntennas` Number of transmit antennas Specify the number of transmit antennas as a numeric, real, positive integer scalar between `1` and `8`, inclusive. This property applies when you set the `SpatialCorrelation` property to `false`. The default value of this property is `2`. `NumReceiveAntennas` Number of receive antennas Specify the number of receive antennas as a numeric, real, positive integer scalar between `1` and `8`, inclusive. This property applies when you set the `SpatialCorrelation` property to `false`. The default value of this property is `2`. `TransmitCorrelationMatrix` Transmit correlation matrix (or 3D array) Specify the spatial correlation of the transmitter as a double-precision, real or complex, 2D matrix or 3D array. The default value of this property is `[1 0;0 1]`. This property applies when you set the `SpatialCorrelation` property to `true`. The first dimension of `TransmitCorrelationMatrix` determines the number of transmit antennas, Nt. This dimension must be a value between 1 and 8, inclusive. If the channel is frequency flat, i.e., `PathDelays` is a scalar, `TransmitCorrelationMatrix` is a 2D Hermitian matrix of size Nt-by-Nt. The main diagonal elements must be all ones. The off-diagonal elements must be real or complex numbers with a magnitude smaller than or equal to one. If the channel is frequency selective, i.e., `PathDelays` is a row vector of length Np, you can specify `TransmitCorrelationMatrix` as an Nt-by-Nt matrix. In this case, each path has the same transmit spatial correlation matrix. Alternatively, you can specify the value as a 3D array of size Nt-by-Nt-by-Np. In this case, each path can have its own transmit spatial correlation matrix. `ReceiveCorrelationMatrix` Receive correlation matrix (or 3D array) Specify the spatial correlation of the receiver as a double-precision, real or complex, 2D matrix or 3D array. The default value of this property is `[1 0;0 1]`. This property applies when you set the `SpatialCorrelation` property to `true`. The first dimension of `ReceiveCorrelationMatrix` determines the number of receive antennas, Nr. This dimension must be a value between 1 and 8, inclusive. If the channel is frequency flat, i.e., `PathDelays` is a scalar, `ReceiveCorrelationMatrix` is a 2D Hermitian matrix of size Nr-by-Nr. The main diagonal elements must be all ones. The off-diagonal elements must be real or complex numbers with a magnitude smaller than or equal to one. If the channel is frequency selective, i.e., `PathDelays` is a row vector of length Np, you can specify `ReceiveCorrelationMatrix` as an Nr-by-Nr matrix. In this case, each path has the same receive spatial correlation matrix. Alternatively, you can specify the value as a 3D array of size Nr-by-Nr-by-Np. In this case, each path can have its own receive spatial correlation matrix. `AntennaSelection` Optional transmit and/or receive antenna selection Specify the antenna selection scheme as one of `Off` | `Tx` | `Rx` | ```Tx and Rx```. The default value of this property is `Off`. `Tx` represents transmit antennas and `Rx` represents receive antennas. When you configure any antenna selection other than the default setting, the object requires one or more inputs to specify which antennas are selected for signal transmission. Refer to the Antenna Selection section for more details. `NormalizeChannelOutputs` Normalize channel outputs (logical) Set this property to `true` to normalize the channel outputs by the number of receive antennas. The default value of this property is `true`. When you set this property to `false`, there is no normalization for channel outputs. `FadingTechnique` Fading technique used to model the channel Specify how to model the channel as ```Filtered Gaussian noise``` or `Sum of sinusoids`. The default value is `Filtered Gaussian noise`. `NumSinusoids` Number of sinusoids used to model the fading process Specify the number of sinusoids used to model the channel as a positive integer scalar. The property applies when the `FadingTechnique` property is `Sum of sinusoids`. The default value is `48`. `InitialTimeSource` Source to control the start time of the fading process Specify the initial time source as either `Property` or ```Input port```. This property is available when the `FadingTechnique` property is set to `Sum of sinusoids`. When the `InitialTimeSource` property is set to `Input port`, specify the start time of the fading process using the `INITIALTIME` input to the `step` function. The input value can change in consecutive calls to the `step` function. The default is value is `Property`. `InitialTime` Start time of the fading process (s) Specify the time offset of the fading process as a real nonnegative scalar. This property applies when the `FadingTechnique` property is set to `Sum of sinusoids` and the `InitialTimeSource` property is set to `Property`. The default value is `0`. `RandomStream` Source of random number stream Specify the source of random number stream as one of ```Global stream``` | `mt19937ar with seed`. The default value of this property is `Global stream`. If you set `RandomStream` to `Global stream`, the current global random number stream is used for normally distributed random number generation. In this case, the `reset` method only resets the filters. If you set `RandomStream` to ```mt19937ar with seed```, the mt19937ar algorithm is used for normally distributed random number generation. In this case, the `reset` method not only resets the filters but also reinitializes the random number stream to the value of the `Seed` property. `Seed` Initial seed of mt19937ar random number stream Specify the initial seed of a mt19937ar random number generator algorithm as a double precision, real, nonnegative integer scalar. The default value of this property is `73`. This property applies when you set the `RandomStream` property to `mt19937ar with seed`. The `Seed` reinitializes the mt19937ar random number stream in the `reset` method. `PathGainsOutputPort` Enable path gain output (logical) Set this property to `true` to output the channel path gains of the underlying fading process. The default value of this property is `false`. `Visualization` Enable channel visualization Specify the type of channel visualization to display as one of `Off` | `Impulse response` | ```Frequency response``` | `Impulse and frequency responses` | ```Doppler spectrum```. Visualization is available only when the `FadingTechnique` property is set to `Filtered Gaussian noise`. The default value of this property is `Off`. `AntennaPairsToDisplay` Antenna pair to display Specify the transmit-receive antenna pair to display as a 1-by-2 row vector, where the first element corresponds to the desired transmit antenna and the second corresponds to the desired receive antenna. At this time, only a single pair can be displayed. This property applies when `Visualization` is set to any value other than `Off`. The default value is `[1 1]`. `SamplesToDisplay` Percentage of samples to display Specify the percentage of samples to display as one of `10%` | `25%` | `50%` | `100%`. Displaying fewer samples results in better performance at the expense of lower accuracy. This property applies when `Visualization` is set to `Impulse response`, `Frequency response`, or `Impulse and frequency responses`. The default value is `25%`. `PathsForDopplerDisplay` Path for Doppler display Specify, as an integer scalar, the path for which the Doppler spectrum is displayed. The specified path must be an element of {1, 2, ..., Np}, where Np is the number of discrete paths per link specified in the object. At this time, only a single path can be displayed. This property applies when `Visualization` is set to `Doppler spectrum`. The default value is `1`.

## Methods

 clone Create `MIMOChannel` object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method info Characteristic information about MIMO Channel isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes reset Reset states of the `MIMOChannel` object step Filter input signal through MIMO multipath fading channel

## Examples

expand all

Create a 4x2 MIMO channel using the MIMO channel System object. Modulated and spatially encoded data is passed through the channel.

Generate QPSK-modulated data.

```data = randi([0 3],1000,1); modData = pskmod(data,4,pi/4); ```

Create an orthogonal space-time block encoder to encode the modulated data into four spatially separated streams. Encode the data.

```ostbc = comm.OSTBCEncoder('NumTransmitAntennas',4,'SymbolRate',1/2); txSig = ostbc(modData); ```

Create a MIMO channel object using name-value pairs to set the properties. The channel consists of two paths with a maximum Doppler shift of 5 Hz. Set the `SpatialCorrelation` property to `false`, which requires that you specify the number of transmit and receive antennas. Set the number of transmit antennas to 4 and the number of receive antennas to 2.

```mimochannel = comm.MIMOChannel(... 'SampleRate',1000, ... 'PathDelays',[0 2e-3], ... 'AveragePathGains',[0 -5], ... 'MaximumDopplerShift',5, ... 'SpatialCorrelation',false, ... 'NumTransmitAntennas',4, ... 'NumReceiveAntennas',2); ```

Pass the modulated and encoded data through the MIMO channel.

```rxSig = mimochannel(txSig); ```

Create a time vector, `t`, to use for plotting the power of the received signal.

```ts = 1/mimochannel.SampleRate; t = (0:ts:(size(txSig,1)-1)*ts)'; ```

Calculate and plot the power of the signal received by antenna 1.

```pwrdB = 20*log10(abs(rxSig(:,1))); plot(t,pwrdB) xlabel('Time (sec)') ylabel('Power (dBW)') ```

With and without specifying antenna selection (`mimoChan.AntennaSelection`), filter PSK modulated data through a 2x2 Rayleigh fading channel, and then examine the spatial correlation characteristics of the channel realization.

Examine 2x2 Rayleigh Fading Channel Spatial Correlation Characteristics without specifying antenna selection

Create a PSK Modulator System object™ to modulate randomly generated data.

```pskModulator = comm.PSKModulator; modData = pskModulator(randi([0 pskModulator.ModulationOrder-1],1e5,1)); ```

Split modulated data into two spatial streams.

```channelInput = reshape(modData,[2 5e4]).'; ```

Create a 2x2 `MIMOChannel` System object with two discrete paths. Each path has different transmit and receive correlation matrices, specified by the `TransmitCorrelationMatrix` and `ReceiveCorrelationMatrix` properties.

```mimoChan = comm.MIMOChannel(... 'SampleRate', 1000,... 'PathDelays', [0 1e-3],... 'AveragePathGains', [3 5],... 'NormalizePathGains', false,... 'MaximumDopplerShift', 5,... 'TransmitCorrelationMatrix', cat(3, eye(2), [1 0.1;0.1 1]),... 'ReceiveCorrelationMatrix', cat(3, [1 0.2;0.2 1], eye(2)),... 'RandomStream', 'mt19937ar with seed',... 'Seed', 33,... 'PathGainsOutputPort', true); ```

Filter the modulated data using `mimoChan`.

```[~,pathGains] = mimoChan(channelInput); ```

The transmit spatial correlation for the first discrete path at the first receive antenna is specified as an identity matrix in the `TransmitCorrelationMatrix` property. Confirm that the channel output `pathGains` exhibits the same statistical characteristics using the `corrcoef` function.

```disp('Tx spatial correlation, first path, first Rx:'); disp(corrcoef(squeeze(pathGains(:,1,:,1)))); ```
```Tx spatial correlation, first path, first Rx: 1.0000 + 0.0000i 0.0357 - 0.0253i 0.0357 + 0.0253i 1.0000 + 0.0000i ```

The transmit spatial correlation for the second discrete path at the second receive antenna is specified as `[1 0.1;0.1 1]` in the `TransmitCorrelationMatrix` property. Confirm that the channel output `pathGains` exhibits the same statistical characteristics.

```disp('Tx spatial correlation, second path, second Rx:'); disp(corrcoef(squeeze(pathGains(:,2,:,2)))); ```
```Tx spatial correlation, second path, second Rx: 1.0000 + 0.0000i 0.0863 + 0.0009i 0.0863 - 0.0009i 1.0000 + 0.0000i ```

The receive spatial correlation for the first discrete path at the second transmit antenna is specified as `[1 0.2;0.2 1]` in the `ReceiveCorrelationMatrix` property. Confirm that the channel output `pathGains` exhibits the same statistical characteristics.

```disp('Rx spatial correlation, first path, second Tx:'); disp(corrcoef(squeeze(pathGains(:,1,2,:)))); ```
```Rx spatial correlation, first path, second Tx: 1.0000 + 0.0000i 0.2236 + 0.0550i 0.2236 - 0.0550i 1.0000 + 0.0000i ```

The receive spatial correlation for the second discrete path at the first transmit antenna is specified as an identity matrix in the `ReceiveCorrelationMatrix` property. Confirm that the channel output `pathGains` exhibits the same statistical characteristics.

```disp('Rx spatial correlation, second path, first Tx:'); disp(corrcoef(squeeze(pathGains(:,2,1,:)))); ```
```Rx spatial correlation, second path, first Tx: 1.0000 + 0.0000i -0.0088 - 0.0489i -0.0088 + 0.0489i 1.0000 + 0.0000i ```

Examine 2x2 Rayleigh Fading Channel Spatial Correlation Characteristics specifying antenna selection

Now enable transmit and receive antenna selection for the System object `mimoChan`. The input frame size is shortened to 100.

```release(mimoChan); mimoChan.AntennaSelection = 'Tx and Rx'; modData = pskModulator(randi([0 pskModulator.ModulationOrder-1],1e2,1)); ```

Select the first transmit and second receive antennas.

```[channelOutput,pathGains] = mimoChan(modData,[1 0],[0 1]); ```

Confirm that the path gains MATLAB® returns have `NaN` values for the unselected transmit-receive antenna pairs.

```disp('Return 1 if the path gains for the second transmit antenna are NaN:'); disp(isequal(isnan(squeeze(pathGains(:,:,2,:))), ones(1e2, 2, 2))); disp('Return 1 if the path gains for the first receive antenna are NaN:'); disp(isequal(isnan(squeeze(pathGains(:,:,:,1))), ones(1e2, 2, 2))); ```
```Return 1 if the path gains for the second transmit antenna are NaN: 1 Return 1 if the path gains for the first receive antenna are NaN: 1 ```

Create a frequency selective MIMO channel and display its impulse and frequency responses.

Set the sample rate to 10 MHz and specify path delays and gains using the extended vehicular A (EVA) channel parameters. Set the maximum Doppler shift to 70 Hz.

```fs = 10e6; % Hz pathDelays = [0 30 150 310 370 710 1090 1730 2510]*1e-9; % sec avgPathGains = [0 -1.5 -1.4 -3.6 -0.6 -9.1 -7 -12 -16.9]; % dB fD = 70; % Hz ```

Create a 2x2 MIMO channel System object with the previously defined parameters and set the `Visualization` property to `Impulse and frequency responses` using name-value pairs. By default, the antenna pair corresponding to transmit antenna 1 and receive antenna 1 will be displayed.

```mimoChan = comm.MIMOChannel('SampleRate',fs, ... 'PathDelays',pathDelays, ... 'AveragePathGains',avgPathGains, ... 'MaximumDopplerShift',fD, ... 'Visualization','Impulse and frequency responses'); ```

Generate random binary data and pass it through the MIMO channel. The impulse response plot allows you to easily identify the individual paths and their corresponding filter coefficients. The frequency selective nature of the EVA channel is shown by the frequency response plot.

```x = randi([0 1],1000,2); y = mimoChan(x); ```

Release `mimoChan` and set the `AntennaPairsToDisplay` property to [2 1] to view the antenna pair corresponding to transmit antenna 2 and receive antenna 1. It is necessary to release the object as the property is non-tunable.

```release(mimoChan) mimoChan.AntennaPairsToDisplay = [2 1]; y = mimoChan(x); ```

Create and visualize the Doppler spectra of a MIMO channel having two paths.

Construct a cell array of Doppler structures to be used in creating the channel. The Doppler spectrum of the first path is set to have a bell shape while the second path is set to be flat.

```dp{1} = doppler('Bell'); dp{2} = doppler('Flat'); ```

Create a default 2x2 MIMO channel with two paths and a 100 Hz maximum Doppler shift using name-value pairs. Set the `Visualization` property to `Doppler spectrum` and set `PathsForDopplerDisplay` to 1. The Doppler spectrum of the first path will be displayed.

```mimoChan = comm.MIMOChannel('SampleRate',1000, ... 'PathDelays',[0 0.002],'AveragePathGains',[0 -3], ... 'MaximumDopplerShift',100, ... 'DopplerSpectrum',dp, ... 'Visualization','Doppler spectrum', ... 'PathsForDopplerDisplay',1); ```

Pass random data through the MIMO channel to generate the Doppler spectrum of the first path. Since the Doppler spectrum plot only updates when its buffer is filled, the `mimoChan` function is invoked multiple times to improve the accuracy of the estimate. Observe that the spectrum has a bell shape and that its minimum and maximum frequencies fall within the limits set by `MaximumDopplerShift`.

```for k = 1:25 x = randi([0 1],10000,2); y = mimoChan(x); end ```

Release `mimoChan` and set the `PathsForDopplerDisplay` property to 2. It is necessary to release the object as the property is non-tunable. Call the function multiple times to display the Doppler spectrum of the second path. Observe that the spectrum is flat.

```release(mimoChan) mimoChan.PathsForDopplerDisplay = 2; for k = 1:25 x = randi([0 1],10000,2); y = mimoChan(x); end ```

Create a MIMO channel object and pass data through it using the sum-of-sinusoids technique. The example demonstrates how the channel state is maintained in cases in which data is discontinuously transmitted.

Define the overall simulation time and three time segments for which data will be transmitted. In this case, the channel is simulated for 1 s with a 1000 Hz sampling rate. One 1000-sample, continuous data sequence is transmitted at time 0. Three 100-sample, data packets are transmitted at time 0.1 s, 0.4 s, and 0.7 s.

```t0 = 0:0.001:0.999; % Transmission 0 t1 = 0.1:0.001:0.199; % Transmission 1 t2 = 0.4:0.001:0.499; % Transmission 2 t3 = 0.7:0.001:0.799; % Transmission 3 ```

Generate random binary data corresponding to the previously defined time intervals.

```d0 = randi([0 1],1000,2); % 1000 samples d1 = randi([0 1],100,2); % 100 samples d2 = randi([0 1],100,2); % 100 samples d3 = randi([0 1],100,2); % 100 samples ```

Create a flat fading 2x2 MIMO channel System object with the `Sum of sinusoids` fading technique. So that results can be repeated, specify a seed using a name-value pair. As the `InitialTime` property is not specified, the fading channel will be simulated from time 0. Enable the path gains output port.

```mimoChan1 = comm.MIMOChannel('SampleRate',1000, ... 'MaximumDopplerShift',5, ... 'RandomStream','mt19937ar with seed', ... 'Seed',17, ... 'FadingTechnique','Sum of sinusoids', ... 'PathGainsOutputPort',true); ```

Create a clone of the MIMO channel System object. Set the `InitalTimeSource` property to `Input port` so that the fading channel offset time can be specified as an input argument to the `mimoChan` function.

```mimoChan2 = clone(mimoChan1); mimoChan2.InitialTimeSource = 'Input port'; ```

Pass random binary data through the first channel object, `mimoChan1`. Data is transmitted over all 1000 time samples. For this example, only the complex path gain is needed.

```[~,pg0] = mimoChan1(d0); ```

Pass random data through the second channel object, `mimoChan2`, where the initial time offsets are provided as input arguments.

```[~,pg1] = mimoChan2(d1,0.1); [~,pg2] = mimoChan2(d2,0.4); [~,pg3] = mimoChan2(d3,0.7); ```

Compare the number of samples processed by the two channels using the `info` method. You can see that 1000 samples were processed by `mimoChan1` while only 300 were processed by `mimoChan2`.

```G = info(mimoChan1); H = info(mimoChan2); [G.NumSamplesProcessed H.NumSamplesProcessed] ```
```ans = 1000 300 ```

Convert the path gains into decibels for the path corresponding to the first transmit and first receive antenna.

```pathGain0 = 20*log10(abs(pg0(:,1,1,1))); pathGain1 = 20*log10(abs(pg1(:,1,1,1))); pathGain2 = 20*log10(abs(pg2(:,1,1,1))); pathGain3 = 20*log10(abs(pg3(:,1,1,1))); ```

Plot the path gains for the continuous and discontinuous cases. Observe that the gains for the three segments perfectly match the gain for the continuous case. The alignment of the two highlights that the sum-of-sinusoids technique is ideally suited to the simulation of packetized data as the channel characteristics are maintained even when data is not transmitted.

```plot(t0,pathGain0,'r--') hold on plot(t1,pathGain1,'b') plot(t2,pathGain2,'b') plot(t3,pathGain3,'b') grid xlabel('Time (sec)') ylabel('Path Gain (dB)') legend('Continuous','Discontinuous','location','nw') ```

Demonstrate the advantage of using the sum of sinusoids fading technique when simulating a channel with burst data.

Set the simulation parameters such that the sampling rate is 100 kHz, the total simulation time is 100 seconds, and the duty cycle for the burst data is 25%.

```fs = 1e5; % Hz tsim = 100; % seconds dutyCycle = 0.25; ```

Create a flat fading 2x2 MIMO channel object using the default `Filtered Gaussian noise` technique.

```fgn = comm.MIMOChannel('SampleRate',fs); ```

Create a similar MIMO channel object using the `Sum of sinusoids` technique where the fading process start times are given as an input argument.

```sos = comm.MIMOChannel('SampleRate',fs, ... 'FadingTechnique','Sum of sinusoids', ... 'NumSinusoids',48, ... 'InitialTimeSource','Input port'); ```

Run a continuous sequence of random bits through the filtered Gaussian noise MIMO chanel object. Use the tic/toc stopwatch timer functions to measure the execution time of the function call.

```tic y = fgn(randi([0 1],fs*tsim,2)); tFGN = toc; ```

To transmit a data burst each second, pass random bits through the sum of sinusoids MIMO channel object by calling the `sos` function inside of a for loop. Use the tic/toc stopwatch timer to measure the execution time.

```tic for k = 1:tsim z = sos(randi([0 1],fs*dutyCycle,2),0.5+(k-1)); end tSOS = toc; ```

Compare the ratio of the sum of sinusoids execution time to the filtered Gaussian noise execution time. The ratio is less than one, which indicates that the sum of sinusoids technique is faster.

```tSOS/tFGN ```
```ans = 0.4162 ```

## Algorithms

The fading processing per link is per the Methodology for Simulating Multipath Fading Channels section and assumes the same parameters for all NT· NR links of the MIMO channel. Each link comprises all multipaths for that link.

### The Kronecker Model

The Kronecker model assumes that the spatial correlations at the transmit and receive sides are separable. Equivalently, the direction of departure (DoD) and directions of arrival (DoA) spectra are assumed to be separable. The full correlation matrix can then be obtained as:

`${R}_{H}=E\left[{R}_{t}\otimes {R}_{r}\right]$`

where:

The ⊗ symbol represents the Kronecker product.

Rt represents the correlation matrix at the transmit side, i.e. ${R}_{t}=E\left[{H}^{H}H\right]$, of size Nt-by-Nt.

Rr represents the correlation matrix at the receive side, i.e. ${R}_{r}=E\left[H{H}^{H}\right]$, of size Nr-by-Nr.

You can obtain a realization of the MIMO channel matrix as:

`$H={R}_{r}^{\frac{1}{2}}A{R}_{t}^{\frac{1}{2}}$`

where: A is an Nr-by-Nt matrix of i.i.d. complex Gaussian variables with zero mean and unit variance.

### Cutoff Frequency Factor

The following information explains how this object determines the cutoff frequency factor, fc for different Doppler spectrum types:

• For any Doppler spectrum type, other than Gaussian and BiGaussian, fc equals `1`.

• For a Gaussian Doppler spectrum type, fc equals the Doppler spectrum structure `NormalizedStandardDeviations` field value times sqrt(2∙log(2)).

• For a BiGaussian Doppler spectrum type:

• If the Doppler spectrum structure `PowerGains` field is `[0,0]`, then fc equals the `SigmaGaussian2` (`SigmaGaussian1`) property value times sqrt(2∙log(2)).

• If the `CenterFreqGaussian1` and `CenterFreqGaussian2` property values are both `0` and the `SigmaGaussian1` and `SigmaGaussian2` property values are the same, then fc is also equal to the `SigmaGaussian2` property value times sqrt(2∙log(2)).

• In all other cases, fc equals `1`.

### Antenna Selection

When the object is in antenna selection mode, it uses the following algorithms to process an input signal:

• The random path gains are always generated and keep evolving for each link, no matter whether the link is being selected or not. The path gain values for the non-selected links are marked as `NaN` in the path gain output.

• The spatial correlation only applies to the selected transmit and/or receive antennas, and the correlation coefficients are the corresponding entries in the transmit and/or receive correlation matrices. In other words, the spatial correlation matrix for the selected transmit/receive antennas is a submatrix of the `TransmitCorrelationMatrix`/`ReceiveCorrelationMatrix` property value.

• The input filtering through the path gains only happens to the selected links.

• Whenever a link associated with a specific transmitter transitions from a selected state to a non-selected state, its channel filter is reset. For example, if the `AntennaSelection` property is set to `Tx` and the selected transmit antenna is changed from 2 to 1, the channel filter corresponding to antenna 2 will be reset.

• Channel output normalization happens over the number of selected receive antennas.

## Selected Bibliography

[1] Oestges, C., and B. Clerckx. MIMO Wireless Communications: From Real-World Propagation to Space-Time Code Design, Academic Press, 2007.

[2] Correira, L. M. Mobile Broadband Multimedia Networks: Techniques, Models and Tools for 4G, Academic Press, 2006.

[3] Kermoal, J. P., L. Schumacher, K. I. Pedersen, P. E. Mogensen, and F. Frederiksen. "A stochastic MIMO radio channel model with experimental validation." IEEE Journal on Selected Areas of Communications. Vol. 20, Number 6, 2002, pp. 1211–1226.

[4] Jeruchim, M., P. Balaban, and K. S. Shanmugan. Simulation of Communication Systems, Second Edition, New York, Kluwer Academic/Plenum, 2000.

[5] Pätzold, Matthias, Cheng-Xiang Wang, and Bjorn Olav Hogstand. "Two New Sum-of-Sinusoids-Based Methods for the Efficient Generation of Multiple Uncorrelated Rayleigh Fading Waveforms." IEEE Transactions on Wireless Communications. Vol. 8, Number 6, 2009, pp. 3122–3131.