1、通信网实验报告吉大通信院附录:实验一:路径选择实验D算法 :%D算法求V1点到其他各点的最短路径function yy_ddisp(D算法:输入图G的全值矩阵W);d=input(w=); n=length(d);for i=1:n d(i,i)=inf;endtemp=1; path=zeros(n);path(:,1)=ones(n,1);w=d(1,:);w(1)=0; wgt=w;x=1;y=1;for i=1:n a(i)=i;enddisp(置定端集Gp:);for k=1:n-1 min=inf; p=length(temp); q=length(wgt); for i=1:n
2、in1=find(temp=i); for j=1:n in2=find(temp=j); if isempty(in1)&isempty(in2) if wgt(i)wgt(j)+d(j,i) wgt(i)=wgt(j)+d(j,i); end if minwgt(i); x=i; min=wgt(i); end end end end w(x)=wgt(x); temp(p+1)=a(x); for i=1:n if w(x)=w(i)+d(i,x) y=i; end end l=1; while path(y,l)=0 l=l+1; end for i=1:l-1 path(x,i)=p
3、ath(y,i); end path(x,l)=a(x); disp(运算次数k=);disp(k); disp(此次运算得到的Gp:); disp(temp);end disp(V1到其他各点的最短路径及径长:)for i=1:n disp(目的节点i=);disp(i); disp(最短路径:) disp(path(i,:); disp(径长:) disp(w(i); endfigure(1);%hold off;clf;axis(1,10,0,5);for k=1:10 b(1,k)=k;endb(2,:)=rand(1,10)*5;text(1.05,b(2,1)+0.1,v1); t
4、ext(2,b(2,2)+0.1,v2); text(3,b(2,3)+0.1,v3); text(4,b(2,4)+0.1,v4); text(5,b(2,5)+0.1,v5); text(6,b(2,6)+0.1,v6); text(7,b(2,7)+0.1,v7); %text(8,b(2,8)+0.1,v8); %text(9,b(2,9)+0.1,v9); %text(10,b(2,10)+0.1,v10);hold on; for i=2:n idage=path(i,:); c=1; while cw0(i,k)+w0(k,j) w0(i,j)=w0(i,k)+w0(k,j);
5、r0(i,j)=k; end end end for x=1:n r0(x,x)=0; end disp(节点k=);disp(k); disp(作为中间转接点时得到的W和R:) disp(w0); disp(r0);endF算法检验作业时的运行结果:图G的权值矩阵W0w0=0 9 1 3 inf inf ;1 0 4 inf 7 inf ;2 inf 0 inf 1 inf ;inf inf 5 0 2 7 ;inf 6 2 8 0 5 ;7 inf 2 inf 2 0 0 9 1 3 Inf Inf 1 0 4 Inf 7 Inf 2 Inf 0 Inf 1 Inf Inf Inf 5 0
6、 2 7 Inf 6 2 8 0 5 7 Inf 2 Inf 2 0 0 2 3 4 0 0 1 0 3 0 5 0 1 0 0 0 5 0 0 0 3 0 5 6 0 2 3 4 0 6 1 0 3 0 5 0节点k= 1作为中间转接节点时得到的W和R: 0 9 1 3 Inf Inf 1 0 2 4 7 Inf 2 11 0 5 1 Inf Inf Inf 5 0 2 7 Inf 6 2 8 0 5 7 16 2 10 2 0 0 2 3 4 0 0 1 0 1 1 5 0 1 1 0 1 5 0 0 0 3 0 5 6 0 2 3 4 0 6 1 1 3 1 5 0节点k= 2作为中间转
7、接节点时得到的W和R: 0 9 1 3 16 Inf 1 0 2 4 7 Inf 2 11 0 5 1 Inf Inf Inf 5 0 2 7 7 6 2 8 0 5 7 16 2 10 2 0 0 2 3 4 2 0 1 0 1 1 5 0 1 1 0 1 5 0 0 0 3 0 5 6 2 2 3 4 0 6 1 1 3 1 5 0节点k= 3作为中间转接节点时得到的W和R: 0 9 1 3 2 Inf 1 0 2 4 3 Inf 2 11 0 5 1 Inf 7 16 5 0 2 7 4 6 2 7 0 5 4 13 2 7 2 0 0 2 3 4 3 0 1 0 1 1 3 0 1 1
8、 0 1 5 0 3 3 3 0 5 6 3 2 3 3 0 6 3 3 3 3 5 0节点k=4作为中间转接节点时得到的W和R: 0 9 1 3 2 10 1 0 2 4 3 11 2 11 0 5 1 12 7 16 5 0 2 7 4 6 2 7 0 5 4 13 2 7 2 0 0 2 3 4 3 4 1 0 1 1 3 4 1 1 0 1 5 4 3 3 3 0 5 6 3 2 3 3 0 6 3 3 3 3 5 0节点k= 5作为中间转接节点时得到的W和R: 0 8 1 3 2 7 1 0 2 4 3 8 2 7 0 5 1 6 6 8 4 0 2 7 4 6 2 7 0 5 4
9、8 2 7 2 0 0 5 3 4 3 5 1 0 1 1 3 5 1 5 0 1 5 5 5 5 5 0 5 6 3 2 3 3 0 6 3 5 3 3 5 0节点k= 6作为中间转接节点时得到的W和R: 0 8 1 3 2 7 1 0 2 4 3 8 2 7 0 5 1 6 6 8 4 0 2 7 4 6 2 7 0 5 4 8 2 7 2 0 0 5 3 4 3 5 1 0 1 1 3 5 1 5 0 1 5 5 5 5 5 0 5 6 3 2 3 3 0 6 3 5 3 3 5 0附录:实验二:通信业务量分析实验算法:function ErlangB pn=; s=;x=0.1:0.1
10、:100; m=1 2 3 4 5 6 7 8 9 10 15 20 30 35 40 50 60 70 80 90 100; L=length(m);for i=1:L for a=0.1:0.1:100 for k=0:m(i) s=s,a.k/factorial(k); add=sum(s); end pn0=(a.m(i)/factorial(m(i)./add; pn=pn,pn0; s=; end loglog(x,pn); set(gca,Xlim,0.1 100); set(gca,XGrid,on); set(gca,XMinorTick,off); set(gca,XTic
11、k,0.1 1.0 10.0 100); %set(gca,XMinorGrid,off); set(gca,Ylim,0.001 0.1); set(gca,YGrid,on); set(gca,YMinorTick,off); %set(gca,YTick,0.001 0.002 0.005 0.01 0.02 0.05 0.1); %set(gca,YMinorGrid,off); hold on pn=;endxlabel(话务量强度a(erl),fontsize,8);ylabel(呼损率Pc,fontsize,8);hold offgtext(0.002); gtext(0.005
12、);gtext(0.02);gtext(0.05);gtext(m=1,fontsize,15); for i=2:L gtext(m=,fontsize,15); gtext(int2str(m(i),fontsize,15);end 实验运行结果:function ErlangC pc=; s=; m=1 2 3 4 5 6 7 8 9 10 15 20 30 35 40 50 60 70 80 90 100; L=length(m);for i=1:L for a=1:100 if a=m(i) for k=0:(m(i)-1) s=s,a.k/factorial(k); add=sum
13、(s); end pc0=a.m(i)/(a.m(i)+factorial(m(i)*(1-a/m(i)*add); pc=pc,pc0; s=; end end x=1:length(pc); loglog(x,pc); set(gca,XGrid,on); set(gca,XMinorTick,off);set(gca,Xlim,1 100); %set(gca,XTick,0.1 0.2 0.5 1 2 5 10 20 50 100); %set(gca,XMinorGrid,off); set(gca,Ylim,0.01 1); set(gca,YGrid,on); %set(gca,YMinorTick,off); hold on pc=;endxlabel(话务量强度a(erl),fontsize,8);ylabel(呼叫等待概率Pw,fontsize,8);gtext(0.02); gtext(0.05);gtext(0.2);gtext(0.5);gtext(m=1,fontsize,15); for i=2:L gtext(m=,fontsize,15); gtext(int2str(m(i),fontsize,15);end实验运行结果:附录:实验三:Gompertz(龚伯兹)模型实验实验运行结果 实验四:Logistic(罗吉特)模型实验实验运行结果
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1