Products & Services Solutions Academia Support User Community Company

Learn more about Communications Toolbox   

Fading Channels

Section Overview

Rayleigh and Rician fading channels are useful models of real-world phenomena in wireless communications. These phenomena include multipath scattering effects, time dispersion, and Doppler shifts that arise from relative motion between the transmitter and receiver. This section gives a brief overview of fading channels and describes how to implement them using the toolbox.

Overview of Fading Channels

The figure below depicts direct and major reflected paths between a stationary radio transmitter and a moving receiver. The shaded shapes represent reflectors such as buildings.

The major paths result in the arrival of delayed versions of the signal at the receiver. In addition, the radio signal undergoes scattering on a local scale for each major path. Such local scattering is typically characterized by a large number of reflections by objects near the mobile. These irresolvable components combine at the receiver and give rise to the phenomenon known as multipath fading. Due to this phenomenon, each major path behaves as a discrete fading path. Typically, the fading process is characterized by a Rayleigh distribution for a nonline-of-sight path and a Rician distribution for a line-of-sight path.

The relative motion between the transmitter and receiver causes Doppler shifts. Local scattering typically comes from many angles around the mobile. This scenario causes a range of Doppler shifts, known as the Doppler spectrum. The maximum Doppler shift corresponds to the local scattering components whose direction exactly opposes the mobile's trajectory.

Fading Channel Features of the Toolbox

The toolbox implements a baseband channel model for multipath propagation scenarios that include

Some additional information about typical values for delays and gains is in Choosing Realistic Channel Property Values.

Simulation of Multipath Fading Channels: Methodology

The Rayleigh and Rician multipath fading channel simulators of this toolbox use the band-limited discrete multipath channel model of section 9.1.3.5.2 in [1]. It is assumed that the delay power profile and the Doppler spectrum of the channel are separable [1]. The multipath fading channel is therefore modeled as a linear finite impulse-response (FIR) filter. Let denote the set of samples at the input to the channel. Then the samples at the output of the channel are related to through:

where is the set of tap weights given by:

In the equations above:

Each path gain process is generated by the following steps:

  1. A complex uncorrelated (white) Gaussian process with zero mean and unit variance is generated in discrete time.

  2. The complex Gaussian process is filtered by a Doppler filter with frequency response , where denotes the desired Doppler power spectrum.

  3. The filtered complex Gaussian process is interpolated so that its sample period is consistent with that of the input signal. A combination of linear and polyphase interpolation is used.

  4. The resulting complex process is scaled to obtain the correct average path gain. In the case of a Rayleigh channel, the fading process is obtained as:

    where

    In the case of a Rician channel, the fading process is obtained as:

    where is the Rician K-factor of the k-th path, is the Doppler shift of the line-of-sight component of the k-th path (in Hz), and is the initial phase of the line-of-sight component of the k-th path (in rad).

At the input to the band-limited multipath channel model, the transmitted symbols must be oversampled by a factor at least equal to the bandwidth expansion factor introduced by pulse shaping. For example, if sinc pulse shaping is used, for which the bandwidth of the pulse-shaped signal is equal to the symbol rate, then the bandwidth expansion factor is 1, and, in the ideal case, at least one sample-per-symbol is required at the input to the channel. If a raised cosine (RC) filter with a factor in excess of 1 is used, for which the bandwidth of the pulse-shaped signal is equal to twice the symbol rate, then the bandwidth expansion factor is 2, and, in the ideal case, at least two samples-per-symbol are required at the input to the channel.

References

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

Specifying Fading Channels

This toolbox models a fading channel as a linear FIR filter. Filtering a signal using a fading channel involves these steps:

  1. 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.

  2. 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.

      Note   Setting the maximum path delay greater than 100 samples may generate an ‘Out of memory' error.

  3. 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:

Creating Channel Objects

The rayleighchan and ricianchan functions create fading channel objects. The table below indicates the situations in which each function is suitable.

FunctionObjectSituation Modeled
rayleighchanRayleigh fading channel objectOne or more major reflected paths
ricianchanRician fading channel objectOne 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 to 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.

Viewing Object Properties

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:

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
         DopplerSpectrum: [1x1 doppler.jakes]
         MaxDopplerShift: 130
              PathDelays: 0
           AvgPathGaindB: 0
      NormalizePathGains: 1
            StoreHistory: 0
          StorePathGains: 0
               PathGains: -0.0428 + 0.4732i
      ChannelFilterDelay: 0
    ResetBeforeFiltering: 1
     NumSamplesProcessed: 0

g =

   -0.0428 + 0.4732i

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.

Changing Object Properties

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 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. In the second listing of properties, the ResetBeforeFiltering property has the value 0.

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

Linked Properties of Channel Objects

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.

Specifying the Doppler Spectrum of a Fading Channel

The Doppler spectrum of a channel object is specified through its DopplerSpectrum property. The value of this property must be either:

A Doppler object contains all the properties used to characterize the Doppler spectrum, with the exception of the maximum Doppler shift, which is a property of the channel object. This section describes how to create and manipulate Doppler objects, and how to assign them to the DopplerSpectrum property of channel objects.

Creating Doppler Objects

The sole purpose of Doppler objects is to specify the value of the DopplerSpectrum property of channel objects. Doppler objects can be created using one of seven functions: doppler.ajakes, doppler.bigaussian, doppler.jakes, doppler.rjakes, doppler.flat, doppler.gaussian, and doppler.rounded. For a description of each of these functions and the underlying theory, refer to their corresponding reference pages.

For example, a Gaussian spectrum with a normalized (by the maximum Doppler shift of the channel) standard deviation of 0.1, can be created as:

d = doppler.gaussian(0.1);

Duplicating Doppler Objects

As in the case of channel objects, Doppler objects can be duplicated using the copy function. The command:

d2 = copy(d1);

creates a Doppler object d2 with the same properties as that of d1. d1 and d2 are then separate instances of a Doppler object, in that modifying either one will not affect the other. Using d1 = d2 instead will cause both d1 and d2 to reference the same instance of a Doppler object, in that modifying either one will cause the same modification to the other.

Viewing and Changing Doppler Object Properties

The syntax for viewing and changing Doppler object properties is the same as for the case of channel objects (see Viewing Object Properties and Changing Object Properties). The function disp can be used with Doppler objects to display their properties.

In the following example, a rounded Doppler object with default properties is created and displayed, and the third element of its CoeffRounded property is modified:

dr = doppler.rounded
 
dr =
 
    SpectrumType: 'Rounded'
    CoeffRounded: [1 -1.7200 0.7850]

dr.CoeffRounded(3) = 0.8250
 
dr =
 
    SpectrumType: 'Rounded'
    CoeffRounded: [1 -1.7200 0.8250]

Note that the property SpectrumType, which is common to all Doppler objects, is read-only. It is automatically specified at object construction, and cannot be modified. If you wish to use a different Doppler spectrum type, you need to create a new Doppler object of the desired type.

Using Doppler Objects Within Channel Objects

The DopplerSpectrum property of a channel object can be changed by assigning to it a Doppler object or a vector of Doppler objects. The following example illustrates how to change the default Jakes Doppler spectrum of a constructed Rayleigh channel object to a flat Doppler spectrum:

>> h = rayleighchan(1/9600, 100)
 
h =
 
             ChannelType: 'Rayleigh'
       InputSamplePeriod: 1.0417e-004
         DopplerSpectrum: [1x1 doppler.jakes]
         MaxDopplerShift: 100
              PathDelays: 0
           AvgPathGaindB: 0
      NormalizePathGains: 1
            StoreHistory: 0
          StorePathGains: 0
               PathGains: -0.4007 - 0.2748i
      ChannelFilterDelay: 0
    ResetBeforeFiltering: 1
     NumSamplesProcessed: 0

>> dop_flat = doppler.flat
 
dop_flat =
 
    SpectrumType: 'Flat'

>> h.DopplerSpectrum = dop_flat
 
h =
 
             ChannelType: 'Rayleigh'
       InputSamplePeriod: 1.0417e-004
         DopplerSpectrum: [1x1 doppler.flat]
         MaxDopplerShift: 100
              PathDelays: 0
           AvgPathGaindB: 0
      NormalizePathGains: 1
            StoreHistory: 0
          StorePathGains: 0
               PathGains: -0.4121 - 0.2536i
      ChannelFilterDelay: 0
    ResetBeforeFiltering: 1
     NumSamplesProcessed: 0

The following example shows how to change the default Jakes Doppler spectrum of a constructed Rician channel object to a Gaussian Doppler spectrum with normalized standard deviation of 0.3, and subsequently display the DopplerSpectrum property, and change the value of the normalized standard deviation to 1.1:

>> h = ricianchan(1/9600, 100, 2);
>> h.DopplerSpectrum = doppler.gaussian(0.3)
 
h =
 
               ChannelType: 'Rician'
         InputSamplePeriod: 1.0417e-004
           DopplerSpectrum: [1x1 doppler.gaussian]
           MaxDopplerShift: 100
                PathDelays: 0
             AvgPathGaindB: 0
                   KFactor: 2
    DirectPathDopplerShift: 0
       DirectPathInitPhase: 0
        NormalizePathGains: 1
              StoreHistory: 0
            StorePathGains: 0
                 PathGains: 0.8073 - 0.0769i
        ChannelFilterDelay: 0
      ResetBeforeFiltering: 1
       NumSamplesProcessed: 0

>> h.DopplerSpectrum
 
ans =
 
     SpectrumType: 'Gaussian'
    SigmaGaussian: 0.3000

>> h.DopplerSpectrum.SigmaGaussian = 1.1;

The following example illustrates how to change the default Jakes Doppler spectrum of a constructed three-path Rayleigh channel object to a vector of different Doppler spectra, and then change the properties of the Doppler spectrum of the third path:

>> h = rayleighchan(1/9600, 100, [0 1e-4 2.1e-4]);
>> h.DopplerSpectrum = [doppler.flat doppler.flat doppler.rounded]
 
h =
 
             ChannelType: 'Rayleigh'
       InputSamplePeriod: 1.0417e-004
         DopplerSpectrum: [3x1 doppler.baseclass]
         MaxDopplerShift: 100
              PathDelays: [0 1.0000e-004 2.1000e-004]
           AvgPathGaindB: [0 0 0]
      NormalizePathGains: 1
            StoreHistory: 0
          StorePathGains: 0
               PathGains: [0.4233 - 0.1113i -0.0785 + 0.1667i
                           -0.2064 + 0.3531i]
      ChannelFilterDelay: 3
    ResetBeforeFiltering: 1
     NumSamplesProcessed: 0

>> h.DopplerSpectrum(3).CoeffRounded = [1 -1.21 0.7];

If the DopplerSpectrum property of a channel object is a vector:

Configuring Channel Objects

Before you filter a signal using a channel object, make sure that the properties of the channel have suitable values for the situation you want to model. This section offers some guidelines to help you choose realistic values that are appropriate for your modeling needs. The topics are

The syntaxes for viewing and changing values of properties of channel objects are described in Specifying Fading Channels.

Choosing Realistic Channel Property Values

Here are some tips for choosing property values that describe realistic channels:

Path Delays

Average Path Gains

Maximum Doppler Shifts

K-Factor for Rician Fading Channels

Doppler Spectrum Parameters

Configuring Channel Objects Based on Simulation Needs

Here are some tips for configuring a channel object to customize the filtering process:

Using Fading Channels

After you have created a channel object as described in Specifying Fading Channels, you can use the filter function to pass a signal through the channel. The arguments to filter are the channel object and the signal. At the end of the filtering operation, the channel object retains its state so that you can find out the final path gains or the total number of samples that the channel has processed since it was created or reset. If you configured the channel to avoid resetting its state before each new filtering operation (ResetBeforeFiltering is 0), then the retention of state information is important for maintaining continuity between successive filtering operations.

For an example that illustrates the basic syntax and state retention, see Power of a Faded Signal.

If you want to use the channel visualization tool to plot the characteristics of a channel object, you need to set the StateHistory property of the channel object to 1 so that it is populated with plot information. See Using the Channel Visualization Tool for details.

Compensating for Fading

A communication system involving a fading channel usually requires component(s) that compensate for the fading. Here are some typical approaches:

See Equalizers to learn how to implement equalizers in this toolbox. See the dpskmod reference page or the example in Comparing Empirical Results to Theoretical Results to learn how to implement differential modulation.

Examples Using Fading Channels

The following examples use fading channels:

Power of a Faded Signal

The code below plots a faded signal's power (versus sample number). The code also illustrates the syntax of the filter and rayleighchan functions and the state retention of the channel object. Notice from the output that NumSamplesProcessed equals the number of elements in sig, the signal.

c = rayleighchan(1/10000,100);
sig = 1i*ones(2000,1);  % Generate signal
y = filter(c,sig);      % Pass signal through channel
c                       % Display all properties of the channel

% Plot power of faded signal, versus sample number.
plot(20*log10(abs(y)))

The output and the plot follow.

c =
 
             ChannelType: 'Rayleigh'
       InputSamplePeriod: 1.0000e-004
         DopplerSpectrum: [1x1 doppler.jakes]
         MaxDopplerShift: 100
              PathDelays: 0
           AvgPathGaindB: 0
      NormalizePathGains: 1
            StoreHistory: 0
          StorePathGains: 0
               PathGains:  -0.8062 + 0.2648i
      ChannelFilterDelay: 0
    ResetBeforeFiltering: 1
     NumSamplesProcessed: 2000

Comparing Empirical Results to Theoretical Results

The code below creates a frequency-flat Rayleigh fading channel object and uses it to process a DBPSK signal consisting of a single vector. The example continues by computing the bit error rate of the system for different values of the signal-to-noise ratio. Notice that the example uses filter before awgn; this is the recommended sequence to use when you combine fading with AWGN.

% Create Rayleigh fading channel object.
chan = rayleighchan(1/10000,100);

% Generate data and apply fading channel.
M = 2; % DBPSK modulation order
hMod = modem.dpskmod('M', M);       % Create a DPSK modulator
hDemod = modem.dpskdemod(hMod);     % Create a DPSK demodulator
                                        % using the modulator
tx = randi([0 M-1],50000,1);        % Generate a random bit stream
dpskSig = modulate(hMod, tx);       % DPSK modulate the signal
fadedSig = filter(chan,dpskSig);    % Apply the channel effects

% Compute error rate for different values of SNR.
SNR = 0:2:20; % Range of SNR values, in dB.
numSNR = length(SNR);
BER = zeros(1, numSNR);
for n = 1:numSNR
   rxSig = awgn(fadedSig,SNR(n));   % Add Gaussian noise
   rx = demodulate(hDemod, rxSig);  % Demodulate
   reset(hDemod);
   % Compute error rate.
   [nErrors, BER(n)] = biterr(tx,rx);
end

% Compute theoretical performance results, for comparison.
BERtheory = berfading(SNR,'dpsk',M,1);

% Plot BER results.
semilogy(SNR,BERtheory,'b-',SNR,BER,'r*');
legend('Theoretical BER','Empirical BER');
xlabel('SNR (dB)'); ylabel('BER');
title('Binary DPSK over Rayleigh Fading Channel');

With the parameters in the preceding code, the fading is slow enough to be considered the same across two consecutive samples.

The resulting plot shows that the simulation results are close to the theoretical results computed by berfading.

Working with Delays

The value of a channel object's ChannelFilterDelay property is the number of samples by which the output of the channel lags the input. If you compare the input and output data sets directly, you must take the delay into account by using appropriate truncating or padding operations.

The example illustrates one way to account for the delay before computing a bit error rate.

M = 2;                          % DQPSK modulation order
bitRate = 50000;
hMod = modem.dpskmod('M', M);   % Create a DPSK modulator
hDemod = modem.dpskdemod(hMod); % Create a DPSK demodulator
                                    % using the modulator

% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 0.5/bitRate],[0 -10]);
delay = ch.ChannelFilterDelay;

tx = randi([0 M-1],50000,1);        % Generate random bit stream
dpskSig = modulate(hMod,tx);        % DPSK modulate signal
fadedSig = filter(ch,dpskSig);      % Apply channel effects
rx = demodulate(hDemod,fadedSig);   % Demodulate signal

% Compute bit error rate, taking delay into account.
% Truncate to account for channel delay.
tx_trunc = tx(1:end-delay); rx_trunc = rx(delay+1:end);
[num,ber] = biterr(tx_trunc,rx_trunc) % Bit error rate

The output below shows that the error rate is small. If the example had not compensated for the channel delay, the error rate would have been close to 1/2.

num =

   845


ber =

    0.0170

More Information About Working with Delays.   The discussion in Effect of Delays on Recovery of Convolutionally Interleaved Data describes two typical ways to compensate for delays. Although the discussion there is about interleaving operations instead of channel modeling, the techniques involving truncating and padding data are equally applicable to channel modeling.

Quasi-Static Channel Modeling

Typically, a path gain in a fading channel changes insignificantly over a period of 1/(100fd) seconds, where fd is the maximum Doppler shift. Because this period corresponds to a very large number of bits in many modern wireless data applications, assessing performance over a statistically significant range of fading entails simulating a prohibitively large amount of data. Quasi-static channel modeling provides a more tractable approach, which you can implement using these steps:

  1. Generate a random channel realization using a maximum Doppler shift of 0.

  2. Process some large number of bits.

  3. Compute error statistics.

  4. Repeat these steps many times to produce a distribution of the performance metric.

The example below illustrates the quasi-static channel modeling approach.

M = 4;                          % DQPSK modulation order
hMod = modem.dpskmod('M', M);   % Create a DPSK modulator
hDemod = modem.dpskdemod(hMod); % Create a DPSK demodulator
                                    % using the modulator
numBits = 10000;                % Each trial uses 10000 bits.
numTrials = 20;                 % Number of BER computations

% Note: In reality, numTrials would be a large number
% to get an accurate estimate of outage probabilities
% or packet error rate.
% Use 20 here just to make the example run more quickly.

% Create Rician channel object.
chan = ricianchan;      % Static Rician channel
chan.KFactor = 3;       % Rician K-factor
% Because chan.ResetBeforeFiltering is 1 by default,
% FILTER resets the channel in each trial below.

% Compute error rate once for each independent trial.
for n = 1:numTrials
   tx = randi([0 M-1],numBits,1);       % Generate random bit stream
   dpskSig = modulate(hMod, tx);        % DPSK modulate signal
   fadedSig = filter(chan, dpskSig);    % Apply channel effects
   rxSig = awgn(fadedSig,20);           % Add Gaussian noise.
   rx = demodulate(hDemod,rxSig);       % Demodulate.

   % Compute number of symbol errors.
   % Ignore first sample because of DPSK initial condition.
   nErrors(n) = symerr(tx(2:end),rx(2:end))
end
per = mean(nErrors > 0) % Proportion of packets that had errors

While the example runs, the Command Window displays the growing list of symbol error counts in the vector nErrors. It also displays the packet error rate at the end. The sample output below shows a final value of nErrors and omits intermediate values. Your results might vary because of randomness in the example.

nErrors =

  Columns 1 through 9 

     0     0     0     0     0     0     0     0     0

  Columns 10 through 18 

     0     0     0     0     7     0     0     0     0

  Columns 19 through 20 

     0   216


per =

    0.1000

More About the Quasi-Static Technique.   As an example to show how the quasi-static channel modeling approach can save computation, consider a wireless local area network (LAN) in which the carrier frequency is 2.4 GHz, mobile speed is 1 m/s, and bit rate is 10 Mb/s. The following expression shows that the channel changes insignificantly over 12,500 bits:

A traditional Monte Carlo approach for computing the error rate of this system would entail simulating thousands of times the number of bits shown above, perhaps tens of millions of bits. By contrast, a quasi-static channel modeling approach would simulate a few packets at each of about 100 locations to arrive at a spatial distribution of error rates. From this distribution one could determine, for example, how reliable the communication link is for a random location within the indoor space. If each simulation contains 5,000 bits, 100 simulations would process half a million bits in total. This is substantially fewer bits compared to the traditional Monte Carlo approach.

Filtering Using a Loop

The section Configuring Channel Objects Based on Simulation Needs indicates how to invoke the filter function multiple times while maintaining continuity from one invocation to the next. The example below invokes filter within a loop and uses the small data sets from successive iterations to create an animated effect. The particular channel in this example is a Rayleigh fading channel with two discrete major paths.

% Set up parameters.
M = 4;              % QPSK modulation order
bitRate = 50000;    % Data rate is 50 kb/s
numTrials = 125;    % Number of iterations of loop

% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 2e-5],[0 -9]);
% Indicate that FILTER should not reset the channel
% in each iteration below.
ch.ResetBeforeFiltering = 0;

% Initialize scatter plot.
scatterPlot = commscope.ScatterPlot;

% Apply channel in a loop, maintaining continuity.
% Plot only the current data in each iteration.
for n = 1:numTrials
   tx = randi([0 M-1],500,1);     % Generate random bit stream
   pskSig = pskmod(tx,M);         % PSK modulate signal
   fadedSig = filter(ch, pskSig); % Apply channel effects

   % Plot the new data from this iteration.
   update(scatterPlot,fadedSig);
end

The scatter plot changes with each iteration of the loop, and the exact content varies because the fading process involves random numbers. Following are some snapshots of typical images that the example can produce.

Sample Scatter Plot (a)

Sample Scatter Plot (b)

Storing Channel State History

By default, the PathGains property of a channel object stores the current complex path gain vector.

Setting the StoreHistory property of a channel to true makes it store the last N path gain vectors, where N is the length of the vector processed through the channel. The following code illustrates this property:

h = rayleighchan(1/100000, 130);  % Rayleigh channel
tx = randint(10, 1, 2);           % Random bit stream
dpskSig = dpskmod(tx, 2);         % DPSK signal
h.StoreHistory = true;            % Allow states to be stored
y = filter(h, dpskSig);           % Run signal through channel
h.PathGains                       % Display the stored path gains data

This example generates the following output:

ans =

  -0.0460 - 1.1873i
  -0.0439 - 1.1881i
  -0.0418 - 1.1889i
  -0.0397 - 1.1897i
  -0.0376 - 1.1904i
  -0.0355 - 1.1912i
  -0.0334 - 1.1920i
  -0.0313 - 1.1928i
  -0.0296 - 1.1933i
  -0.0278 - 1.1938i

The last element is the current path gain of the channel.

Setting StoreHistory to true significantly slows down the execution speed of the channel's filter function.

Using the Channel Visualization Tool

Communications Toolbox software provides a plotting function that helps you visualize the characteristics of a fading channel using a GUI. See Fading Channels for a description of fading channels and objects.

To open the channel visualization tool, type plot(h) at the command line, where h is a channel object that contains plot information. To populate a channel object with plot information, run a signal through it after setting its StoreHistory property to true.

For example, the following code opens the channel visualization tool showing a three-path Rayleigh channel through which a random signal is passed:

% Three-Path Rayleigh channel
h = rayleighchan(1/100000, 130, [0 1.5e-5 3.2e-5], [0, -3, -3]);  
tx = randint(500, 1, 2);          % Random bit stream
dpskSig = dpskmod(tx, 2);         % DPSK signal
h.StoreHistory = true;            % Allow states to be stored
y = filter(h, dpskSig);           % Run signal through channel
plot(h);                          % Call Channel Visualization Tool

See Examples of Using the Channel Visualization Tool for the basic usage cases of the channel visualization tool.

This tool can also be accessed from Communications Blockset software.

Parts of the GUI

The Visualization pull-down menu allows you to choose the visualization method. See Visualization Options for details.

The Frame count counter shows the index of the current frame. It shows the number of frames processed by the filter method since the channel object was constructed or reset. A frame is a vector of M elements, interpreted to be M successive samples that are uniformly spaced in time, with a sample period equal to that specified for the channel.

The Sample index slider control indicates which channel snapshot is currently being displayed, while the Pause button pauses a running animation until you click it again. The slider control and Pause button apply to all visualizations except the Doppler Spectrum.

The Animation pull-down menu allows you to select how you want to display the channel snapshots within each frame. Setting this to Slow makes the tool show channel snapshots in succession, starting at the sample set by the Sample index slider control. Selecting Medium or Fast makes the tool show fewer uniformly spaced snapshots, allowing you to go through the channel snapshots more rapidly. Selecting Interframe only (the default selection) prevents automatic animation of snapshots within the same frame. The Animation menu applies to all visualizations except the Doppler Spectrum.

Visualization Options

The channel visualization tool plots the characteristics of a filter in various ways. Simply choose the visualization method from the Visualization menu, and the plot updates itself automatically.

The following visualization methods are currently available:

Impulse Response (IR).   This plot shows the magnitudes of two impulse responses: the multipath response (infinite bandwidth) and the bandlimited channel response.

The multipath response is represented by stems, each corresponding to one multipath component. The component with the smallest delay value is shown in red, and the component with the largest delay value is shown in blue. Components with intermediate delay values are shades between red and blue, becoming more blue for larger delays.

The bandlimited channel response is represented by the green curve. This response is the result of convolving the multipath impulse response, described above, with a sinc pulse of period, T, equal to the input signal's sample period.

The solid green circles represent the channel filter response sampled at rate 1/T. The output of the channel filter is the convolution of the input signal (sampled at rate 1/T) with this discrete-time FIR channel filter response. For computational speed, the response is truncated.

The hollow green circles represent sample values not captured in the channel filter response that is used for processing the input signal.

Note that these impulse responses vary over time. You can use the slider to visualize how the impulse response changes over time for the current frame (i.e., input signal vector over time).

Frequency Response (FR).   This plot shows the magnitude (in dB) of the frequency response of the multipath channel over the signal bandwidth.

As with the impulse response visualization, you can visualize how this frequency response changes over time.

IR Waterfall.   This plot shows the evolution of the magnitude impulse response over time.

It shows 10 snapshots of the bandlimited channel impulse response within the last frame, with the darkest green curve showing the current response.

The time offset is the time of the channel snapshot relative to the current response time.

Phasor Trajectory.   This plot shows phasors (vectors representing magnitude and phase) for each multipath component, using the same color code that was used for the impulse response plot.

The phasors are connected end to end in order of path delay, and the trajectory of the resultant phasor is plotted as a green line. This resultant phasor is referred to as the narrowband phasor.

This plot can be used to determine the impact of the multipath channel on a narrowband signal. A narrowband signal is defined here as having a sample period much greater than the span of delays of the multipath channel (alternatively, a signal bandwidth much smaller than the coherence bandwidth of the channel). Thus, the multipath channel can be represented by a single complex gain, which is the sum of all the multipath component gains. When the narrowband phasor trajectory passes through or near the origin, it corresponds to a deep narrowband fade.

Multipath Components.   This plot shows the magnitudes of the multipath gains over time, using the same color code as that used for the multipath impulse response.

The triangle marker and vertical dashed line represent the start of the current frame. If a frame has been processed previously, its multipath gains may also be displayed.

Multipath Gain.   This plot shows the collective gains for the multipath channel for three signal bandwidths.

A collective gain is the sum of component magnitudes, as explained in the following:

In general, the variability of this multipath gain, or of the signal fading, decreases as signal bandwidth is increased, because multipath components become more resolvable. If the signal bandwidth curve roughly follows the narrowband curve, you might describe the signal as narrowband. If the signal bandwidth curve roughly follows the infinite bandwidth curve, you might describe the signal as wideband. With the right receiver, a wideband signal exploits the path diversity inherent in a multipath channel.

Doppler Spectrum.   This plot shows up to two Doppler spectra.

The first Doppler spectrum, represented by the dashed red line, is a theoretical spectrum based on the Doppler filter response used in the multipath channel model. In the preceding plot, the theoretical Doppler spectrum used for the multipath channel model is known as the Jakes spectrum. Note that the plotted Doppler spectrum is normalized to have a total power of 1. This Doppler spectrum is used to determine a Doppler filter response. For practical purposes, the Doppler filter response is truncated, which has the effect of modifying the Doppler spectrum, as shown in the plot.

The second Doppler spectrum, represented by the blue dots, is determined by measuring the power spectrum of the multipath fading channel as the model generates path gains. This measurement is meaningful only after enough path gains have been generated. The title above the plot reports how many samples need to be processed through the channel before either the first Doppler spectrum or an updated spectrum can be plotted.

The Path Number edit box allows you to visualize the Doppler spectrum of the specified path. The value entered in this box must be a valid path number, i.e., between 1 and the length of the PathDelays vector property. Once you change the value of this field, the new Doppler spectrum will appear as soon as the processing of the current frame has ended.

If the measured Doppler spectrum is a good approximation of the theoretical Doppler spectrum, the multipath channel model has generated enough fading gains to yield a reasonable representation of the channel statistics. For instance, if you want to determine the average BER of a communications link with a multipath channel and you want a statistically accurate measure of this average, you may want to ensure that the channel has processed enough samples to yield at least one Doppler spectrum measurement.

It is possible that a multipath channel (e.g., a Rician channel) can have both specular (line-of-sight) and diffuse components. In such a case, the Doppler spectrum would have both a line component and a wideband component. The channel visualization tool only shows the wideband component for the Doppler spectrum.

Unlike other visualizations, the Doppler spectrum visualization does not support animation. Because there is no intraframe data to plot, the visualization tool only updates the channel statistics at the end of each frame and therefore cannot pause in the middle of a frame. If you switch to the Doppler spectrum visualization from a different visualization that is in pause mode, the Pause button is subsequently disabled. Disabling pause avoids interaction problems between the Doppler spectrum visualization and other animation-style visualizations.

Scattering Function.   This plot shows the Doppler spectra of each path versus the path delays, using the same color code as that used for the multipath impulse response.

The principle of operation of the Scattering Function plot is similar to that of the Doppler Spectrum plot. The main difference is that the Doppler spectra on this plot are not normalized as they are on the Doppler Spectrum plot, in order to better visualize the power delay profile.

Composite Plots.   Several composite plots are also available. These are chosen by selecting the following from the Visualization pull-down menu:

Examples of Using the Channel Visualization Tool

Here are two examples that show how you might interact with the GUI.

Visualizing Samples Within a Frame.   This example shows how to visualize samples within a frame through animation. The following lines of code create a Rayleigh channel and open the channel visualization tool:

% Create a fast fading channel
h = rayleighchan(1e-4, 100, [0 1.1e-4], [0 0]);

h.StoreHistory = 1;          % Allow states to be stored
y = filter(h, ones(100,1));  % Process samples through channel
plot(h);                     % Open channel visualization tool

After selecting a visualization option and a speed in the Animation menu, move the Sample index slider control all the way to the left and click Resume. The slider control moves by itself during animation. The sample index increments automatically to show which snapshot you are visualizing.

You can also move the slider control and glance through the samples of the frame as you like.

Animating Snapshots Across Frames.   This example shows how to animate snapshots across frames. The following lines of code call the filter and plot methods within a loop to accomplish this:

Ts = 1e-4;   % Sample period (s)
fd = 100;    % Maximum Doppler shift

% Path delay and gains
tau = [0.1 1.2 2.3 6.2 11.3]*Ts;  
PdB = linspace(0, -10, length(tau)) - length(tau)/20;

nTrials = 10000;   % Number of trials
N = 100;           % Number of samples per frame

h = rayleighchan(Ts, fd, tau, PdB);  % Create channel object
h.NormalizePathGains = false;
h.ResetBeforeFiltering = false;
h.StoreHistory = 1;
h % Show channel object

% Channel fading simulation
for trial = 1:nTrials
    x = randint(10000, 1, 4);
    dpskSig = dpskmod(x, 4);
    y = filter(h, dpskSig);
    plot(h);
    % The line below returns control to the command line in case
    % the GUI is closed while this program is still running
    if isempty(findobj('name', 'Multipath Channel')), break; end;
end

While the animation is running, you can move the slider control and change the sample index (which also makes the animation pause). After clicking Resume, the plot continues to animate.

The property ResetBeforeFiltering needs to be set to false so that the state information in the channel is not reset after the processing of each frame.

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS