基于Matlab模拟瑞利衰落

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,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 onplot(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 offfigure;plot(10*log10(abs(Ch_Rf(1,:))),'--r');hold onplot(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?methodRc = 3.84e6;Rb = Rc/M;fD = Doppler(Speed);%==========================================================================% fading g閚閞ationN = 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));endy=1;        for j=1:Long_Message,            for p=1:PG,                Ch_Rf_Des(:,y) = Ch_Rf(:,j);                y=y+1;            endendy=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;

⛄ 运行结果

⛄ 参考文献

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

❤️部分理论引用网络文献,若有侵权联系博主删除

❤️ 关注我领取海量matlab电子书和数学建模资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值