Communications System 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]); hMod = comm.DPSKModulator('ModulationOrder',2); tx = randi([0 1],500,1); % Random bit stream dpskSig = step(hMod,tx); % DPSK signal % 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
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.
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:
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).
As with the impulse response visualization, you can visualize how this frequency response changes 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.
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.
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.
A collective gain is the sum of component magnitudes, as explained in the following:
Narrowband (magenta dots): This is the magnitude of the narrowband phasor in the above trajectory plot. This curve is sometimes referred to as the narrowband fading envelope.
Current signal bandwidth (dashed blue line): This is the sum of the magnitudes of the channel filter impulse response samples (the solid green dots in the impulse response plot). This curve represents the maximum signal energy that can be captured using a RAKE receiver. Its value (or metrics, such as theoretical BER, derived from it) is sometimes referred to as the matched filter bound.
Infinite bandwidth (solid red line): This is the sum of the magnitudes of the multipath component gains.
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.
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.
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.
IR and FR for impulse response and frequency response plots.
Components and Gain for multipath components and multipath gain plots.
Components and IR for multipath components and impulse response plots.
Components, IR, and Phasor for multipath components, impulse response, and phasor trajectory plots.
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.
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 % Initialize DPSK modulator for M=4 hMod = comm.DPSKModulator(4); % 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 = randi([0 3],10000,1); % Random symbols dpskSig = step(hMod, x); % Modulated symbols y = filter(h, dpskSig); % Channel filter plot(h); % Plot channel response % 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.