ImageVerifierCode 换一换
格式:DOC , 页数:21 ,大小:704.54KB ,
资源ID:2773319      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/2773319.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(排队论的matlab仿真(包括仿真代码).doc)为本站上传会员【w****g】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

排队论的matlab仿真(包括仿真代码).doc

1、完整版)排队论的matlab仿真(包括仿真代码) Wireless Network Experiment Three: Queuing Theory ABSTRACT This experiment is designed to learn the fundamentals of the queuing theory。 Mainly about the M/M/S and M/M/n/n queuing models. KEY WORDS: queuing theory, M/M/s, M/M/n/n, Erlang B, E

2、rlang C。 INTRODUCTION A queue is a waiting line and queueing theory is the mathematical theory of waiting lines。 More generally, queueing theory is concerned with the mathematical modeling and analysis of systems that provide service to random demands。 In communication networks, queues are e

3、ncountered everywhere。 For example, the incoming data packets are randomly arrived and buffered, waiting for the router to deliver。 Such situation is considered as a queue. A queueing model is an abstract description of such a system。 Typically, a queueing model represents (1) the system's physical

4、configuration, by specifying the number and arrangement of the servers, and (2) the stochastic nature of the demands, by specifying the variability in the arrival process and in the service process. The essence of queueing theory is that it takes into account the randomness of the arrival process

5、and the randomness of the service process。 The most common assumption about the arrival process is that the customer arrivals follow a Poisson process, where the times between arrivals are exponentially distributed. The probability of the exponential distribution function is 。 l Erlang B model O

6、ne of the most important queueing models is the Erlang B model (i.e。, M/M/n/n)。 It assumes that the arrivals follow a Poisson process and have a finite n servers. In Erlang B model, it assumes that the arrival customers are blocked and cleared when all the servers are busy. The blocked probability o

7、f a Erlang B model is given by the famous Erlang B formula, where n is the number of servers and A= is the offered load in Erlangs, is the arrival rate and is the average service time. Formula (1.1) is hard to calculate directly from its right side when n and A are large. However, it is easy to

8、 calculate it using the following iterative scheme: l Erlang C model The Erlang delay model (M/M/n) is similar to Erlang B model, except that now it assumes that the arrival customers are waiting in a queue for a server to become available without considering the length of the queue。 The proba

9、bility of blocking (all the servers are busy) is given by the Erlang C formula, Where if and if 。 The quantity indicates the server utilization. The Erlang C formula (1.3) can be easily calculated by the following iterative scheme where is defined in Eq。(1.1).

10、 DESCRIPTION OF THE EXPERIMENTS 1. Using the formula (1。2), calculate the blocking probability of the Erlang B model。 Draw the relationship of the blocking probability PB(n,A) and offered traffic A with n = 1,2, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100. Compa

11、re it with the table in the text book (P。281, table 10.3)。 From the introduction, we know that when the n and A are large, it is easy to calculate the blocking probability using the formula 1.2 as follows. it use the theory of recursion for the calculation。 But the denomin

12、ator and the numerator of the formula both need to recurs() when doing the matlab calculation, it waste time and reduce the matlab calculation efficient. So we change the formula to be : Then the calculation only need recurs once time and is more efficient. The matlab code for the

13、formula is: erlang_b.m %************************************** % File: erlanb_b.m % A = offered traffic in Erlangs。 % n = number of truncked channels. % Pb is the result blocking probability. %************************************** function [ Pb ] = erlang_b( A,n ) if n==0

14、 Pb=1; % P(0,A)=1 else Pb=1/(1+n/(A*erlang_b(A,n—1))); % use recursion "erlang(A,n—1)" end end As we can see from the table on the text books, it uses the logarithm coordinate, so we also use the logarithm coordinate to plot the result。 We divide the number of servers(n)

15、into three parts, for each part we can define a interval of the traffic intensity(A) based on the figure on the text books : 1. when 0〈n〈10, 0。1〈A〈10. 2。 when 10〈n〈20, 3〈A<20. 3。 when 30

16、igure the logarithm coordinate. The matlab code is : %***************************************** % for the three parts。 % n is the number servers. % A is the traffic indensity。 % P is the blocking probability。 %***************************************** n_1 = [1:2]; A_1 = linspace(0。1,10,50

17、 % 50 points between 0。1 and 10。 n_2 = [10:10:20]; A_2 = linspace(3,20,50); n_3 = [30:10:100]; A_3 = linspace(13,120,50); %***************************************** % for each part, call the erlang_b() function。 %***************************************** for i = 1:length(n_1) fo

18、r j = 1:length(A_1) p_1(j,i) = erlang_b(A_1(j),n_1(i)); end end for i = 1:length(n_2) for j = 1:length(A_2) p_2(j,i) = erlang_b(A_2(j),n_2(i)); end end for i = 1:length(n_3) for j = 1:length(A_3) p_3(j,i) = erlang_b(A_3(j),n_3(i)); end end

19、 %***************************************** % use loglog to figure the result within logarithm coordinate. %***************************************** loglog(A_1,p_1,'k—’,A_2,p_2,’k—’,A_3,p_3,’k-'); xlabel(’Traffic indensity in Erlangs (A)') ylabel(’Probability of Blocking (P)’) axis([0。1

20、 120 0.001 0.1]) text(。115, .115,'n=1') text(。6, 。115,'n=2’) text(7, 。115,'10’) text(17, .115,'20’) text(27, 。115,’30’) text(45, .115,’50’) text(100, .115,’100’) The figure on the text books is as follow: We can see from the two pictures that, they are exactly the same with

21、 each other except that the result of the experiment have not considered the situation with n=3,4,5,…,12,14,16,18。 2. Using the formula (1.4), calculate the blocking probability of the Erlang C model。 Draw the relationship of the blocking probability PC(n,A) and offered traffic A with n

22、 = 1,2, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100。 From the introduction, we know that the formula 1。4 is : Since each time we calculate the , we need to recurs n times, so the formula is not efficient. We change it to be: Then we only need recurs once. is

23、 calculated by the “erlang_b” function as step 1。 The matlab code for the formula is : erlang_c。m %************************************** % File: erlanb_b.m % A = offered traffic in Erlangs. % n = number of truncked channels。 % Pb is the result blocking probability。 % erlang_b(A,

24、n) is the function of step 1. %************************************** function [ Pc ] = erlang_c( A,n ) Pc=1/((A/n)+(n—A)/(n*erlang_b(A,n))); end Then to figure out the table in the logarithm coordinate as what shown in the step 1。 The matlab code is : %*********************************

25、******** % for the three parts. % n is the number servers. % A is the traffic indensity。 % P_c is the blocking probability of erlangC model。 %***************************************** n_1 = [1:2]; A_1 = linspace(0.1,10,50); % 50 points between 0.1 and 10. n_2 = [10:10:20]; A_2 = linspace(3,

26、20,50); n_3 = [30:10:100]; A_3 = linspace(13,120,50); %***************************************** % for each part, call the erlang_c() function。 %***************************************** for i = 1:length(n_1) for j = 1:length(A_1) p_1_c(j,i) = erlang_c(A_1(j),n_1(i));

27、 %µ÷Óú¯Êýerlang_c end end for i = 1:length(n_2) for j = 1:length(A_2) p_2_c(j,i) = erlang_c(A_2(j),n_2(i)); end end for i = 1:length(n_3) for j = 1:length(A_3) p_3_c(j,i) = erlang_c(A_3(j),n_3(i)); end end %************************************

28、**** % use loglog to figure the result within logarithm coordinate。 %***************************************** loglog(A_1,p_1_c,’g*—',A_2,p_2_c,’g*-’,A_3,p_3_c,'g*—’); xlabel('Traffic indensity in Erlangs (A)’) ylabel('Probability of Blocking (P)’) axis([0.1 120 0.001 0.1]) text(。115, .

29、115,'n=1’) text(.6, .115,’n=2') text(6, 。115,'10’) text(14, 。115,'20’) text(20, 。115,'30') text(30, .115,’40’) text(39, 。115,'50') text(47, 。115,'60’) text(55, .115,'70’) text(65, .115,’80') text(75, 。115,’90') text(85, 。115,'100’) The result of blocking probability table of erlan

30、g C model。 Then we put the table of erlang B and erlang C in the one figure, to compare their characteristic。 The line with ‘ * ’ is the erlang C model, the line without ‘ * ’ is the erlang B model. We can see from the picture that, fo

31、r a constant traffic intensity (A), the erlang C model has a higher blocking probability than erlang B model. The blocking probability is increasing with traffic intensity。 The system performs better when has a larger n. ADDITIONAL BONUS Write a program to simulate a M/M/k queue syst

32、em with input parameters of lamda, mu, k. In this part, we will firstly simulate the M/M/k queue system use matlab to get the figure of the performance of the system such as the leave time of each customer and the queue length of the system。 About the simulation, we firstly calculate the arrive ti

33、me and the leave time for each customer。 Then analysis out the queue length and the wait time for each customer use “for” loops。 Then we let the input to be lamda = 3, mu = 1 and S = 3, and analysis performance of the system for the first 10 customers in detail. Finally, we will do two test to c

34、ompared the performance of the system with input lamda = 1, mu = 1 and S = 3 and the input lamda = 4, mu = 1 and S = 3. The matlab code is: mms_function.m function[block_rate,use_rate]=MMS_function(mean_arr,mean_serv,peo_num,server_num) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

35、%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %first part: compute the arriving time interval, service time %interval,waiting time, leaving time during the whole service interval %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% state=zeros(5,peo_num); %represent t

36、he state of each customer by %using a 5*peo_num matrix %the meaning of each line is: arriving time interval, service time %interval, waiting time, queue length when NO。ncustomer %arrive, leaving time state(1,:)=exprnd(1/mean_arr,1,

37、peo_num); %arriving time interval between each %customer follows exponetial distribution state(2,:)=exprnd(1/mean_serv,1,peo_num); %service time of each customer follows exponetial distribution for i=1:server_num state(3,1:server_num)=0;

38、 end arr_time=cumsum(state(1,:)); %accumulate arriving time interval to compute %arriving time of each customer state(1,:)=arr_time; state(5,1:server_num)=sum(state(:,1:server_num)); %compute living time of first NO。server_num

39、 %customer by using fomular arriving time + service time serv_desk=state(5,1:server_num); %create a vector to store leaving time of customers which is in service for i=(server_num+1):peo_num if arr_time(i)〉min(serv_desk) state(3,i)=0; else

40、 state(3,i)=min(serv_desk)—arr_time(i); %when customer NO.i arrives and the %server is all busy, the waiting time can be compute by %minus arriving time from the minimum leaving time end state(5,i)=sum(state(:,i)

41、 for j=1:server_num if serv_desk(j)==min(serv_desk) serv_desk(j)=state(5,i); break end %replace the minimum leaving time by the first waiting customer’s leaving time end end %%%%%%%%%%%%%%%%%%

42、%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %second part: compute the queue length during the whole service interval %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% zero_time=0; %zero_time is used to identify which server is empty serv_desk(1:server_num)

43、zero_time; block_num=0; block_line=0; for i=1:peo_num if block_line==0 find_max=0; for j=1:server_num if serv_desk(j)==zero_time find_max=1; %means there is empty server break else continue

44、 end end if find_max==1 %update serv_desk serv_desk(j)=state(5,i); for k=1:server_num if serv_desk(k)〈arr_time(i) %before the NO.i customer actually arrives there maybe some customer leave serv_

45、desk(k)=zero_time; else continue end end else if arr_time(i)〉min(serv_desk) %if a customer will leave before the NO.i %customer arrive for k=1:server_num

46、 if arr_time(i)〉serv_desk(k) serv_desk(k)=state(5,i); break else continue end end for k=1:server_num if arr_time(i)>serv_desk(k)

47、 serv_desk(k)=zero_time; else continue end end else %if no customer leave before the NO。i customer arrive block_num=block_num+1; block_line=block_line+1; end

48、 end else %the situation that the queue length is not zero n=0; %compute the number of leaing customer before the NO.i customer arrives for k=1:server_num if arr_time(i)>serv_desk(k) n=n+1; serv_desk(k)=zero_t

49、ime; else continue end end for k=1:block_line if arr_time(i)>state(5,i—k) n=n+1; else continue end end if n

50、h is still not zero block_num=block_num+1; for k=0:n-1 if state(5,i—block_line+k)〉arr_time(i) for m=1:server_num if serv_desk(m)==zero_time serv_desk(m)=state(5,i-block_line+k)

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服