Tải bản đầy đủ (.doc) (19 trang)

BÁO CÁO THÍ NGHIỆM THÔNG TIN VÔ TUYẾN

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (395.81 KB, 19 trang )

Trường Đại Học Bách Khoa Hà Nội
Khoa Điện Tử - Viễn Thông
====o0o====

BÁO CÁO THÍ NGHIỆM
THÔNG TIN VÔ TUYẾN
Mã số môn học
: 17853
Số học tín chỉ
: 3TC
Họ và tên sinh viên : Phạm Thị Thu Sinh
MSSV
: 20072433
Lớp
: Điện tử 5 – K52


Báo cáo thí nghiệm Thông tin vô tuyến
HÀ NỘI – 11/2010
Bài số 1: MÔ PHỎNG KÊNH RAYLEIGH THEO PHƯƠNG PHÁP RICE
Mô phỏng kênh vô tuyến theo phương pháp RICE:
Phương pháp Rice được hiểu là phương pháp mô hình các quá trình xác suốt sử
dụng các hàm tuần hoàn,tuy nhiên các tham số như chu kì dao động pha và biên
độ được xác định trước.Đối với phương pháp Monte Carlo thì các tham số này
được xác định ngẫu nhiên.
1.1 Tính các thông số

θi ,n = 2π

f m =91;


Biết
i

n

n
N i +1

Ci ,n =

;

b=1; N1 =9 ;

π
1
2b
( n − )]
; fi ,n = f m sin[
2Ni
2
Ni

N 2 =10;

fi ,n ( Hz )

Ci ,n

θi ,n ( rad )


1
1

1
2

0.1385
0.4155

0.47
0.47

0.6283
1.2566

1
1
1

3
4
5

0.6926
0.9696
1.2467

0.47
0.47

0.47

1.8849
2.5132
3.1415

1
1
1
1

6
7
8
9

1.5237
1.8007
2.0778
2.3558

0.47
0.47
0.47
0.47

3.7699
4.3982
5.0265
5.6548


2
2
2

1
2
3

0.1247
0.3742
0.6236

0.44
0.44
0.44

0.5711
1.1423
1.7135

2
2
2
2

4
5
6
7


0.8731
1.1226
1.3720
1.6215

0.44
0.44
0.44
0.44

0.2077
0.2596
0.3115
0.3634

2
2
2

8
9
10

1.8709
2.1204
2.3698

0.44
0.44

0.44

0.4154
0.4673
0.5192

SVTH: Phạm Thị Thu Sinh 20072433

Page 2


Báo cáo thí nghiệm Thông tin vô tuyến

1.2 Thiết lập hàm matlab tính g% i (t ) với i=1,2.Sử dụng
các biến đầu vào

θi ,n , Ci ,n , fi ,n và t như

%==============================
% a function which creates the deterministic
% process g(t)
%==============================
function y=g(c,f,th,t)
y=zeros(size(t));
for n=1:length(f);
y=y+c(n)*cos(2*pi*f(n).*t=th(n));
end;

1.3 Viết hàm matlab đưa ra biên độ kênh α% (t ) =| g% (t ) |=| g%1 (t ) + jg% 2 (t ) | và vẽ hàm
α% dB (t ) = 20 log α% (t ) . Sử dụng θi ,n , Ci ,n , fi ,n và N i lấy từ bảng.Thời gian mô

phỏng là Tsim = 0.4 s và tần số lấy mẫu f X = 270.8 Khz
Code:
%============================
% Calculation of simulation parameters
%============================
clear
f_m=91; %Maximual Doppler frequency
b=1;
%Variance of in_phase or quadrature component
N1=9; %Number of sinusoids for the in_phase component
N2=10; %Number of sinusoids for the in_ quadrature component
for n=1:1:N1;
c1(n)=sqrt(2*b/N1);
f1(n)=f_m*sin(pi*(n-0.5)/(2*N1));
th1(n)=2*pi*n/(N1+1);
end
for n=1:1:N2;
c2(n)=sqrt(2*b/N2);
f2(n)=f_m*sin(pi*(n-0.5)/(2*N2));
th2(n)=2*pi*n/(N2+1);
end
save ex4p1_Res f1 f2 c1 c2 th1 th2
%=================================
% Create a deterministic process by rice method
%=================================
clear;
load ex4p1_Res f1 f2 c1 c2 th1 th2
SVTH: Phạm Thị Thu Sinh 20072433

Page 3



Báo cáo thí nghiệm Thông tin vô tuyến
f_s=270800; %the carrier frequency in Hertz
T_sim=0.4; %simulation time in seconds
t=0:1/f_s:T_sim; %discrete time interval
g1=g(c1,f1,th1,t);%generation of process g1 by using the function"g.m"
g2=g(c2,f2,th2,t);
g=g1+j*g2;
alpha=abs(g);
alpha_dB=20*log10(alpha);
plot(t,alpha_dB);
title('The channel amplitube in dB');
xlabel('\alpha(t)');
legend('\alpha(t)in dB',0);

Result:

1.4 Tạo hàm g%1 (t ), g% (t ), α% (t ) với tần số lấy mẫu f s =50Khz thời gian Tsim =20s
Code:
SVTH: Phạm Thị Thu Sinh 20072433

Page 4


Báo cáo thí nghiệm Thông tin vô tuyến
%================================
% bai 4.1
%================================
clear

f_m=91;
b=1;
N1=9;
N2=10;
for n=1:1:N1;
c1(n)=sqrt(2*b/N1);
f1(n)=f_m*sin(pi*(n-0.5)/(2*N1));
th1(n)=2*pi*n/(N1+1);
end
for n=1:1:N2;
c2(n)=sqrt(2*b/N2);
f2(n)=f_m*sin(pi*(n-0.5)/(2*N2));
th2(n)=2*pi*n/(N2+1);
end
save ex4p1_Res f1 f2 c1 c2 th1 th2
%==============================================
%Comparison of theoretical Gaussian and Rayleigh
% distribution with simulation results
%==============================================
clear;
load ex4p1_Res f1 f2 c1 c2 th1 th2
f_s=50000; %the carrier frequency inhertz
T_sim=20; %simulation time in seconds
t=0:1/f_s:T_sim;
g1=g(c1,f1,th1,t);
g2=g(c2,f2,th2,t);
g=g1+j*g2;
alpha=abs(g);
g_mean=mean(g);
g_variance=var(g);

g1_mean=mean(g1);
g1_variance=var(g1);
alpha_mean=mean(alpha);
alpha_variance=var(alpha);
n=length(alpha);
x=0:0.1:3; % the time interval in seconds
b=hist(alpha,x);
figure(1);
stem(x,b/n/(x(2)-x(1)));
hold on;
SVTH: Phạm Thị Thu Sinh 20072433

Page 5


Báo cáo thí nghiệm Thông tin vô tuyến
k=0; % the rice factor k'=s^2/2b_0
ohm_p=2; % the total received power
p_alpha=(2.*x.*(k+1)/ohm_p).*exp(-k-((k+1).*x.^2/ohm_p)).*besseli(0,
(2.*x.*sqrt(k*(k+1)/ohm_p)));
plot(x,p_alpha,'r');
title('The PDF of alpha(x)');
xlabel('x');
ylabel('P_{\alpha}(x)');
legend('p_{\alpha}(x)','Rayleigh distribution(Theory)');
hold off;
figure(2);
n1=length(g1);
x1=-4:0.1:4; % the time interval in seconds
c=hist(g1,x1);

stem(x1,c/n1/(x1(2)-x1(1)));
hold on;
p=(1/sqrt(2*pi))*exp(-x1.^2/2);
=[]\rtplot(x1,p,'r');
title('The PDF of g1 process');
xlabel('x');
ylabel('P_{g1}(x)');
legend('p_{g1}(x)','Gaussian distribution(Theory)');
hold off;

Result:

SVTH: Phạm Thị Thu Sinh 20072433

Page 6


Báo cáo thí nghiệm Thông tin vô tuyến

Rayleigh distribution(Theory and result obtained by the channel simulator

SVTH: Phạm Thị Thu Sinh 20072433

Page 7


Báo cáo thí nghiệm Thông tin vô tuyến
Gaussian distribution(Theory and result obtained by the channel simulator)
Bài số 2:MÔ PHỎNG KÊNH FADINH PHÂN TẬP ĐA ĐƯỜNG
THEO PHƯƠNG PHÁP MONTE CARLO

2.1
Mô hình kênh phân tập đa đường với bề rộng băng tần của hệ thống
B=1.25MHz.So sánh hàm truyền đạt của kênh cho các trường hợp tần số
f D ,max = 0.0 Hz , f D ,max = 5.0 Hz , f D ,max = 500.0 Hz ,

Code:
%=================================================================
=========
%MonteCarlo methode for a time-variant channel modelling
%=================================================================
=========
function [h,t_next]
=MCM_channel_model(u,initial_time,number_of_summations,symbol_duration,f_dmax,chan
nel_coefficients);
%u is a random variable which is used to transform ro discrete Doppler
%frequencies,discrete phase
%number_of_summation is the number of discrete frequensy or
%phase used by montecarlo methode
%symbol+duration is the duration of a symbol.In the single carrier
%system,this is the sampling interval
%f_fmax is the maximum Doppler frequency
%channel profile
t=initial_time; %initial time at which the channel is observed
Channel_Length=length(channel_coefficients); % channel impulse response length
h_vector=[]; %a vector of the modelled CIR
for k=1:Channel_Length;
u_k=u(k,:);
%A random variable for the path k
phi=2*pi*u_k;
%Discrete Doppler frequencies for Monte Carlo methode

f_d=f_dmax*sin(2*pi*u_k);
h_tem=channel_coefficients(k)*1/
(sqrt(number_of_summations))*sum(exp(j*phi).*exp(j*pi*f_d*t));
h_vector=[h_vector,h_tem];
end;
h=h_vector;
t_next=initial_time+symbol_duration;
%Coherence time the next symbol
end
SVTH: Phạm Thị Thu Sinh 20072433

Page 8


Báo cáo thí nghiệm Thông tin vô tuyến
%=================================================================
=========
%Main program of Monte Carlo method
%=================================================================
=========
clear all;
%set paramters
NFFT=64;
%FFT length
t_a=8.0000e-007;
%sampling interval the banwidth of the channel is 1/t_a
T_S=NFFT*t_a;
%Duration of observed window
number_of_summations=40;
%Number of summations for Monte Carlo method

f_dmax=500.0;
%Maximum Doppler frequency
channel_profile=[1.0000,0.8487,0.7663,0.7880,0.6658,0.6658,0.5174,0.0543,0.0456];
%channel profile
rho=channel_profile;
N_P=length(rho);
%channel impulse response length
u=rand(N_P,number_of_summations);
%Generation of random variable for N_P paths
initial_time=1.1;
%initial_time
h=[];
%CIR vector
H=[];
%CTF vector
for i= 1:100;
h_i=MCM_channel_model(u,initial_time,number_of_summations,T_S,f_dmax,rho);
%CIR coefficients
h_i_tem=[h_i,zeros(1,NFFT-N_P)];
H_i_tem=fft(h_i_tem);
%CTF coefficients
H_i=[H_i_tem(NFFT/2+1:NFFT),H_i_tem(1:NFFT/2)];
%Rearrange for plotting
initial_time=initial_time+T_S;
%observed the channek in the next time window
h=[h;h_i];
SVTH: Phạm Thị Thu Sinh 20072433

Page 9



Báo cáo thí nghiệm Thông tin vô tuyến
H=[H;H_i];
end;
%plot the CIR
figure(1);
mesh(abs(h))
xlabel('\tau in 8.0e-7s')
ylabel('t in 1.024e-0.4s')
zlabel('h(\tau,t)')
title('Doppler frequency 5.0Hz')
%plot the CTF
figure(2);
mesh(abs(H))
xlabel('f in 9.7KHz')
%9.7 KHz is the frequncy spacing and is B/NFFT
ylabel('t in 1.024e-0.4s')
zlabel('H(f,t)')
title('f_{D,max}=500.0Hz')

Result:

Hàm truyền đạt của kênh không phụ thuộc thời gian(time-invariant channel)

SVTH: Phạm Thị Thu Sinh 20072433

Page 10


Báo cáo thí nghiệm Thông tin vô tuyến


Hàm truyền đạt của kênh biến thiên chậm theo thời gian (slowly time-variant
channel)

SVTH: Phạm Thị Thu Sinh 20072433

Page 11


Báo cáo thí nghiệm Thông tin vô tuyến
Hàm truyền đạt của kênh biến thiên nhanh theo thời gian(fast time variant channel)
2.2
So sánh hàm tự tương quan thời gian của kênh cho 2 trường hợp f D ,max =9.0Hz
và f D ,max =90.0Hz
Code:
%=================================================================
=========
%chuong trinh uoc luong ham tu tuong tuong quan thoi gian cua kenh
%=================================================================
=========
clear all;
NFFT=64;
t_a=8.0000e-007;
T_S=NFFT*t_a;
number_of_summations=40;
f_dmax=90.0;
channel_profile=[1.0000,0.8487,0.7663,0.7880,0.6658,0.5644,0.5174,0.0543,0.0465];
rho=channel_profile;
N_P=length(rho);
u=rand(N_P,number_of_summations);

T_S=NFFT*t_a;
NofSymbol=1000;
t=0.1;
H_sequence=[];
for i=0:NofSymbol-1;
[h]=MCM_channel_model(u,t,number_of_summations,T_S,f_dmax,rho);
h_extended=[h,zeros(1,NFFT-length(h))];
H=fft(h_extended);
H_f1=H(3);
H_sequence=[H_sequence,H_f1];
t=t+T_S;
end;
time_autoc=xcorr(H_sequence,'coeff');
tau=-(NofSymbol-1)*T_S:T_S:(NofSymbol-1)*T_S;
plot(tau,real(time_autoc),'k.');
xlabel('\Delta t in seconds');
ylabel('TIme correlation function R(\Delta t)');
legend('f_{D,max}=9.0Hz','f_{D,max}=90.0Hz');
hold on;

Result:

SVTH: Phạm Thị Thu Sinh 20072433

Page 12


Báo cáo thí nghiệm Thông tin vô tuyến

Bài số 3: MÔ PHỎNG HỆ THỐNG OFDM QUA KÊNH VÔ TUYẾN

3.1
Mô phỏng hệ thống đa sóng mang tần trực giao (OFDM) sử dụng các thông số
lấy chuản HyperLan/2 :
 Băng tần hệ thống B=20Mhz
 Khoảng thời gian lấy mẫu Ts =1/B=50ns
 Độ dài FFT:N=64
 Khoảng bảo vệ G=9(mẫu)
Lược đồ điều chế tất cả các sóng mang là 16-QAM.Kênh là kênh biến thiên theo
thời gian mô tả sơ lược về kênh đa đường rời rạc p[k].Vẽ đồ thị SER(tỉ lệ kí
hiệu lỗi)của hệ thống đa đường trên và cho SNR=0,1,…,25dB
Code:
function [y] = OFDM_Modulator(data,NFFT,G)
chnr=length(data);
N=NFFT;
x=[data,zeros(1,NFFT-chnr)]; %Zero padding
SVTH: Phạm Thị Thu Sinh 20072433

Page 13


Báo cáo thí nghiệm Thông tin vô tuyến
a=ifft(x);%fft
y=[a(NFFT-G+1:NFFT),a];%insert the gaurd interval
end
function [y] = OFDM_Demodulation(data,chnr,NFFT,G)
%insert gaurd interval
x_remove_gaurd_interval=[data(G+1:NFFT+G)];
x=fft(x_remove_gaurd_interval);
y=x(1:chnr);%Zero removing
end

%=============================
%Main function
%============================
clear all;
NFFT=64; %NFFT length
G=9;
%Guard interval
M_ary=16; %Multilevel of M-ary symbol
t_a=50*10^(-9);%Samping duration of HyperLAN/2
channel_profile=[1.0000,0.8487,0.7663,0.7880,0.6658,0.5644,0.5174,0.0543,0.0465];
rho=channel_profile;
%load rho.am -ascii; %load discrete multi-path channel profile
h=sqrt(rho);
H=fft([h,zeros(1,NFFT-N_P)]);
NofOFDMSymbol=100; %Number of OFDM symbols
length_data=(NofOFDMSymbol)*NFFT; %The total data length
%-----------%Source bites
%-----------source_data=randint(length_data,sqrt(M_ary));
%-----------%bit to symbol coder
%-----------symbols=bi2de(source_data);
%-----------%QAM modulator in base band
%-----------QAM_Symbol=dmodce(symbol,1,1,'qam',M_ary);
%-----------%preparing data pattern
%-----------Data_Pattern=[];
for i=0:NofOFDMSymbol-1;
QAM_tem=[];
for n=1:NFFT;
QAM_tem=[QAM_tem,QAM_Symbol(i*NFFT+n)];
end;
Data_Pattern=[Data_Pattern;QAM_tem];

clear QAM_tem;
SVTH: Phạm Thị Thu Sinh 20072433

Page 14


Báo cáo thí nghiệm Thông tin vô tuyến
end;
ser=[];%set the counter of symbol error ratio to be a emty vector
snr_min=0;
snr_max=25;
step=1;
for snr=snr_min:step:snr_max;
snr=snr-10*log10((NFFT-G)/NFFT);%Miss matching effect
rs_frame=[];%A matrix of receive signal
for i=0:NofOFDMSymbol-1;
%OFDM modulator
OFDM_signal_tem=OFDM_Modulator(Data_Pattern(i+1,:),NFFT,G);
%The recieve signal over multi-path channel is creted by a
%convolution operation
rs=conv(OFDM_signal_tem,h);
%Additive noise is added
rs=awgn(rs,snr,'measured','dB');
rs_frame=[rs_frame;rs];
clear OFDM_signal_tem;
end;
%-----------------%receive
%-----------------Receiver_Data=[];%Prepare a matrix for received data symbols
d=[];%Demodulated symbols
data_symbol=[];

for i=1:NofOFDMSymbol;
if(N_P>G+1)&(i>1)
previous_symbol=rs_frame(i-1,:);
ISI_term=previuos_symbol(NFFT+2*G+1:NFFT+G+N_P-1);
ISI=[ISI_term,zeros(1,length(previuos_symbol)-length(ISI_term))];
rs_i=rs_frame(i,:)+ISI;
else
rs_i=rs_frame(i,:);
end;
%---------------------%OFDM demodulator
%----------------------Demodulated_signal_i=OFDM_Demodulator(rs_i,NFFT,NFFT,G);
%-----------------------%OFDM Equalization
%------------------------d=Demodulated_signal_i./H;
demodulated_symbol_i=ddemodce(d,1,1,'QAM',M_ary);
data_symbol=[data_symbol,demodulated_symbol_i];
end;
data_symbol=data_symbol';
%caculation of error symbols
[number,ratio]=symerr(symbols,data_symbol);
ser=[ser,ratio];
end;
SVTH: Phạm Thị Thu Sinh 20072433

Page 15


Báo cáo thí nghiệm Thông tin vô tuyến
snr=snr_min:step:snr_max;
semilogy(snr,ser,'bo');
ylabel('SER');

xlabel('SNR in dB');

Result:

SER of an OFDM system over a multi-path channel
3.2
Các thông số của hệ thống OFDM được lựa chọn ở bài 8.1 ngoại trừ khoảng
bảo vệ được đặt là o mẫu.Kênh không phụ thuộc thời gian.Vẽ SER của hệ thống
và so sánh kết quả nhận được từ 3.1
Code :
G=0;
%Guard interval
channel_profile=[1.0000,0.6095,0.4945,0.3940,0.2371,0.1900,0.1159,0.0699,0.0462];

Result:

SVTH: Phạm Thị Thu Sinh 20072433

Page 16


Báo cáo thí nghiệm Thông tin vô tuyến

Comparision of SER of an OFDM system with and without guard interval
8.3
Code:
clear all;
NFFT=64;
G=9;
M_ary=16;

t_a=50*10^(-9);
channel_profile=[1.0000,0.8487,0.7663,0.7880,0.6658,0.6658,0.5174,0.0543,0.0465];
rho=channel_profile;
N_P=length(rho);
%-----------------------%parameters for MonteCarlo channel
%---------------------------------symbol_duration=NFFT*t_a;
number_of_summations=40;
f_dmax=50.0;
NofOFDMSymbol=1000;
length_data=(NofOFDMSymbol)*NFFT;
%--------------------%Source
%--------------------source_data=randint(length_data,sqrt(M_ary));
%-----------------%bit to symbol coder
SVTH: Phạm Thị Thu Sinh 20072433

Page 17


Báo cáo thí nghiệm Thông tin vô tuyến
%--------------------symbols=bi2de(source_data);
%--------------%QAM modulator in base band
%---------------------\
QAM_Symbol=dmodce(symbols,1,1,'qam',M_ary);
%-----------%preparing data pattern
%-----------Data_Pattern=[];
for i=0:NofOFDMSymbol-1;
QAM_tem=[];
for n=1:NFFT;
QAM_tem=[QAM_tem,QAM_Symbol(i*NFFT+n)];
end;

Data_Pattern=[Data_Pattern;QAM_tem];
clear QAM_tem;
end;
Number_Relz=50;
ser_relz=[];
for number_of_relialization=1:Number_Relz;
u=rand(N_P,number_of_summations);
ser=[];
snr_min=0;
snr_max=25;
step=1;
for snr=snr_min:step:snr_max;
snr=snr-10*log10((NFFT-G)/NFFT);
rs_frame=[];
h_frame=[];
initial_time=0;
for i=0:NofOFDMSymbol-1;
OFDM_signal_tem=OFDM_Modulator(Data_Pattern(i+1,:),NFFT,G);
[h,t]=MCM_channel_model(u,initial_time,number_of_summations,symbol_duration,f_dmax,
rho);
h_frame=[h_frame;h];
rs=conv(OFDM_signal_tem,h);
rs=awgn(rs,snr,'measured','dB');
rs_frame=[rs_frame;rs];
initial_time=t;
clear OFDM_signal_tem;
end;
%---------%Receive
%-----------Reciver_Data=[];
d=[];

data_symbol=[];
for i=1:NofOFDMSymbol;
SVTH: Phạm Thị Thu Sinh 20072433

Page 18


Báo cáo thí nghiệm Thông tin vô tuyến
if(N_P>G+1)&(i>1)
previous_symbol=rs_frame(i-1,:);
ISI_term=previous_symbol(NFFT+2*G+1:NFFT+G+N_P-1);
ISI=[ISI_term,zeros(1,length(previous_symbol)-length(ISI_term))];
rs_i=rs_frame(i,:)+ISI;
else
rs_i=rs_frame(i,:);
end;
%----------------------%OFDM demodulator
%----------------------Demodulated_signal_i=OFDM_Demodulator(rs_i,NFFT,NFFT,G);
%------------%OFDM Equalize
%--------------h=h_frame(i,:);
H=fft([h,zeros(1,NFFT-N_P)]);
d=Demodulated_signal_i./H;
demodulated_symbol_i=ddemodce(d,1,1,'QAM',M_ary);
data_symbol=[data_symbol,demodulated_symbol_i];
end;
data_symbol=data_symbol';
[number,ratio]=symerr(symbols,data_symbol);
ser=[ser,ratio];
end;
ser_relz=[ser_relz;ser];

end;
ser=sum(ser_relz)/Number_Relz;
snr=snr_min:step:snr_max;
semilogy(snr,ser,'bo');
ylabel('SER');
xlabel('SNR in dB');
legend('Time-invariant channel, f_{D,max}=50.0Hz');
hold on;

SVTH: Phạm Thị Thu Sinh 20072433

Page 19



×