| Communications Toolbox | ![]() |
This toolbox models a fading channel as a linear FIR filter. Filtering a signal using a fading channel involves these steps:
Create a channel object that describes the channel that you want to use. A channel object is a type of MATLAB variable that contains information about the channel, such as the maximum Doppler shift.
Adjust properties of the channel object, if necessary, to tailor it to your needs. For example, you can change the path delays or average path gains.
Apply the channel object to your signal using the filter function.
This section describes how to define, inspect, and manipulate channel objects. The topics are:
The rayleighchan and ricianchan functions create fading channel objects. The table below indicates the situations in which each function is suitable.
| Function | Object | Situation Modeled |
|---|---|---|
| rayleighchan | Rayleigh fading channel object | One or more major reflected paths |
| ricianchan | Rician fading channel object | One direct line-of-sight path, possibly combined with one or more major reflected paths |
For example, the command below creates a channel object representing a Rayleigh fading channel that acts on a signal sampled at 100,000 Hz. The maximum Doppler shift of the channel is 130 Hz.
c1 = rayleighchan(1/100000,130); % Rayleigh fading channel object
The object c1 is a valid input argument for the filter function. To learn how to use the filter function to filter a signal using a channel object, see Using Fading Channels.
Duplicating and Copying Objects. Another way to create an object is to duplicate an existing object and then adjust the properties of the new object, if necessary. If you do this, it is important that you use a copy command such as
c2 = copy(c1); % Copy c1 to create an independent c2.
instead of c2 = c1. The copy command creates a copy of c1 that is independent of c1. By contrast, the command c2 = c1 creates c2 as merely a reference to c1, so that c1 and c2 always have indistinguishable content.
A channel object has numerous properties that record information about the channel model, about the state of a channel that has already filtered a signal, and about the channel's operation on a future signal. You can view the properties in these ways:
To view all properties of a channel object, enter the object's name in the Command Window.
To view a specific property of a channel object or to assign the property's value to a variable, enter the object's name followed by a dot (period), followed by the name of the property.
In the example below, entering c1 causes MATLAB to display all properties of the channel object c1. Some of the properties have values from the rayleighchan command that created c1, while other properties have default values.
c1 = rayleighchan(1/100000,130); % Create object. c1 % View all properties of c1. g = c1.PathGains % Retrieve the PathGains property of c1.
The output is
c1 =
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
PathGains: 0.2104 - 0.6197i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
g =
0.2104 - 0.6197i
A Rician fading channel object has an additional property that does not appear above, namely, a scalar KFactor property.
For more information about what each channel property means, see the reference page for the rayleighchan or ricianchan function.
To change the value of a writeable property of a channel object, issue an assignment statement that uses dot notation on the channel object. More specifically, dot notation means an expression that consists of the object's name, followed by a dot, followed by the name of the property.
The example below illustrates how to change the ResetBeforeFiltering property, indicating that you do not want to reset the channel before each filtering operation.
c1 = rayleighchan(1/100000,130) % Create object. c1.ResetBeforeFiltering = 0 % Do not reset before filtering.
The output below displays all the properties of the channel object before and after the change in the value of the ResetBeforeFiltering property. Notice that in the second listing of properties, the ResetBeforeFiltering property has the value 0.
c1 =
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
PathGains: 0.2104 - 0.6197i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
c1 =
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
PathGains: 0.2104 - 0.6197i
ChannelFilterDelay: 0
ResetBeforeFiltering: 0
NumSamplesProcessed: 0Note Some properties of a channel object are read-only. For example, you cannot assign a new value to the NumSamplesProcessed property because the channel automatically counts the number of sample it has processed since the last reset. |
Some properties of an channel object are related to each other such that when one property's value changes, another property's value must change in some corresponding way to keep the channel object consistent. For example, if you change the vector length of PathDelays, then the value of AvgPathGaindB must change so that its vector length equals that of the new value of PathDelays. This is because the length of each of the two vectors equals the number of discrete paths of the channel. For details about linked properties and an example, see the reference page for rayleighchan or ricianchan.
| Overview of Fading Channels | Configuring Channel Objects | ![]() |
© 1994-2005 The MathWorks, Inc.