Sunteți pe pagina 1din 10

WIRELESS ASSIGNMENT 1

SUBMITTED BY
FEENA TOMS
M140340EC

Q1.a) Develop a program for generating a single tap Rayleigh fading


channel coefficients by using Clarkes or Jakes model and choosing
proper Doppler filters.
b) Develop it to generate multitap Rayleigh fading channel according to
the given power delay profile.
Multipath delay (in microseconds) [0, 0.31, 0.71, 1.09, 1.73, 2.51]
Power in dB [0, -1, -9, -10, -15, -20]

Theory
In mobile radio channels, Rayleigh distribution is used to describe the statistical
time varying nature of the received envelope of a flat fading signal or the
envelope of an individual multipath component. Rayleigh fading is used when the
line of sight component is blocked and received signal consists of only multipath
components. The envelope of the sum of two quadrature Gaussian noise signals
obeys Rayleigh distribution.
The below program is based on Clarkes model and the steps used in simulation
of single tap Rayleigh fading channel are as follows :
1. N is taken as the total number of frequency domain points.
2. Frequency spacing between adjacent spectral lines is taken as df=2*fm/(N1) where fm is the maximum Doppler frequency shift.
3. Generate complex Gaussian random variables for each of the N/2 positive
frequency components of the noise source.
4. Construct negative frequency components of the noise source by
conjugating positive frequency values and assigning there at negative
frequency values.
5. Multiply the in-phase and quadrature noise sources by the fading
spectrum S(f).
6. Perform IFFT on the resulting frequency domain signals from the in-phase
and quadrature arms and add the squares of each signal point in time.
7. Take the square root of the sum obtained in step 6.

In order to develop an n-tap Rayleigh fading channel corresponding to a given


power delay profile, the output of the Rayleigh fading simulator is multiplied by
the amplitude corresponding to a multipath component. This is then convolved
with the input signal with the corresponding delay. This is done for each of the n
multipaths and then their sum is computed to obtain the resultant received
signal.

Code
a)
clear all
close all
N=1024;
%Generating gaussian random variables
x1= randn(1,N/2)+j*randn(1,N/2);
y1= randn(1,N/2)+j*randn(1,N/2);
xc=conj(x1);
yc=conj(y1);
g1=[fliplr(xc) x1];
g2=[fliplr(yc) y1];

%Doppler Filter
fm= 200;
df= 2*fm/(N -1);
T=1/df;
f= -fm:df:fm;
S= zeros(1,N);
S(2:N-1)= 1.5./(pi*fm*((1-(f(2:N-1)/fm).^2).^.5));
S(1)= 2*S(2)-S(3);
%Truncation of pass band edges
S(N)= 2*S(N-1)- S(N-2);
S= S.^(0.5);
%Computing ifft of g1 and g2
x= abs(ifft(g1.*S));
y= abs(ifft(g2.*S));
z=abs(x+j*y);%computing envelope
mu=mean(z)
me=median(z)
%Plotting the CDF and PDF
[c,v]=hist(z,100);
figure(1)
hist(z);
title('Histogram plot of envelope ');
hold on
plot([mu,mu],ylim,'r--','Linewidth',2)
plot([me,me],ylim,'g--','Linewidth',2)
hold off
legend('Histogram','Mean','Median','Mode',1)
f1=(max(v)-min(v))/100;
f=c/(f1*N);
figure(2);

plot(v,f);
title('PDF of envelope');
ylabel('fz(z)')
xlabel('z')
hold on
plot([mu,mu],ylim,'r--','Linewidth',2)
plot([me,me],ylim,'g--','Linewidth',2)
hold off
legend('PDF of Envelope','Mean','Median',1)
figure(3);
cdfplot(z);

Simulation Results

Histogram plot of envelope

250

Histogram
Mean
Median

200

150

100

50

0.002

0.004

0.006

0.008

0.01

0.012

PDF of envelope

350

PDF of Envelope
Mean
Median

300

fz(z)

250
200
150
100
50
0

0.002

0.004

0.006

0.008

0.01

Empirical CDF

1
0.9
0.8
0.7

F(x)

0.6
0.5
0.4
0.3
0.2
0.1
0

0.002

0.004

0.006
x

0.008

0.01

0.012

b)
%Program to generate multitap Rayleigh fading channel
clc;
clear all;
close all;
N=1000;
n=1:N;
delay=[0 31 71 109 173 251];%delay vector
%Generation of complex gaussian random variables
x1= randn(1,N/2)+j*randn(1,N/2);
y1= randn(1,N/2)+j*randn(1,N/2);
xc=conj(x1);
yc=conj(y1);
g1=[fliplr(xc) x1];
g2=[fliplr(yc) y1];
%Doppler Filter
fm= 300;
df= 2*fm/(N -1);
T=1/df;
f= -fm:df:fm;
S= zeros(1,N);
S(2:N-1)= 1.5./(pi*fm*((1-(f(2:N-1)/fm).^2).^.5));
S(1)= 2*S(2)-S(3);
%Truncation of pass band edges
S(N)= 2*S(N-1)- S(N-2);
S= S.^(0.5);
power_db=[0 -1 -9 -10 -15 -20];
power_lin=10.^(power_db./10);
a=power_lin.^0.5 %amplitude vector
%Finding absolute value of ifft of the gaussian variables
x= abs(ifft(g1.*S));
y= abs(ifft(g2.*S));
%Finding the rayleigh envelope
z=(abs(x+j*y));
lz=length(z);
r=zeros(1,2*lz+max(delay)-1);
for j=1:6
for i=0:251
if i==delay(j)
s1=sin(2*pi*(10/N)*(n)); %input signal
u=[stepfun(n,delay(j)),ones(1,delay(j))];
s2=sin(2*pi*(10/N)*(n-delay(j)));
s=[s2,s1(N-delay(j)+1:N)].*u; %delayed version of the input
signal
r1=conv((a(j).*z),s); %taking convolution of delayed version of
signal and amplitude*rayleigh envelope
figure(1)
subplot(6,1,j)
plot(r1) %plotting each multipath component at receiver end
title(['Envelope of multipath component with delay ',
num2str(delay(j)/100), ' microseconds after undergoing Rayleigh fading'])

ylabel('amplitude')
xlabel('time (microseconds)')
%axis([0 2.5e3 -5e-4 5e-4]);
r=r+[r1,zeros(1,length(r)-length(r1))]; %computing sum of all
multipath components
end
end
end
figure(2)
plot(r)
title('Envelope of received signal')
ylabel('Amplitude')
xlabel('Time (microseconds)')
rlog=10*log10(abs(r));
figure(3)
plot(rlog);
title('Envelope of received signal in db')
ylabel('Amplitude in dB')
xlabel('Time (microseconds)')
mu=mean(r)
me=median(r)
%To plot PDF and CDF of the envelope
[c,v]=hist(r,100);
figure(4)
hist(r);
title('Histogram plot of envelope ');
hold on
plot([mu,mu],ylim,'r--','Linewidth',2)
plot([me,me],ylim,'g--','Linewidth',2)
hold off
legend('Histogram','Mean','Median','Mode',1)
f1=(max(v)-min(v))/100;
f=c/(f1*N);
figure(5);
plot(v,f);
title('PDF of envelope');
ylabel('Amplitude')
hold on
plot([mu,mu],ylim,'r--','Linewidth',2)
plot([me,me],ylim,'g--','Linewidth',2)
hold off
legend('PDF of Envelope','Mean','Median',1)
figure(6);
cdfplot(r);

Simulation Results

Envelope of received signal

0.2
0.15
0.1

Amplitude

0.05
0
-0.05
-0.1
-0.15
-0.2

500

1000
1500
Time (microseconds)

2000

2500

2000

2500

Envelope of received signal in db

0
-20

Amplitude in dB

-40
-60
-80
-100
-120
-140
-160
-180

500

1000
1500
Time (microseconds)

Histogram plot of envelope

500

Histogram
Mean
Median

450
400
350
300
250
200
150
100
50
0
-0.2

-0.15

-0.1

-0.05

0.05

0.15

0.2

PDF of envelope

25

PDF of Envelope
Mean
Median

20

Amplitude

0.1

15

10

0
-0.2

-0.15

-0.1

-0.05

0.05

0.1

0.15

0.2

Empirical CDF

1
0.9
0.8
0.7

F(x)

0.6
0.5
0.4
0.3
0.2
0.1
0
-0.2

-0.15

-0.1

-0.05

0
x

0.05

0.1

0.15

0.2

Inferences
The magnitude of a complex Gaussian random variable has Rayleigh distribution.
This can be used for generation of single tap Rayleigh fading channel. This is
developed further by convoluting with delayed versions of input signal to obtain
multitap Rayleigh fading channel.

S-ar putea să vă placă și