LEACH matlab实现

  • Tian1
    了解作者
  • matlab
    开发工具
  • 6.1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 5 积分
    下载积分
  • 0
    下载次数
  • 2022-05-25 22:50
    上传日期
leach协议,是无线传感网动态分簇路由算法,提出了无线路由能耗均衡的思想
leach.zip
  • leach.doc
    49.5KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/628e6ed7e014212d4a89e9ea/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/628e6ed7e014212d4a89e9ea/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">NodeNums = 100; % the num of node </div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">AreaR = 100 ; % the area of simulate</div><div class="t m0 x1 h3 y4 ff1 fs0 fc0 sc0 ls0 ws0">NodeTranR=10; % the transit Radius</div><div class="t m0 x1 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0">Elec=50 * 10^(-9); %</div><div class="t m0 x1 h3 y6 ff1 fs0 fc0 sc0 ls0 ws0">Eamp=100*10^(-12); </div><div class="t m0 x1 h3 y7 ff1 fs0 fc0 sc0 ls0 ws0">Bx=50; % The Postion of Baseation</div><div class="t m0 x1 h3 y8 ff1 fs0 fc0 sc0 ls0 ws0">By=175;</div><div class="t m0 x1 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0">MaxInteral =700; % the leach simulate time</div><div class="t m0 x1 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">Pch=0.05; % the desired percentage of cluster heads </div><div class="t m0 x1 h3 yb ff1 fs0 fc0 sc0 ls0 ws0">InitEn=0.5; % the init energy of a<span class="_ _0"></span>ll node</div><div class="t m0 x1 h3 yc ff1 fs0 fc0 sc0 ls0 ws0">Tr=30; </div><div class="t m0 x1 h3 yd ff1 fs0 fc0 sc0 ls0 ws0"> TDMA=100;</div><div class="t m0 x1 h3 ye ff1 fs0 fc0 sc0 ls0 ws0">Kbit=2000; % the bits of a node transmiting a<span class="_ _0"></span> packet every time</div><div class="t m0 x1 h3 yf ff1 fs0 fc0 sc0 ls0 ws0">BandWitch = 1*10.^(6); % Channel Bandwitch</div><div class="t m0 x1 h3 y10 ff1 fs0 fc0 sc0 ls0 ws0">TOS_LOCAL_ADDRESS = 0; </div><div class="t m0 x1 h3 y11 ff1 fs0 fc0 sc0 ls0 ws0">for i=1:(MaxInteral)</div><div class="t m0 x1 h3 y12 ff1 fs0 fc0 sc0 ls0 ws0"> AliveNode(i)=NodeNums;</div><div class="t m0 x1 h3 y13 ff1 fs0 fc0 sc0 ls0 ws0"> AmountData(i)=0;</div><div class="t m0 x1 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">end</div><div class="t m0 x1 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">sym alldata;</div><div class="t m0 x1 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">alldata=0;</div><div class="t m0 x1 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">LAECH = zeros(1,MaxInteral);</div><div class="t m0 x1 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0">LAENO = zeros(1,MaxInteral); </div><div class="t m0 x1 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0">for i=1:1:NodeNums </div><div class="t m0 x1 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0"> EnNode(i)=InitEn; % the init <span class="_ _0"></span>energy of all node</div><div class="t m0 x1 h3 y1b ff1 fs0 fc0 sc0 ls0 ws0"> StateNode(i)=1; % the State of<span class="_ _0"></span> all node 1: alive 0:dead</div><div class="t m0 x1 h3 y1c ff1 fs0 fc0 sc0 ls0 ws0"> ClusterHeads(i)=0; % the Set of Cluster Head ,1:<span class="_ _0"></span> cluster head </div><div class="t m0 x1 h3 y1d ff1 fs0 fc0 sc0 ls0 ws0">0 :node</div><div class="t m0 x1 h3 y1e ff1 fs0 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h3 y1f ff1 fs0 fc0 sc0 ls0 ws0"> Rounds=0; % the round</div><div class="t m0 x1 h3 y20 ff1 fs0 fc0 sc0 ls0 ws0">end</div><div class="t m0 x1 h3 y21 ff1 fs0 fc0 sc0 ls0 ws0">Threshold=0; % the threshold of <span class="_ _0"></span>node becoming a cluster-head</div><div class="t m0 x1 h3 y22 ff1 fs0 fc0 sc0 ls0 ws0"> Node.x=AreaR*rand(1,NodeNums); % the position of node<span class="_ _0"></span> </div><div class="t m0 x1 h3 y23 ff1 fs0 fc0 sc0 ls0 ws0"> Node.y=AreaR*rand(1,NodeNums);</div><div class="t m0 x1 h3 y24 ff1 fs0 fc0 sc0 ls0 ws0"> Node.c=zeros(1,NodeNums);</div><div class="t m0 x1 h3 y25 ff1 fs0 fc0 sc0 ls0 ws0"> Node.d=zeros(1,NodeNums);</div><div class="t m0 x1 h3 y26 ff1 fs0 fc0 sc0 ls0 ws0"> Node.l=zeros(1,NodeNums);</div><div class="t m0 x1 h3 y27 ff1 fs0 fc0 sc0 ls0 ws0"> Node.csize=zeros(1,NodeNums);</div><div class="t m0 x1 h3 y28 ff1 fs0 fc0 sc0 ls0 ws0"> Node.initclEn=zeros(1,NodeNums);</div><div class="t m0 x1 h3 y29 ff1 fs0 fc0 sc0 ls0 ws0">% for i=1:NodeNums</div><div class="t m0 x1 h3 y2a ff1 fs0 fc0 sc0 ls0 ws0">% Node.c(i)=0; <span class="_ _0"></span> % the Cluster head of node </div><div class="t m0 x1 h3 y2b ff1 fs0 fc0 sc0 ls0 ws0">% Node.d(i)=0; <span class="_ _0"></span> % the distance between cluster <span class="_ _0"></span>head </div><div class="t m0 x1 h3 y2c ff1 fs0 fc0 sc0 ls0 ws0">and node</div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div> </body> </html>
评论
    相关推荐
    • Matlab合集
      冈萨雷斯数字图像处理MATLAB版.中文版+数字图像处理第二版中文版(冈萨雷斯)+MATLAB-R2014a完全自学一本通+MATLAB R2016a完全自学一本通 素材文件+[模式识别与智能计算:MATLAB技术实现(第2版)].杨淑莹.扫描版
    • MATLAB教程
      MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程
    • MATLAB
      MATLAB 该项目是在matlab上完成的,涉及创建和移动宇宙飞船和机器人。 太空飞船和机器人是使用Matlab中的简单几何形状创建的,并通过连续变换矩阵进行移动。 这个项目教我如何使用变换矩阵(旋转,平移等)的概念...
    • MATLAB基础
      一本学习matlab的一本好书
    • MATLAB编译器
      基于MATLAB 2018b版本介绍MATLAB编译器。介绍如何利用编译器将MATLAB代码编译为独立应用程序或组件,并在没有安装MATLAB的计算机上进行部署。
    • matlabruntime
      通过奇点容器运行您的matlab项目 可以在没有MATLAB的容器中运行matlab代码。 为此,我们首先需要通过Matlab编译器在本地构建相应的Matlab代码的独立应用程序,然后使用具有Matlab运行时( 的容器)运行该应用程序 )...
    • matlab实现
      matlab实现 matlab实现matlab实现matlab实现matlab实现
    • matlab 教程
      matlab 信号处理资料,里面包含信号处理pdf文档,一些杂乱的程序和命令等
    • matlab教程
      matlab教程,PPT格式,包含 matlab基本知识、matlab入门、matlab作图、线性规划、无约束优化、非线性规划、统计工具箱、差值、微分方程等多项知识点,并且每个知识点独立成为PPT,内还含有matlab信号处理详解等文档...
    • matlab简介
      1.MATLAB 开发环境 1.1 MATLAB 的视窗环境 进入MATLAB之后,会看到一个视窗MATLAB Command Window称为指令视窗,它是你键入指令的地方同时 MATLAB也将计算结果显示在此。 1.2 简易计算 我们先从MATLAB的...