Accelerating the pace of engineering and science

# rayleighchan

## Syntax

chan = rayleighchan(ts,fd)
chan = rayleighchan(ts,fd,tau,pdb)
chan = rayleighchan

## Description

chan = rayleighchan(ts,fd) constructs a frequency-flat ("single path") Rayleigh fading channel object. ts is the sample time of the input signal, in seconds. fd is the maximum Doppler shift, in hertz. You can model the effect of the channel on a signal x by using the syntax y = filter(chan,x).

chan = rayleighchan(ts,fd,tau,pdb) constructs a frequency-selective ("multiple path") fading channel object that models each discrete path as an independent Rayleigh fading process. tau is a vector of path delays, each specified in seconds. pdb is a vector of average path gains, each specified in dB.

With the above two syntaxes, a smaller fd (a few hertz to a fraction of a hertz) leads to slower variations, and a larger fd (a couple hundred hertz) to faster variations.

chan = rayleighchan constructs a frequency-flat Rayleigh channel object with no Doppler shift. This is a static channel. The sample time of the input signal is irrelevant for frequency-flat static channels.

### Properties

The tables below describe the properties of the channel object, chan, that you can set and that MATLAB® technical computing software sets automatically. To learn how to view or change the values of a channel object, see Display Object Properties or Change Object Properties.

Writeable Properties

PropertyDescription
InputSamplePeriodSample period of the signal on which the channel acts, measured in seconds.
DopplerSpectrumDoppler spectrum object(s). The default is a Jakes Doppler object.
MaxDopplerShiftMaximum Doppler shift of the channel, in hertz (applies to all paths of a channel).
PathDelaysVector listing the delays of the discrete paths, in seconds.
AvgPathGaindBVector listing the average gain of the discrete paths, in decibels.
NormalizePathGainsIf 1, the Rayleigh fading process is normalized such that the expected value of the path gains' total power is 1.
StoreHistoryIf this value is 1, channel state information needed by the channel visualization tool is stored as the channel filter function processes the signal. The default value is 0.
StorePathGainsIf set to 1, the complex path gain vector is stored as the channel filter function processes the signal. The default value is 0.
ResetBeforeFilteringIf 1, each call to filter resets the state of chan before filtering. If 0, the fading process maintains continuity from one call to the next.

PropertyDescriptionWhen MATLAB Sets or Updates Value
ChannelTypeFixed value, 'Rayleigh'When you create object
PathGainsComplex vector listing the current gains of the discrete paths. When you create or reset chan, PathGains is a random vector influenced by AvgPathGaindB and NormalizePathGains.When you create object, reset object, or use it to filter a signal
ChannelFilterDelayDelay of the channel filter, measured in samples.
The ChannelFilterDelay property returns a delay value that is valid only if the first value of the PathGain is the biggest path gain. In other words, main channel energy is in the first path.
When you create object or change ratio of InputSamplePeriod to PathDelays
NumSamplesProcessedNumber of samples the channel processed since the last reset. When you create or reset chan, this property value is 0.When you create object, reset object, or use it to filter a signal

### Relationships Among Properties

The PathDelays and AvgPathGaindB properties of the channel object must always have the same vector length, because this length equals the number of discrete paths of the channel. The DopplerSpectrum property must either be a single Doppler object or a vector of Doppler objects with the same length as PathDelays.

If you change the length of PathDelays, MATLAB truncates or zero-pads the value of AvgPathGaindB if necessary to adjust its vector length (MATLAB may also change the values of read-only properties such as PathGains and ChannelFilterDelay). If DopplerSpectrum is a vector of Doppler objects, and you increase or decrease the length of PathDelays, MATLAB will add Jakes Doppler objects or remove elements from DopplerSpectrum, respectively, to make it the same length as PathDelays.

If StoreHistory is set to 1 (the default is 0), the object stores channel state information as the channel filter function processes the signal. You can then visualize this state information through a GUI using the plot (channel) method.

 Note:   Setting StoreHistory to 1 will result in a slower simulation. If you do not want to visualize channel state information using plot (channel), but want to access the complex path gains, then set StorePathGains to 1, while keeping StoreHistory as 0.

### Visualization of Channel

The characteristics of a channel can be plotted using the channel visualization tool. You can use the channel visualization tool in Normal mode and Accelerator mode. For more information, see Channel Visualization.

## Examples

Several examples using this function are in Fading Channels.

The example below illustrates that when you change the value of PathDelays, MATLAB automatically changes the values of other properties to make their vector lengths consistent with that of the new value of PathDelays.

```c1 = rayleighchan(1e-5,130) % Create object.
c1.PathDelays = [0 1e-6]    % Change the number of delays.
% MATLAB automatically changes the size of c1.AvgPathGaindB,
% c1.PathGains, and c1.ChannelFilterDelay.```

The output below displays all the properties of the channel object before and after the change in the value of the PathDelays property. In the second listing of properties, the AvgPathGaindB, PathGains, and ChannelFilterDelay properties all have different values compared to the first listing of properties.

```c1 =

ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
PathGains: 0.2035 + 0.1014i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0

c1 =

ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 130
PathDelays: [0 1.0000e-006]
AvgPathGaindB: [0 0]
NormalizePathGains: 1
StoreHistory: 0
PathGains: [0.6108 - 0.4688i 0.1639 - 0.0027i]
ChannelFilterDelay: 4
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
```

expand all

### Algorithms

The methodology used to simulate fading channels is described in Methodology for Simulating Multipath Fading Channels:. The properties of the channel object are related to the quantities of the latter section as follows:

• The InputSamplePeriod property contains the value of ${T}_{s}$.

• The PathDelays vector property contains the values of $\left\{{\tau }_{k}\right\}$, where $1\le k\le K$.

• The PathGains read-only property contains the values of $\left\{{a}_{k}\right\}$, where $1\le k\le K$.

• The AvgPathGaindB vector property contains the values of $10{\mathrm{log}}_{10}\left\{E\left[{|{a}_{k}|}^{2}\right]\right\}$, where $1\le k\le K$, and $E\left[\cdot \right]$ denotes statistical expectation.

• The ChannelFilterDelay read-only property contains the value of ${N}_{1}$.

## References

[1] Jeruchim, Michel C., Philip Balaban, and K. Sam Shanmugan, Simulation of Communication Systems, Second Edition, New York, Kluwer Academic/Plenum, 2000.