You are on page 1of 6

Please make sure you include these:

In wireless communication, multipath propagation occurs unlike that in wired, where only
one path exists.
This leads to constructive and destructive interferences.
The destructive interferences cause fading.
When magnitudes of different signals arriving at the receiver have a distribution resembling
that of a Rayleigh distribution it is known as Rayleigh Fading.
When one of the signals dominate over others, Rician fading occurs.

The rayleighchan and ricianchan functions create fading channel objects.


1)

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

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

% Plot power of faded signal, versus sample number.


plot(20*log10(abs(y)))

3)
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 = comm.DBPSKModulator;

% Create a DPSK modulator

hDemod = comm.DBPSKDemodulator;

% Create a DPSK demodulator

tx = randi([0 M-1],50000,1);

% Generate a random bit stream

dpskSig = step(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);
berVec = zeros(3, numSNR);

% Create an AWGNChannel and ErrorRate calculator System object


hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio (SNR)');
hErrorCalc = comm.ErrorRate;

for n = 1:numSNR
hChan.SNR = SNR(n);
rxSig = step(hChan,fadedSig);
rx = step(hDemod, rxSig);

% Add Gaussian noise

% Demodulate

reset(hErrorCalc)
% Compute error rate.
berVec(:,n) = step(hErrorCalc,tx,rx);
end
BER = berVec(1,:);
% 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');

4)

commmultipathfading

The above code can be used to visualize the qpsk multipath fading and the different factors
mentioned:
a) Impulse response
b) Frequency response
c) Multipath fading components
d) Multipath gain
e) Doppler spectrum
f) Scattering function