# wlanTGnChannel

Filter signal through 802.11n multipath fading channel

## Description

The `wlanTGnChannel`

System object™ filters an input signal through an 802.11n™ (TGn) multipath fading channel.

The fading processing assumes the same parameters for all
*N*_{T}-by-*N*_{R}
links of the TGn channel. *N*_{T} is the number of
transmit antennas and *N*_{R} is the number of receive
antennas. Each link comprises all multipaths for that link.

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

Create the

`wlanTGnChannel`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

## Creation

### Description

creates a TGn fading
channel System object, `tgn`

= wlanTGnChannel`tgn`

. This object filters a real or complex input
signal through the TGn channel to obtain the channel-impaired signal.

creates a TGn channel object, `tgn`

= wlanTGnChannel(`Name`

,`Value`

)`tgn`

, and sets properties using one or
more name-value pairs. Enclose each property name in quotes. For example,
`wlanTGnChannel('NumReceiveAntennas',2,'SampleRate',10e6)`

creates a
TGn channel with two receive antennas and a 10 MHz sample rate.

## Properties

Unless otherwise indicated, properties are *nontunable*, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
`release`

function unlocks them.

If a property is *tunable*, you can change its value at
any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

`SampleRate`

— Sample rate of the input signal

`20e6`

(default) | positive scalar

Sample rate of the input signal in Hz, specified as a positive scalar.

**Data Types: **`double`

`DelayProfile`

— Delay profile model

`'Model-B'`

(default) | `'Model-A'`

| `'Model-C'`

| `'Model-D'`

| `'Model-E'`

| `'Model-F'`

Delay profile model, specified as `'Model-A'`

,
`'Model-B'`

, `'Model-C'`

,
`'Model-D'`

, `'Model-E'`

, or
`'Model-F'`

.

The table summarizes the models properties before the bandwidth reduction factor.

Parameter | Model | |||||
---|---|---|---|---|---|---|

A | B | C | D | E | F | |

Breakpoint distance (m) | 5 | 5 | 5 | 10 | 20 | 30 |

RMS delay spread (ns) | 0 | 15 | 30 | 50 | 100 | 150 |

Maximum delay (ns) | 0 | 80 | 200 | 390 | 730 | 1050 |

Rician K-factor (dB) | 0 | 0 | 0 | 3 | 6 | 6 |

Number of clusters | 1 | 2 | 2 | 3 | 4 | 6 |

Number of taps | 1 | 9 | 14 | 18 | 18 | 18 |

**Data Types: **`char`

| `string`

`CarrierFrequency`

— RF carrier frequency

`5.25e9`

(default) | positive scalar

RF carrier frequency in Hz, specified as a positive scalar.

**Data Types: **`double`

`EnvironmentalSpeed`

— Speed of the scatterers

`1.2`

(default) | positive scalar

Speed of the scatterers in km/h, specified as a positive scalar.

**Data Types: **`double`

`TransmitReceiveDistance`

— Distance between transmitter and receiver

`3`

(default) | positive scalar

Distance between the transmitter and receiver in meters, specified as a positive scalar.

`TransmitReceiveDistance`

is used to compute the path loss, and
to determine whether the channel has a line of sight (LOS) or non line of sight (NLOS)
condition. The path loss and standard deviation of shadow fading loss depend on the
separation between the transmitter and the receiver.

**Data Types: **`double`

`NormalizePathGains`

— Normalize path gains

`true`

or `1`

(default) | `false`

or `0`

Normalize path gains, specified as a numeric or logical `1`

(`true`

) or `0`

(`false`

). To
normalize the fading processes such that the total power of the path gains, averaged
over time, is 0 dB, set this property to `1`

(`true`

).
Otherwise, set this property to `0`

(`false`

).

**Data Types: **`logical`

`NumTransmitAntennas`

— Number of transmit antennas

`1`

(default) | positive integer

Number of transmit antennas, specified as a positive integer.

**Data Types: **`double`

`TransmitAntennaSpacing`

— Distance between transmit antenna elements

`0.5`

(default) | positive scalar

Distance between transmit antenna elements, specified as a positive scalar expressed in wavelengths.

`TransmitAntennaSpacing`

supports uniform linear arrays
only.

#### Dependencies

To enable this property, set the `NumTransmitAntennas`

property
to a value greater than `1`

.

**Data Types: **`double`

`NumReceiveAntennas`

— Number of receive antennas

`1`

(default) | positive integer

Number of receive antennas, specified as a positive integer.

**Data Types: **`double`

`ReceiveAntennaSpacing`

— Distance between receive antenna elements

`0.5`

(default) | positive scalar

Distance between receive antenna elements, specified as a positive scalar expressed in wavelengths.

`ReceiveAntennaSpacing`

supports uniform linear arrays
only.

#### Dependencies

To enable this property, set the `NumReceiveAntennas`

property
to a value greater than `1`

.

**Data Types: **`double`

`LargeScaleFadingEffect`

— Large-scale fading effects

`'None'`

(default) | `'Pathloss'`

| `'Shadowing'`

| `'Pathloss and shadowing'`

Large-scale fading effects applied in the channel, specified as
`'None'`

, `'Pathloss'`

,
`'Shadowing'`

, or `'Pathloss and shadowing'`

.

**Data Types: **`char`

| `string`

`FluorescentEffect`

— Fluorescent effect

`true`

or `1`

(default) | `false`

or `0`

Fluorescent effect, specified as a numeric or logical `1`

(`true`

) or `0`

(`false`

). To
include Doppler effects from fluorescent lighting, set this property to
`1`

(`true`

).

#### Dependencies

To enable this property, set the `DelayProfile`

property to
`'Model-D'`

or `'Model-E'`

.

**Data Types: **`logical`

`PowerLineFrequency`

— Power line frequency

`'60Hz'`

(default) | `'50Hz'`

Power line frequency in Hz, specified as `'50Hz'`

or
`'60Hz'`

.

The power line frequency is 60 Hz in the United States and 50 Hz in Europe.

#### Dependencies

To enable this property, set the `FluorescentEffect`

property
to `1`

(`true`

) and the
`DelayProfile`

property to `'Model-D'`

or
`'Model-E'`

.

**Data Types: **`char`

| `string`

`NormalizeChannelOutputs`

— Normalize channel outputs

`true`

or `1`

(default) | `false`

or `0`

Normalize channel outputs by the number of receive antennas, specified as a numeric
or logical `1`

(`true`

) or `0`

(`false`

).

**Data Types: **`logical`

`ChannelFiltering`

— Enable channel filtering

`true`

or `1`

(default) | `false`

or `0`

Enable channel filtering, specified as a numeric or logical `1`

(`true`

) or `0`

(`false`

). To
enable channel filtering, set this property to `1`

(`true`

). To disable channel filtering, set this property to
`0`

(`false`

)..

**Note**

If you set this property to `0`

(`false`

), the
`step`

object function does not accept
an input signal. In this case, the `NumSamples`

and `SampleRate`

properties determine the duration of the fading process
realization.

**Data Types: **`logical`

`NumSamples`

— Number of time-domain samples

`80`

(default) | positive integer

Number of time-domain samples used to get path gain samples, specified as a positive integer.

#### Dependencies

To enable this property, set the `ChannelFiltering`

property to `false`

.

**Data Types: **`double`

`OutputDataType`

— Data type of impaired signal

`'double'`

(default) | `'single'`

Data type of impaired signal, specified as one of these values:

`'double'`

– Return the`pathGains`

output as a double-precision matrix`'single'`

– Return the`pathGains`

output as a single-precision matrix

#### Dependencies

To enable this property, set the `ChannelFiltering`

property to
`0`

(`false`

).

**Data Types: **`char`

| `string`

`RandomStream`

— Source of random number stream

`'Global stream'`

(default) | `'mt19937ar with seed'`

Source of random number stream, specified as `'Global stream'`

or
`'mt19937ar with seed'`

.

If you set this property to `'Global stream'`

, the current global
random number stream is used for random number generation. In this case, the
`reset`

function resets the filters and creates a new channel
realization.

If you set this property to `'mt19937ar with seed'`

, the mt19937ar
algorithm generates random numbers. In this case, the `reset`

function
also reinitializes the random number stream to the value of the
`Seed`

property.

**Note**

The random numbers of the channel components are distributed as follows:

The random phase of the Doppler component due to fluorescent lights is uniformly distributed. See equation 27 of

*TGn Channel Models*for more information.In multi-user scenarios using the TGac, TGah, or TGax channel models, the per-user angle-of-arrival (AoA) and angle-of-departure (AoD) rotations discussed in the MIMO Enhancements section are uniformly distributed.

The fading samples are generated from a normally-distributed complex uncorrelated Gaussian process with zero mean and unit variance in discrete time.

**Data Types: **`char`

| `string`

`Seed`

— Initial seed of mt19937ar random number stream

`73`

(default) | nonnegative integer

Initial seed of an mt19937ar random number stream, specified as a nonnegative
integer. The `Seed`

property reinitializes the mt19937ar random
number stream in the `reset`

function.

#### Dependencies

To enable this property, set the `RandomStream`

property to
`'mt19937ar with seed'`

.

**Data Types: **`double`

`PathGainsOutputPort`

— Enable path gain output

`false`

or `0`

(default) | `true`

or `1`

Enable path gain output computation, specified as a numeric or logical
`1`

(`true`

) or `0`

(`false`

).

**Data Types: **`logical`

## Usage

### Description

`[`

also returns in `y`

,`pathGains`

] = tgn(`x`

)`pathGains`

the TGn channel path gains of the
underlying fading process.

This syntax applies when you set the `PathGainsOutputPort`

property to `1`

(`true`

).

### Input Arguments

`x`

— Input signal

complex matrix

Input signal, specified as a real or complex
*N*_{S}-by-*N*_{T}
matrix, where:

*N*_{S}is the number of samples.*N*_{T}is the number of transmit antennas and must be equal to the`NumTransmitAntennas`

property value.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

### Output Arguments

`y`

— Output signal

complex matrix

Output signal, returned as an
*N*_{S}-by-*N*_{R}
complex matrix, where:

*N*_{S}is the number of samples.*N*_{R}is the number of receive antennas and is equal to the`NumReceiveAntennas`

property value.

**Data Types: **`single`

| `double`

`pathGains`

— Path gains of the fading process

complex array

Path gains of the fading process, returned as an
*N*_{S}-by-*N*_{P}-by-*N*_{T}-by-*N*_{R}
complex array, where:

*N*_{S}is the number of samples.*N*_{P}is the number of resolvable paths, that is, the number of paths defined for the case specified by the`DelayProfile`

property.*N*_{T}is the number of transmit antennas and is equal to the`NumTransmitAntennas`

property value.*N*_{R}is the number of receive antennas and is equal to the`NumReceiveAntennas`

property value.

**Data Types: **`single`

| `double`

## Object Functions

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

**Note**

`reset`

: If the
`RandomStream`

property of the System object is set to `'Global stream'`

, the `reset`

function resets the filters only. If you set
`RandomStream`

to `'mt19937ar with seed'`

, the
`reset`

function also reinitializes the random number
stream to the value of the `Seed`

property.

## Examples

### Transmit HT Waveform Through TGn Channel

Generate an HT waveform and pass it through a TGn SISO channel. Display the spectrum of the resultant signal.

Set the channel bandwidth and the corresponding sample rate.

```
bw = 'CBW40';
fs = 40e6;
```

Generate an HT waveform for a 40 MHz channel.

```
cfg = wlanHTConfig('ChannelBandwidth',bw);
txSig = wlanWaveformGenerator(randi([0 1],1000,1),cfg);
```

Create a TGn SISO channel with path loss and shadowing enabled.

tgnChan = wlanTGnChannel('SampleRate',fs, ... 'LargeScaleFadingEffect','Pathloss and shadowing');

Pass the HT waveform through the channel.

rxSig = tgnChan(txSig);

Plot the spectrum of the received waveform.

saScope = spectrumAnalyzer(SampleRate=fs,YLimits=[-120 -40]); saScope(rxSig)

Because path loss and shadowing are enabled, the mean received power across the spectrum is approximately -60 dBm.

### Transmit HT Waveform Through 4x2 MIMO Channel

Create an HT waveform having four transmit antennas and two space-time streams.

cfg = wlanHTConfig('NumTransmitAntennas',4,'NumSpaceTimeStreams',2, ... 'SpatialMapping','Fourier'); txSig = wlanWaveformGenerator([1;0;0;1],cfg);

Create a 4x2 MIMO TGn channel and disable large-scale fading effects.

tgnChan = wlanTGnChannel('SampleRate',20e6, ... 'NumTransmitAntennas',4, ... 'NumReceiveAntennas',2, ... 'LargeScaleFadingEffect','None');

Pass the transmit waveform through the channel.

rxSig = tgnChan(txSig);

Display the spectrum of the two received space-time streams.

saScope = spectrumAnalyzer(SampleRate=20e6, ... ShowLegend=true, ... ChannelNames={'Stream 1','Stream 2'}); saScope(rxSig)

### Recover HT Data from 2x2 MIMO Channel

Transmit an HT-LTF and an HT data field through a noisy 2x2 MIMO channel. Demodulate the received HT-LTF to estimate the channel coefficients. Recover the HT data and determine the number of bit errors.

Set the channel bandwidth and corresponding sample rate.

```
bw = 'CBW40';
fs = 40e6;
```

Create HT-LTF and HT data fields having two transmit antennas and two space-time streams.

cfg = wlanHTConfig('ChannelBandwidth',bw, ... 'NumTransmitAntennas',2,'NumSpaceTimeStreams',2); txPSDU = randi([0 1],8*cfg.PSDULength,1); txLTF = wlanHTLTF(cfg); txDataSig = wlanHTData(txPSDU,cfg);

Create a 2x2 MIMO TGn channel with path loss and shadowing enabled.

tgnChan = wlanTGnChannel('SampleRate',fs, ... 'NumTransmitAntennas',2,'NumReceiveAntennas',2, ... 'LargeScaleFadingEffect','None');

Create AWGN channel noise, setting SNR = 15 dB.

chNoise = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)',... 'SNR',15);

Pass the signals through the TGn channel and noise models.

rxLTF = chNoise(tgnChan(txLTF)); rxDataSig = chNoise(tgnChan(txDataSig));

Create an AWGN channel for a 40 MHz channel with a 9 dB noise figure. The noise variance, `nVar`

, is equal to *kTBF*, where *k* is Boltzmann's constant, *T* is the ambient temperature of 290 K, *B* is the bandwidth (sample rate), and *F* is the receiver noise figure.

nVar = 10^((-228.6 + 10*log10(290) + 10*log10(fs) + 9)/10); awgnChan = comm.AWGNChannel('NoiseMethod','Variance','Variance',nVar);

Pass the signals through the channel.

rxLTF = awgnChan(rxLTF); rxDataSig = awgnChan(rxDataSig);

Demodulate the HT-LTF. Use the demodulated signal to estimate the channel coefficients.

dLTF = wlanHTLTFDemodulate(rxLTF,cfg); chEst = wlanHTLTFChannelEstimate(dLTF,cfg);

Recover the data and determine the number of bit errors.

rxPSDU = wlanHTDataRecover(rxDataSig,chEst,nVar,cfg); numErr = biterr(txPSDU,rxPSDU)

numErr = 0

## Algorithms

The 802.11n channel object uses a filtered Gaussian noise model in which the path delays, powers, angular spread, angles of arrival, and angles of departure are determined empirically. The specific modeling approach is described in [1].

### Multipath Parameters

The channel is modeled as several clusters, each of which represents an independent propagation path between the transmitter and the receiver. A cluster is composed of subpaths, or taps, which share angular spreads, angles of arrival, and angles of departure. Delay and power level vary from tap to tap. Within the TGn model, clusters comprise 1–7 taps. The cluster parameters for cluster 1 of model B are shown in the table.

Parameter | Tap | ||||
---|---|---|---|---|---|

1 | 2 | 3 | 4 | 5 | |

Delay (ns) | 0 | 10 | 20 | 30 | 40 |

Power (dB) | 0 | –5.4 | –10.8 | –16.2 | –21.7 |

Angle of arrival (°) | 4.3 | 4.3 | 4.3 | 4.3 | 4.3 |

Receiver angular spread (°) | 14.4 | 14.4 | 14.4 | 14.4 | 14.4 |

Angle of departure (°) | 225.1 | 225.1 | 225.1 | 225.1 | 225.1 |

Transmitter angular spread (°) | 14.4 | 14.4 | 14.4 | 14.4 | 14.4 |

For each model, the first tap has a line of sight (LOS) between the transmitter and receiver, whereas all other taps are non line of sight (NLOS). As a result, the first tap exhibits Rician behavior, while the others exhibit Rayleigh behavior. The Rician K-factor is the ratio between the power in the first tap and the power in the other taps. A large K-factor indicates a strong LOS component.

The angles of arrival and departure for each cluster are randomly selected from a
uniform distribution over [0, 2*π*]. These angles are independent of each
other and are fixed for all channel realizations. By fixing the values, the transmit and
receive correlation matrices are computed only once. Angular spread values were indirectly
determined from empirical data and fall within the 20° to 40° range.

### Path Loss and Shadowing

The path loss exponent and the standard deviation of the shadow fading loss characterize
each model. The two parameters depend on the presence of a LOS between the transmitter and
receiver. For paths with a transmitter-to-receiver distance, *d*, less that
the breakpoint distance, *d*_{BP}, the LOS parameters
apply. For *d*
>*d*_{BP}, the NLOS parameters apply. The table summarizes the path loss and shadow
fading parameters.

Parameter | Model | |||||
---|---|---|---|---|---|---|

A | B | C | D | E | F | |

Breakpoint distance, d_{BP} (m) | 5 | 5 | 5 | 10 | 20 | 30 |

Path loss exponent for d ≤
d_{BP} | 2 | 2 | 2 | 2 | 2 | 2 |

Path loss exponent for d
>d_{BP} | 3.5 | 3.5 | 3.5 | 3.5 | 3.5 | 3.5 |

Shadow fading σ (dB) for d ≤
d_{BP} | 3 | 3 | 3 | 3 | 3 | 3 |

Shadow fading σ (dB) for d
>d_{BP} | 4 | 4 | 5 | 5 | 6 | 6 |

### Doppler Effects

In indoor environments, the transmitter and receiver are stationary, and Doppler effects
arise from people moving between them. The TGn model employs a bell-shaped Doppler spectrum
in which the environmental speed, *ν*_{0}, is 1.2 km/h
by default (it is specified by the `EnvironmentalSpeed`

property). The
Doppler spread, *f*_{d}, is calculated as *f*_{d} =
*ν*_{0}/*λ*, where *λ* is the carrier wavelength.

The channel sampling rate, *F*_{s}, must be lower
than the input sampling rate to avoid aliasing. It is calculated as:

*F*_{s}=
(*ν*_{0}×*F*_{c})/(300×*c*)

where *F*_{c} is the carrier frequency, specified
by the `CarrierFrequency`

property, *c* is the speed of
light and *ν*_{0} is defined in m/s.

In addition to basic Doppler effects resulting from environmental motion, fluorescent lights introduce signal fading at twice the power line frequency. The effects show up as frequency-selective amplitude modulation. Again, to avoid aliasing, the Nyquist frequency of the first interpolation factor must be greater than the highest harmonic.

The effect is included in models D and E. To disable this effect, set the
`FluorescentEffect`

property to `false`

.

## References

[1] Erceg, V., L. Schumacher, P.
Kyritsi, et al. *TGn Channel Models*. Version 4. IEEE 802.11-03/940r4,
May 2004.

[2] 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 in
Communications*., Vol. 20, No. 6, August 2002, pp. 1211–1226.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

Usage notes and limitations:

See System Objects in MATLAB Code Generation (MATLAB Coder).

## Version History

**Introduced in R2015b**

## Abrir ejemplo

Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?

## Comando de MATLAB

Ha hecho clic en un enlace que corresponde a este comando de MATLAB:

Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)