✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

⛄ 内容介绍

本文提出的一种基于瑞利衰减信道的仿真模型,并用Matlab对该模型的统计量进行了仿真.该仿真模型对所有的正弦波采用了随机初始相位和有条件的随机多谱勒频率.经理论计算与仿真表明:该模型的统计量与理论值非常接近,而且能被直接用来产生频率选择性多径不相关衰弱波形.

⛄ 完整代码

%------------------------ Programme 3.1------------------------------------
% Simulation l'関anouissement du Rayleigh
% pour diff閞entes vitesses de MSi
% cr閑r par B.Belgacem
%--------------------------------------------------------------------------
clear all;
close all;
clc;
rand('state',0);
%% Simulation parameters:
%--------------------------------------|-------------------------------|
% Notation & value | Parameters |
%--------------------------------------|-------------------------------|
K = 03;% | number of users |
M = 64;% | number of chip per symbol |
B = 2560/M;% | number of symbol per slot |
tram = B*15*20;% | numbre of trame |
Rb = (2560/M)/(10e-3/15);%| bit rate |
Rc = Rb*M; %| chip rate |
v = [5 30 100] %|
%--------------------------------------|-------------------------------|
% generate a Rayleigh channel
[Ch_Rf_Des,Ch_Rf,Ch_Rf_a]= Gen_Channel(2,K,tram,B,M,v);
%-----------------------------------------------------------------------
%% Plot les r閟ultats
%-----------------------------------------------------------------------
figure;
plot(10*log10(abs(Ch_Rf(1,:))),'--r');
hold on
plot(10*log10(abs(Ch_Rf(2,:))),'-b');
legend('$V=05 Km/h \to f_D=8.33 Hz$','$V=30 Km/h \to f_D=167 Hz$',4);
set(legend,'Interpreter','latex','Location','SouthEast');
ylabel('Amplitude (dB)','Interpreter','latex');
xlabel('temps $*16.66\mu s$','Interpreter','latex');
axis ([0 12001 -22 7])
grid;
%------------------------------------
hold off
figure;
plot(10*log10(abs(Ch_Rf(1,:))),'--r');
hold on
plot(10*log10(abs(Ch_Rf(3,:))),'-b');
legend('$V=05 Km/h \to f_D=8.33 Hz$','$V=100 Km/h \to f_D=167 Hz$',4);
set(legend,'Interpreter','latex','Location','SouthEast');
ylabel('Amplitude (dB)','Interpreter','latex');
xlabel('temps $*16.66\mu s$','Interpreter','latex');
axis ([0 12001 -22 7])
grid
function Rf=Gen_Rayleigh_Ch(NofSym,M,Speed)
%% Rayleigh Fading Simulator as the Jakes?method
Rc = 3.84e6;
Rb = Rc/M;
fD = Doppler(Speed);
%==========================================================================
% fading g閚閞ation
N = 34;
M = (N-2)/4;
xc = zeros(NofSym,1);
xs = zeros(NofSym,1);
t = 0:(NofSym-1);
t = t'/(Rb)+ 5000/Rb; %randint(1,1,NofSym)+100/Rb;;%
%------------------------
B0 = pi/4;
a0 = sqrt(2)*cos(B0);
b0 = sqrt(2)*sin(B0);
w0 = 2*pi*fD;
%------------------------
xc = a0.*cos(w0*t);
xs = b0.*cos(w0*t);
%------------------------
phi = 0;
for n = 1:M
%------------------------
Bn = n*pi/M;
an = 2*cos(Bn);
bn = 2*sin(Bn);
wn = w0*cos((2*pi*n)/N);
%------------------------
xc = xc + an.*cos(wn*t);
xs = xs + bn.*cos(wn*t);
end;
Rf = (xc +1i.*xs).*(2/sqrt(N));
Rf = Rf.' ;
% figure;
% plot(t,10*log10(abs(Rf)));grid;
%==========================================================================
function FD = Doppler(v)
c = 3e8; % is the speed of light (m/s).
f = 1.8e9;
v_ms = v.*(1000/3600);
FD = v_ms*f/c;
%==========================================================================
function [Ch_Rf_Des,Ch_Rf,Ch_Rf_a]=Gen_Channel(mode,Nbr_usager,Long_Message,Long_Slot,PG,v)

% Cr閑 le 07/10/2010 par B.Belgacem

%/------------------- D閎ut fonction -----------------------\%


switch mode

case {1}

Ch_Rf_Des = ones(Nbr_usager,Long_Message*PG) ;

Ch_Rf = ones(Nbr_usager,Long_Message) ;

Ch_Rf_a = ones(Nbr_usager,Long_Message/Long_Slot );

case {2}

Ch_Rf_Des = zeros(Nbr_usager,Long_Message*PG) ;

Ch_Rf = zeros(Nbr_usager,Long_Message) ;

Ch_Rf_a = zeros(Nbr_usager,Long_Message/Long_Slot );

%--------------------------------

for i=1:Nbr_usager
Ch_Rf(i,:) = Gen_Rayleigh_Ch(Long_Message,PG,v(i));

end
y=1;

for j=1:Long_Message,

for p=1:PG,
Ch_Rf_Des(:,y) = Ch_Rf(:,j);

y=y+1;

end


end

y=1;
for i=1:Long_Message/Long_Slot

for j=1:Long_Slot

Ch_Rf_a(:,i) = Ch_Rf_a(:,i)+Ch_Rf(:,y);

y=y+1;

end

end

Ch_Rf_a = 1/Long_Slot*Ch_Rf_a;

end;

⛄ 运行结果

基于Matlab模拟瑞利衰落_图像处理

基于Matlab模拟瑞利衰落_图像处理_02

⛄ 参考文献

[1]蔡莉莉, 王进华. 基于Matlab的独立瑞利衰落模型的仿真[J]. 江西通信科技, 2008(2):4

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料