1 简介
移动Ad hoc网络是近年来网络研究的热点,WSN(Wireless Sensor Networks,无线传感器网络)是传感器研究领域一个新的研究方向.由于它们之间诸多的相似性使得每当提到WSN的时候往往与Ad hoc网络做比较.本文试图通过对Ad hoc网络和WSN网络特点和路由协议的介绍和分析,使这两个领域区别并联系起来.
登录后复制
% main.m% 主程序:对于不同的K,N值作折线图。参数FrameNum为帧的最大个数。clear;FrameNum=7;X=0:1:FrameNum;[F(1,:) Y(1,:)]=Markov(17,20,FrameNum);[F(2,:) Y(2,:)]=Markov(12,20,FrameNum);[F(3,:) Y(3,:)]=Markov(7,20,FrameNum);[F(4,:) Y(4,:)]=Markov(15,15,FrameNum);[F(5,:) Y(5,:)]=Markov(10,15,FrameNum);[F(6,:) Y(6,:)]=Markov(5,15,FrameNum);%仿真和分析画在一起(平均选到时隙的节点数)figure(1);plot(X,Y(1,:),'k-o');hold on;plot(X,simulation(17,20,FrameNum),'k:.');hold on;plot(X,Y(2,:),'k-o');hold on;plot(X,Y(3,:),'k-o');hold on;plot(X,Y(4,:),'k-o');hold on;plot(X,Y(5,:),'k-o');hold on;plot(X,Y(6,:),'k-o');hold on;plot(X,simulation(12,20,FrameNum),'k:.');hold on;plot(X,simulation(7,20,FrameNum),'k:.');hold on;plot(X,simulation(15,15,FrameNum),'k:.');hold on;plot(X,simulation(10,15,FrameNum),'k:.');hold on;plot(X,simulation(5,15,FrameNum),'k:.');xlabel('n(Number of frames)');ylabel('Average number of nodes acquiring a time slot within n frames');legend('Analysis','Simulation',2);grid on;%模型分析图(平均选到时隙的节点数)figure(2)plot(X,Y(1,:),'k-o');hold on;plot(X,Y(2,:),'k-*');hold on;plot(X,Y(3,:),'k-s');hold on;plot(X,Y(4,:),'k-d');hold on;plot(X,Y(5,:),'k-^');hold on;plot(X,Y(6,:),'k-v');hold on;xlabel('n(Number of frames)');ylabel('Average number of nodes acquiring a time slot within n frames');legend('N=20,K=17','N=20,K=12','N=20,K=7','N=15,K=15','N=15,K=10','N=15,K=5',-1);grid on;%模型分析图(全部节点都选到时隙的概率)figure(3)plot(X,F(1,:),'k-o');hold on;plot(X,F(2,:),'k-*');hold on;plot(X,F(3,:),'k-s');hold on;plot(X,F(4,:),'k-d');hold on;plot(X,F(5,:),'k-^');hold on;plot(X,F(6,:),'k-v');hold on;xlabel('n(Number of frames)');ylabel('\itF^all_n');legend('N=20,K=17','N=20,K=12','N=20,K=7','N=15,K=15','N=15,K=10','N=15,K=5',4);grid on;1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删