You are on page 1of 22

Miniproject-MRC602 2010

Mobile Radio Communications 602 (11333 v.4)


(Semester 2, 2010)

Objective

In this laboratory, we use Matlab to simulate a multipath radio channel characterised by


Rayleigh fading and estimate effects of velocity on a fading channel.

Background

For most channels, where signal propagate in the atmosphere and near the ground, the
free-space propagation model is inadequate to describe the channel’s behaviour and predict
system performance. In wireless system, s signal can travel from transmitter to receiver over
multiple reflective paths. This phenomenon, called multipath fading, can cause fluctuations in
the received signal’s amplitude, phase, and angle of arrival, giving rise to the terminology
multipath fading. Another name, scintillation, is used to describe the fading caused by
physical changes in the propagating medium, such as variations in the electron density of the
ionosphere layers that reflect high frequency radio signals. Both fading and scintillation refer
to a signal’s random fluctuations.

The terms slow and fast fading refer to the rate at which the magnitude and phase change
imposed by the channel on the signal changes. The coherence time is a measure of the
minimum time required for the magnitude change of the channel to become uncorrelated
from its previous value.

 Slow fading arises when the coherence time of the channel is large relative to the
delay constraint of the channel. In this regime, the amplitude and phase change imposed
by the channel can be considered roughly constant over the period of use. Slow fading can

Duy Khanh Pham Page 1


Miniproject-MRC602 2010
be caused by events such as shadowing, where a large obstruction such as a hill or large
building obscures the main signal path between the transmitter and the receiver. The
amplitude change caused by shadowing is often modeled using a log-normal distribution
with a standard deviation according to the log-distance path loss model.

 Fast fading occurs when the coherence time of the channel is small relative to the
delay constraint of the channel. In this regime, the amplitude and phase change imposed
by the channel varies considerably over the period of use.

In a fast-fading channel, the transmitter may take advantage of the variations in the
channel conditions using time diversity to help increase robustness of the communication to a
temporary deep fade. Although a deep fade may temporarily erase some of the information
transmitted, use of an error-correcting code coupled with successfully transmitted bits during
other time instances (interleaving) can allow for the erased bits to be recovered. In a slow-
fading channel, it is not possible to use time diversity because the transmitter sees only a
single realization of the channel within its delay constraint. A deep fade therefore lasts the
entire duration of transmission and cannot be mitigated using coding.

The coherence time of the channel is related to a quantity known as the Doppler spread of
the channel. When a user (or reflectors in its environment) is moving, the user's velocity
causes a shift in the frequency of the signal transmitted along each signal path. This
phenomenon is known as the Doppler shift. Signals travelling along different paths can have
different Doppler shifts, corresponding to different rates of change in phase. The difference in
Doppler shifts between different signal components contributing to a single fading channel
tap is known as the Doppler spread. Channels with a large Doppler spread have signal
components that are each changing independently in phase over time. Since fading depends
on whether signal components add constructively or destructively, such channels have a very
short coherence time.

As the carrier frequency of a signal is varied, the magnitude of the change in amplitude
will vary. The coherence bandwidth measures the separation in frequency after which two
signals will experience uncorrelated fading.

 In flat fading, the coherence bandwidth of the channel is larger than the bandwidth of
the signal. Therefore, all frequency components of the signal will experience the same
magnitude of fading.
 In frequency-selective fading, the coherence bandwidth of the channel is smaller than
the bandwidth of the signal.

Since different frequency components of the signal are affected independently, it is highly
unlikely that all parts of the signal will be simultaneously affected by a deep fade. Certain
modulation schemes such as OFDM and CDMA are well-suited to employing frequency
diversity to provide robustness to fading. OFDM divides the wideband signal into many
slowly modulated narrowband subcarriers, each exposed to flat fading rather than frequency
selective fading. This can be combated by means of error coding, simple equalization or
adaptive bit loading. Inter-symbol interference is avoided by introducing a guard interval
between the symbols. CDMA uses the Rake receiver to deal with each echo separately.

Duy Khanh Pham Page 2


Miniproject-MRC602 2010
Result & Calculation

Task 1

Plot a graph of the CDF against the signal level in dB relative to the RMS value. Show
that the fading envelope fluctuates over a range from –30 dB to 10 dB with a probability of
99.9 %.

Figure1

From the graph, the CDF fluctuates from -30dB to 10dB increasing gradually with
probability 99.99%.

Task2

A mobile station operating with a carrier frequency of 900 MHz is traveling at 54 km/hr.
Plot a graph of the ratio of LCR to maximum Doppler shift against the signal level in dB
relative to its rms value. Show that the maximum LCR occurs at ρ = -3dB with a value of
about 48 per second.

Duy Khanh Pham Page 3


Miniproject-MRC602 2010

Figure2

According to the curve, we see that the ratio has the value 48 per second at p = -3dB. This
mean that the rate at the particular level R crossed in positive direction is 48 per second at
threshold -3dB.

Task3

Plot a graph of the product of AFD and maximum Doppler shift against the signal level in
dB relative to the rms value. Show that the ADF is around 8 ms for ρ = -3dB.

Figure3

Duy Khanh Pham Page 4


Miniproject-MRC602 2010
We observe that AFD is zero second up to the initial signal level (around -13dB) but
increase rapidly when the signal level is greater than 5 dB. From Figure3, (AFD*fd) is
around 0.3667 seconds at signal level p = -3dB. In this case, we use v = 54km/hr, c = 3*10^8
m/s, fc = 900 Mhz => fd = v * fc / c = 45 m/s. Therefore, we get AFD is 0.3667 / 45 =
0.00815 seconds at p = -3dB that agrees to theoretical value (8ms).

Task 4

Figure4

This figure shows the Filter coefficients varying in signal level over N points. When k = 0,
the output Fk is zero then increasing gradually from k = 1, and reach a peak 3dB at k = km
then falls down to zero from (km+1) to (N-km-1). The output get a peak again at (N-km) then
goes down to zero. This is because of the following equation we use to generate Fk:

Duy Khanh Pham Page 5


Miniproject-MRC602 2010

Next we plot the amplitude fading sequence Y[n]

Figure5

From the result, we can see the amplitude of Y signal fluctuates from 0 to 3dB. The
average amplitude is around 1dB.

Duy Khanh Pham Page 6


Miniproject-MRC602 2010

Figure6

Figure6 show the phase distortion of Y sequence. We observe that the phase distortion
varies from -3dB to 3dB. This range is almost constant during N points. Now we plot the
empirical Probablity density function (PDF) and its’ theoretical one (blue line) in the same
graph.

Figure7

Duy Khanh Pham Page 7


Miniproject-MRC602 2010
The PDF increases gradually from 0dB to the maximum 0.85dB then drops down to zero.

Compare to theory, the empirical PDF is a bit fluctuation which depends on the min and
max of Y amplitude. However, the average value is close to theoretical one.

Figure8

Figure8 shows empirical PDF versus theoretical PDF of phase distortion Y signal. We can
see that the theoretical PDF of Y is straight line with constant value 0.16dB from range of
-3dB to 3dB whereas the empirical PDF varies from 0.02dB to 0.37dB. However, it could be
0.15db in average which is close to theory.

This section we find the empirical LCR and AFD for the amplitude fading sequence Y.

Figure9 below shows the empirical and theoretical is not match together from -30dB to
0dB. However, they get the same peak 45dB at -3dB.

Duy Khanh Pham Page 8


Miniproject-MRC602 2010

Figure9

Next we plot the theoretical and practical AFD of Y amplitude signal

Figure10

From the figure above, we see that two lines are match from -40dB to 5dB. After that, the
practical AFD increases rapidly to reach a peak 65dB at 10 dB on X axis while the empirical
AFD stays at the level 5 dB.

Duy Khanh Pham Page 9


Miniproject-MRC602 2010
For v =5km/hr

Figure11

Figure11 shows the Filter coefficients. The difference between two cases is that the gap
between two peaks is bigger and the maximum value is 1.7dB compare to the peak in
previous case just 3dB.

Figure12

We see that the amplitude variation between each period is not as dense as the one in case
velocity 50km/hr.

Duy Khanh Pham Page 10


Miniproject-MRC602 2010

Figure13

Although the phase distortion is distinctive compare to last case but it steel has the same
value, varies from -3dB to 3 dB and almost constant over rang of N points.

Figure14

From figure14, the empirical PDF is not close to theoretical PDF like in case v = 50km/hr.
It is more fluctuated.

Duy Khanh Pham Page 11


Miniproject-MRC602 2010

Figure15

For the phase distortion, we observe that the empirical PDF varies randomly.

Figure16

There are big gaps between empirical PDF and practical PDF for LCR. We can say the
matching between them in the first case as much better than this case. Moreover, from the
graph, the peak of LCR in this case is just 4.5 dB compare to 45dB in case v = 50km/hr.

Duy Khanh Pham Page 12


Miniproject-MRC602 2010

Figure17

From figure17, the empirical AFD is almost zero all time while the practical AFD is stable
at zero dB from -40dB to 5dB then increase rapidly up to 650dB (65 when v = 50km/hr).

After changing the velocity from 50km/hr to 5km/hr, the Doppler frequency is reduced 10
times as fd = (v * fc / c).

LRC equation:

AFD equation:

According to these equations, when fd reduces 10 times, it causes LRC decreases 10 times
and AFD increases 10 times as well.

Duy Khanh Pham Page 13


Miniproject-MRC602 2010
Discussion

Task1: Because Rayleigh fading is an example of flat fading, the received signal varies in
amplitude but the spectrum of the transmitted signal is preserved, therefore we get the fading
envelope fluctuates from a range from -30dB to 10dB with a probability of 99.99%.

Task2: As we know, LCR is defined by the expected rate crossed a particular level R in a
upward direction. Fading signal crossing in negative direction is not counted as they do not
carry any information. For example, on task 2 we get LCR is 48/sec at p = -3dB. That means
the level R is crossed at rate of 48 per second.

Task3: This task we learn about average fading duration AFD. We look for the fad
duration corresponding to -3dB level. In this case, we get the duration for which the fading
level is below level R is 8 msec.

Task4: We write a computer program in Matlab, to simulate the complex channel gain of the
Rayleigh fading channel as shown in Figure below:

We implement the IDFT block using the inverse fast Fourier transform (IFFT) algorithm.
Firstly, we generate the filter coefficient. Then signals A and B are obtained by Gaussian
sequences. Y signal is verified by checking its mean = zero and variance = 0.5. According to
definitions of LCR and AFD, LCR is set when (Y_amp(j))<=R(i)&&(Y_amp(j+1))>R(i)while
AFD is set when (Y_amp(j))<=R(i).

Conclusion

After finishing this laboratory, we can say that Rayleigh distribution is a close
approximation to flat fading. In specific, we consider the relationship between the Doppler
frequency with LCR and AFD. All depends on velocity of mobile receiver.

Duy Khanh Pham Page 14


Miniproject-MRC602 2010
Matlab code

% Task 1:
clc
clear all;
RdB = -30 : 0.1 : 10;
R = 10.^(RdB/20);

Pr = 1 - exp(-R.^2);
plot(RdB,Pr,'r');
xlabel('Signal level in dB');
ylabel('CDF');

% Task 2
clc
clear all;
RdB = -30 : 0.1 : 10;
R = 10.^(RdB/20);
c = 3*10^8;
fc = 900*10^6;
v = 54*10^3/3600;
fd = v*fc/c;

NR = sqrt(2*pi)*fd*R.*exp(-R.^2);
plot(RdB,NR,'r');
xlabel('signal level in dB');
ylabel('Level crossing rate');

% Task 3

clc
clear all;
RdB = -30 : 0.1 : 10;
R = 10.^(RdB/20);
c = 3*10^8;
fc = 900*10^6;
v = 54*10^3/3600;
fd = v*fc/c;

Tr = (exp(R.^2)-1)./(sqrt(2*pi)*fd*R);
plot (RdB, Tr*fd,'r');
xlabel('signal level in dB');
ylabel('The product of AFD and maximum Doppler shift');

% Task4
% For v = 50km/hr;

clear all;
clc;
b = 4797;

Duy Khanh Pham Page 15


Miniproject-MRC602 2010
u = 6925;
v = 50*10^3/3600;
fc = 900*10^6;
c = 3*10^8;
Ts = 10^-3;
N = 2^12;
n = 2^18;
fd = v*fc/c;
fm = fd*Ts;
km = floor(fm*N);
X1(1) = 4;
X2(1) = 8;
for m = 1 : (N-1);
X1(m+1) = mod((b*X1(m) + u),(n));
X2(m+1) = mod((b*X2(m) + u),(n));
end
% Generate real strings for A & B (/n to make the value inside log less than 1)
A = sqrt(-2*log(X1/n)).*cos(2*pi*X2/n);
B = sqrt(-2*log(X1/n)).*sin(2*pi*X2/n);

% Fk
F(1) = 0;
for k = 2 : km;
F(k) = sqrt(1/(2*sqrt(1-(k/(km+1))^2)));
end
F(km+1) = sqrt((km+1)/2*(pi/2 -atan(km/sqrt(2*km+1))));
for k = (km+2) : N - km;
F(k) = 0;
end
F(N - km +1) = sqrt((km+1)/2*(pi/2 -atan(km/sqrt(2*km+1))));
for k = (N - km +2) : N;
F(k) = sqrt(1/(2*sqrt(1-((N-k)/(km+1))^2)));
end
figure(1);
plot(F,'r');
Xlabel('N points');
Ylabel('dB');
title('Plotting F');

ZI = A.*F;
ZQ = B.*F;
Zk = ZI - j.*ZQ;
Z = ifft(Zk);
Z_real = real(Z);
Z_img = imag(Z);

sigma_y = sqrt(sum(F.^2)/(N^2));
Y = Z./(sigma_y*sqrt(2));
Y_real = real(Y);

Duy Khanh Pham Page 16


Miniproject-MRC602 2010
Y_img = imag(Y);
Y_amp = sqrt((Y_real.^2)+(Y_img.^2));
Y_phase = atan2(Y_img,Y_real);

figure(2);
plot(Y_amp,'g');
Xlabel('N points');
Ylabel('The amplitude fading sequence Y in dB');
title('Plotting amplitude of Y');

figure(3);
plot(Y_phase,'b');
Xlabel('N points');
Ylabel('The phase distortion of sequence Y in dB');
title('Plotting phase of Y');

bins = 500;

Y_amp = reshape(Y_amp, numel(Y_amp),1);


if isreal (Y_amp),
Y_amp = abs(Y_amp);
end
minY_amp = min(Y_amp);
maxY_amp = max(Y_amp);

if minY_amp == maxY_amp
plot(minY_amp,1);
else
step = (maxY_amp - minY_amp)/(bins-1);
binc = minY_amp : step : maxY_amp;
hist_amp = hist(Y_amp,bins);
pdf_amp = (hist_amp*bins)/(N*(maxY_amp-minY_amp));
end
figure(4);
plot(binc,pdf_amp,'r');
xlabel('Amplitude range of Y_amp');
ylabel('dB');
hold on

% Theory
sigma_theo = 0.5;
pdf_amp_theo = (binc/sigma_theo).*exp((-binc.^2)/(2*sigma_theo));
plot(binc,pdf_amp_theo);
xlabel('Amplitude range of Y_amp');
ylabel('dB');
hold off

% Plotting empirical pdf phase


step = (max(Y_phase) - min(Y_phase))/(bins-1);
binc = min(Y_phase) : step : max(Y_phase);

Duy Khanh Pham Page 17


Miniproject-MRC602 2010
hist_phase = hist((Y_phase),bins);
pdf_phase = (hist_phase*bins)/(N*(max(Y_phase)-min(Y_phase)));
figure(5);
plot(binc,pdf_phase,'r');
xlabel('Phase range of Y_phase');
ylabel('dB');
hold on

% Theory
pdf_phase_theo = 1/(2*pi);
plot(binc, pdf_phase_theo);
hold off

% % % AFD & LCR


xdB = -30:1:10;
r = 10.^(xdB./20);
Rrms = sqrt(mean(Y_amp).^2);
R = min(Y_amp):0.01:max(Y_amp); % R = Rrms.*r;
avg_AFD1 = zeros(1,length(R));
LCR_count=zeros(1,length(R));
uii = zeros(1,length(Y_amp));
for i = 1:length(R)
for j= 1:1:(length(Y_amp)-1)
if((Y_amp(j))<=R(i))&&(Y_amp(j+1))>R(i)
LCR_count(i) = LCR_count(i)+1;
end
end
end
for i = 1:length(R)
for j= 1:1:(length(Y_amp)-1)
if(Y_amp(j))<=R(i)
avg_AFD1(i) = avg_AFD1(i)+1;
end
end
end
avg_AFD = avg_AFD1*Ts./(LCR_count);

% % % Plotting theory LCR


Nr = sqrt(2*pi)*fd*r.*exp(-r.^2);
figure(6);
plot(xdB,Nr,'g');
xlabel('time period')
ylabel('LRC')
hold on

% Pratical LCR
plot(mag2db(R),(LCR_count/(Ts*N)),'r')
hold off

Duy Khanh Pham Page 18


Miniproject-MRC602 2010
% % % Plotting AFD theory
AFD = (exp(r.^2)-1)./(sqrt(2*pi)*fd.*r);
figure(7);
plot (xdB, AFD, 'b');
xlabel('time period')
ylabel('AFD')
hold on

% Practical AFD
plot(mag2db(R),(avg_AFD),'r')
hold off

% For v = 5km/hr

clear all;
clc;
b = 4797;
u = 6925;
v = 5*10^3/3600;
fc = 900*10^6;
c = 3*10^8;
Ts = 10^-3;
N = 2^12;
n = 2^18;
fd = v*fc/c;
fm = fd*Ts;
km = floor(fm*N);
X1(1) = 4;
X2(1) = 8;
for m = 1 : (N-1);
X1(m+1) = mod((b*X1(m) + u),(n));
X2(m+1) = mod((b*X2(m) + u),(n));
end
% Generate real strings for A & B (/n to make the value inside log less than 1)
A = sqrt(-2*log(X1/n)).*cos(2*pi*X2/n);
B = sqrt(-2*log(X1/n)).*sin(2*pi*X2/n);

% Fk
F(1) = 0;
for k = 2 : km;
F(k) = sqrt(1/(2*sqrt(1-(k/(km+1))^2)));
end
F(km+1) = sqrt((km+1)/2*(pi/2 -atan(km/sqrt(2*km+1))));
for k = (km+2) : N - km;
F(k) = 0;
end
F(N - km +1) = sqrt((km+1)/2*(pi/2 -atan(km/sqrt(2*km+1))));

Duy Khanh Pham Page 19


Miniproject-MRC602 2010
for k = (N - km +2) : N;
F(k) = sqrt(1/(2*sqrt(1-((N-k)/(km+1))^2)));
end
figure(1);
plot(F,'r');
Xlabel('N points');
Ylabel('dB');
title('Plotting F');

ZI = A.*F;
ZQ = B.*F;
Zk = ZI - j.*ZQ;
Z = ifft(Zk);
Z_real = real(Z);
Z_img = imag(Z);

sigma_y = sqrt(sum(F.^2)/(N^2));
Y = Z./(sigma_y*sqrt(2));
Y_real = real(Y);
Y_img = imag(Y);
Y_amp = sqrt((Y_real.^2)+(Y_img.^2));
Y_phase = atan2(Y_img,Y_real);

figure(2);
plot(Y_amp,'g');
Xlabel('N points');
Ylabel('The amplitude fading sequence Y in dB');
title('Plotting amplitude of Y');

figure(3);
plot(Y_phase,'b');
Xlabel('N points');
Ylabel('The phase distortion of sequence Y in dB');
title('Plotting phase of Y');

bins = 500;

Y_amp = reshape(Y_amp, numel(Y_amp),1);


if isreal (Y_amp),
Y_amp = abs(Y_amp);
end
minY_amp = min(Y_amp);
maxY_amp = max(Y_amp);

if minY_amp == maxY_amp
plot(minY_amp,1);
else
step = (maxY_amp - minY_amp)/(bins-1);
binc = minY_amp : step : maxY_amp;

Duy Khanh Pham Page 20


Miniproject-MRC602 2010
hist_amp = hist(Y_amp,bins);
pdf_amp = (hist_amp*bins)/(N*(maxY_amp-minY_amp));
end
figure(4);
plot(binc,pdf_amp,'r');
xlabel('Amplitude range of Y_amp');
ylabel('dB');
hold on

% Theory
sigma_theo = 0.5;
pdf_amp_theo = (binc/sigma_theo).*exp((-binc.^2)/(2*sigma_theo));
plot(binc,pdf_amp_theo);
xlabel('Amplitude range of Y_amp');
ylabel('dB');
hold off

% Plotting empirical pdf phase


step = (max(Y_phase) - min(Y_phase))/(bins-1);
binc = min(Y_phase) : step : max(Y_phase);
hist_phase = hist((Y_phase),bins);
pdf_phase = (hist_phase*bins)/(N*(max(Y_phase)-min(Y_phase)));
figure(5);
plot(binc,pdf_phase,'r');
xlabel('Phase range of Y_phase');
ylabel('dB');
hold on

% Theory
pdf_phase_theo = 1/(2*pi);
plot(binc, pdf_phase_theo);
hold off

% % % AFD & LCR


xdB = -30:1:10;
r = 10.^(xdB./20);
Rrms = sqrt(mean(Y_amp).^2);
R = min(Y_amp):0.01:max(Y_amp); % R = Rrms.*r;
avg_AFD1 = zeros(1,length(R));
LCR_count=zeros(1,length(R));
uii = zeros(1,length(Y_amp));
for i = 1:length(R)
for j= 1:1:(length(Y_amp)-1)
if((Y_amp(j))<=R(i))&&(Y_amp(j+1))>R(i)
LCR_count(i) = LCR_count(i)+1;
end
end
end
for i = 1:length(R)

Duy Khanh Pham Page 21


Miniproject-MRC602 2010
for j= 1:1:(length(Y_amp)-1)
if(Y_amp(j))<=R(i)
avg_AFD1(i) = avg_AFD1(i)+1;
end
end
end
avg_AFD = avg_AFD1*Ts./(LCR_count);

% % % Plotting theory LCR


Nr = sqrt(2*pi)*fd*r.*exp(-r.^2);
figure(6);
plot(xdB,Nr,'g');
xlabel('time period')
ylabel('LRC')
hold on

% Pratical LCR
plot(mag2db(R),(LCR_count/(Ts*N)),'r')
hold off

% % % Plotting AFD theory


AFD = (exp(r.^2)-1)./(sqrt(2*pi)*fd.*r);
figure(7);
plot (xdB, AFD, 'b');
xlabel('time period')
ylabel('AFD')
hold on

% Practical AFD
plot(mag2db(R),(avg_AFD),'r')
hold off

Duy Khanh Pham Page 22

You might also like