认知无线电切换算法,基于排队论源码
clear?
clc?
rand('twister',1);
blockpu=[];
blocksu=[];
for N=3:2:7
? ? block=[];
? ? for lambdap =0.01:0.05:0.5
%*****************************************?
%假設 ?1. CR網絡和主網絡(授權網絡)共同存在于同一區域,并且使用同一頻段。假設該頻段共有N個信道,每個主用戶或CR用戶每次接入只占用一個信道。
% ? ? ? ?若所有信道均被主用戶占用,此時CR用戶到達就被阻塞。若CR用戶正在使用的信道有主用戶出現,此時CR用戶被迫中斷,并進入緩存區排隊等待
% ? ? ? ?空閑可用信道以繼續剛被中斷的通信,若等待超過一定時限,則判定CR用戶強制中斷退離緩存區。
% ? ? ? ?故共有三個隊列,分別表示如下:
% ? ? ? ? ?X隊列——主用戶隊列,搶占優先,優先級最高
% ? ? ? ? ?Y隊列——次用戶隊列,優先級最低
% ? ? ? ? ?Z隊列——次用戶切換隊列,優先級次高,若在時延Tao內,則較次用戶隊列優先接入可用信道
% ? ? ?2. 主用戶和次用戶的到達服從泊松分布,參數分別為lambdap和lambdas,平均服務時間服從參數為mup和mus的負指數分布
% ? ? ?3. 對次用戶而言,主用戶搶占優先。總共有N個信道,也就是最多可以有N個主用戶搶占所有信道,
% ? ? ? ? 故Z隊列的長度不會超過N,這里給定Z隊列長度為N。
% ? ? ?4. 假設初始狀態所有N個信道均空閑,次用戶理想感知,感知延時為0.005
%*****************************************?
%吳呈瑜 ? 2009年10月12日 ?10月25日
%*****************************************?
%初始化?
%*****************************************?
a = 100; %主用戶數量
b = 100; %次用戶數量
%N =3 ?%Z隊列最大長度/總的信道數
%Tao=5;%切換時延門限Tao
A = [ ]; %某主用戶到達時刻占用信道序號的集合
B = [ ]; %某次用戶到達時刻占用信道序號的集合
C = [ ]; %切換用戶占用的當前所有信道序號集合
D = [ ]; %某次用戶到達時刻主用戶占用信道集合
member = [ ];
member_CR = [ ];
j1=1;
%主用戶參數*****************************************?
%lambdap = 0.3;?
mup =0.4; %主用戶到達率與服務率
arr_meanp = 1/lambdap;?
ser_meanp = 1/mup;%主用戶平均到達時間與平均服務時間?
arr_nump = a; %round(Total_time*lambdap*2);
tp = zeros(6,arr_nump);?
tp(1,:) = exprnd(arr_meanp,1,arr_nump); %按負指數分布產生各主用戶到達時間間隔?
tp(1,:) = cumsum(tp(1,:)); %各主用戶的到達時刻等于時間間隔的累積和?
tp(2,:) = exprnd(ser_meanp,1,arr_nump); %按負指數分布產生各主用戶服務時間
%次用戶參數*****************************************?
lambdas =0.4;?
mus =0.6; %次用戶到達率與服務率
arr_means = 1/lambdas;?
ser_means = 1/mus; %次用戶平均到達時間與平均服務時間
arr_nums = b; ?
ts = zeros(6,arr_nums);?
ts(1,:) = exprnd(arr_means,1,arr_nums); %按負指數分布產生各次用戶達到時間間隔
ts(1,:) = cumsum(ts(1,:)); %各次用戶的到達時刻等于時間間隔的累積和?
ts(2,:) = exprnd(ser_means,1,arr_nums); %按負指數分布產生各次用戶服務時間?
%切換用戶參數*****************************************待計算lambdah和muh
arr_numh = 10; %切換用戶排隊長度設置
th = zeros(6,arr_numh);?
tsh=[];
%*****************************************?
%計算第1個主用戶的信息?
%*****************************************?
if arr_nump>=1
tp(3,1) = 0; %第1個主用戶進入系統后直接接受服務,無需等待?
n = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
tp(4,1) = tp(1,1)+tp(2,1); %其離開時刻等于其到達時刻與服務時間之和?
tp(5,1) = 1; %其肯定被系統接納,此時系統內共有1個主用戶,故標志位置1?
tp(6,1) = n; %依次記錄主用戶占用信道的序號
A=[A n];
member = [1]; %其進入系統后,系統內已有成員序號為1?
else
? ? !echo No Primary Users!!!!
end
%*****************************************?
if arr_nums>=1
if arr_nump>=1
k1 = sum(ts(1,:) < tp(1,1));
if k1~=0
? for i =1:k1
? ? if i==1
? ? ? ? ts(3,i) = 0.005; %其等待時間為 0
? ? ? ? ts(4,i) = ts(1,i)+ts(2,i)+ts(3,i); %其離開時刻等于到達時刻與服務時間之和?
? ? ? ? ts(5,i) = 1; %其標志位置 1 ,即次用戶在用當前信道
? ? ? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? ts(6,i) = m; %依次記錄次用戶占用信道的序號
? ? ? ? B=[B m];
? ? ? ? member_CR =[1];
? ? ? ? handoff1=find(tp(1,:)>ts(1,i));
? ? ? ? handoff2=find(tp(1,:)<ts(4,i));
? ? ? ? if isempty(handoff1)==0&&isempty(handoff2)==0
? ? ? ? handoff3=setdiff(handoff1,handoff2);%當前次用戶通信期間(時間段)到達的主用戶
? ? ? ? handoff=setdiff(handoff1,handoff3);
? ? ? ? handoff4=[];
? ? ? ? for puid=1:length(handoff)
? ? ? ? ? ?if tp(6,handoff(puid))==ts(6,i)
? ? ? ? ? ? ? ?handoff4=[handoff4,handoff(puid)];
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? end ? ?
? ? ? ? if isempty(handoff4)==0
? ? ? ? ? ? if j1<=arr_numh ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? th(1,j1)=tp(1,handoff4(1));
? ? ? ? ? ? ? ? th(2,j1)=ts(4,i)-tp(1,handoff4(1));
? ? ? ? ? ? ? ? ts(4,i)=tp(1,handoff4(1)); ?
? ? ? ? ? ? ? ? tsh=ts(:,i); ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? %切換到其他可用信道
? ? ? ? ? ? ? ? num_arrivep=find(tp(1,:)<=th(1,j1));
? ? ? ? ? ? ? ? num_leavep=find(tp(4,:)>=th(1,j1));
? ? ? ? ? ? ? ? num_present1=setdiff(num_arrivep,num_leavep);
? ? ? ? ? ? ? ? num_present2=setdiff(num_arrivep,num_present1);%當前在的主用戶
? ? ? ? ? ? ? ? num_arrives=find(ts(1,:)<th(1,j1));
? ? ? ? ? ? ? ? num_leaves=find(ts(4,:)>th(1,j1));
? ? ? ? ? ? ? ? num_present3=setdiff(num_arrives,num_leaves);
? ? ? ? ? ? ? ? num_present4=setdiff(num_arrives,num_present3);%當前在的次用戶
? ? ? ? ? ? ? ? num_present6=[];
wait=0;
? ?if j1>1
? ? ? j2=1:j1-1;
? ? ? num_arriveh=find(th(1,j2)<th(1,j1));
? ? ? num_leaveh=find(th(4,j2)>th(1,j1));
? ? ? num_present5=setdiff(num_arriveh,num_leaveh);
? ? ? num_present6=setdiff(num_arriveh,num_present5);%當前在的切換用戶
? ? ? for j3=1:length(num_present6)
? ? ? wait=wait+th(3,num_present6(j3));
? ? ? end
? ? ? th(3,j1)=wait;%切換用戶排隊等待時間
? ?end
? ? ? ? ? ? ? ? if length(num_present2)==N
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==tp(4,num_present2(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait2=num_present2(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ?th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ?th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tp(6,wait2);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif isempty(num_present2)&&length(num_present4)==N
? ? ? ? ? ? ? ? ? ? wait1=ts(4,num_present4(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==ts(4,num_present4(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait3=num_present4(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=ts(6,wait3);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)==N&&isempty(num_present2)==0&&isempty(num_present4)==0
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? tps=[tp(:,num_present2),ts(:,num_present4)];
? ? ? ? ? ? ? ? ? ? for k=1:length(tps)
? ? ? ? ? ? ? ? ? ? ? ?if wait1==tps(4,k)
? ? ? ? ? ? ? ? ? ? ? ?wait4=k;
? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ? ?end
? ? ? ? ? ? ? ? ? ? end?
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tps(6,wait4);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)<N
? ? ? ? ? ? ? ? ? ? channel1=[tp(6,num_present2),ts(6,num_present4)];
? ? ? ? ? ? ? ? ? ? channel=setdiff([1:N],channel1);
? ? ? ? ? ? ? ? ? ? th(3,j1)=0.006+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=channel(1);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? j1=j1+1;
? ? ? ? ? ? end
? ? ? ? end ? ? ? ??
? ? ? ? end
? ? elseif i >= 2
? ? ? ? j=1:i-1;
? ? ? ? number_CR = find(ts(4,j) > ts(1,i)); ?%當前占用信道的次用戶個數
? ? ? ? [th1,th2]=find(th==0);
? ? ? ? th(:,th2)=[];
? ? ? ? if isempty(number_CR)&&isempty(th)
? ? ? ? ?m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? ?ts(3,i) = 0.005;
? ? ? ? ?ts(4,i) = ts(1,i)+ts(2,i)+ts(3,i); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? ?ts(5,i) = 1; %其標志位置 1 ,即次用戶在用當前信道
? ? ? ? ?ts(6,i) = m; %依次記錄次用戶占用信道的序號
? ? ? ? ?B=[B m];?
? ? ? ? ?member_CR = [member_CR,i];
? ? ? ? ?handoff1=find(tp(1,:)>ts(1,i));
? ? ? ? handoff2=find(tp(1,:)<ts(4,i));
? ? ? ? if isempty(handoff1)==0&&isempty(handoff2)==0
? ? ? ? handoff3=setdiff(handoff1,handoff2);%當前次用戶通信期間(時間段)到達的主用戶
? ? ? ? handoff=setdiff(handoff1,handoff3);
? ? ? ? handoff4=[];
? ? ? ? for puid=1:length(handoff)
? ? ? ? ? ?if tp(6,handoff(puid))==ts(6,i)
? ? ? ? ? ? ? ?handoff4=[handoff4,handoff(puid)];
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? end ? ?
? ? ? ? if isempty(handoff4)==0
? ? ? ? ? ? if j1<=arr_numh
? ? ? ? ? ? th(1,j1)=tp(1,handoff4(1));
? ? ? ? ? ? th(2,j1)=ts(4,i)-tp(1,handoff4(1));
? ? ? ? ? ? ts(4,i)=tp(1,handoff4(1));
? ? ? ? ? ? tsh=[tsh,ts(:,i)];?
? ? ? ? ? ? ?%切換到其他可用信道
? ? ? ? ? ? ? ? num_arrivep=find(tp(1,:)<=th(1,j1));
? ? ? ? ? ? ? ? num_leavep=find(tp(4,:)>=th(1,j1));
? ? ? ? ? ? ? ? num_present1=setdiff(num_arrivep,num_leavep);
? ? ? ? ? ? ? ? num_present2=setdiff(num_arrivep,num_present1);%當前在的主用戶
? ? ? ? ? ? ? ? num_arrives=find(ts(1,:)<th(1,j1));
? ? ? ? ? ? ? ? num_leaves=find(ts(4,:)>th(1,j1));
? ? ? ? ? ? ? ? num_present3=setdiff(num_arrives,num_leaves);
? ? ? ? ? ? ? ? num_present4=setdiff(num_arrives,num_present3);%當前在的次用戶
? ? ? ? ? ? ? ? num_present6=[];
wait=0;
? ?if j1>1
? ? ? j2=1:j1-1;
? ? ? num_arriveh=find(th(1,j2)<th(1,j1));
? ? ? num_leaveh=find(th(4,j2)>th(1,j1));
? ? ? num_present5=setdiff(num_arriveh,num_leaveh);
? ? ? num_present6=setdiff(num_arriveh,num_present5);%當前在的切換用戶
? ? ? for j3=1:length(num_present6)
? ? ? wait=wait+th(3,num_present6(j3));
? ? ? end
? ? ? th(3,j1)=wait;%切換用戶排隊等待時間
? ?end
? ? ? ? ? ? ? ? if length(num_present2)==N
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==tp(4,num_present2(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait2=num_present2(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ?th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ?th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tp(6,wait2);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif isempty(num_present2)&&length(num_present4)==N
? ? ? ? ? ? ? ? ? ? wait1=ts(4,num_present4(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==ts(4,num_present4(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait3=num_present4(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=ts(6,wait3);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)==N&&isempty(num_present2)==0&&isempty(num_present4)==0
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? tps=[tp(:,num_present2),ts(:,num_present4)];
? ? ? ? ? ? ? ? ? ? for k=1:length(tps)
? ? ? ? ? ? ? ? ? ? ? ?if wait1==tps(4,k)
? ? ? ? ? ? ? ? ? ? ? ?wait4=k;
? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ? ?end
? ? ? ? ? ? ? ? ? ? end?
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tps(6,wait4);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)<N
? ? ? ? ? ? ? ? ? ? channel1=[tp(6,num_present2),ts(6,num_present4)];
? ? ? ? ? ? ? ? ? ? channel=setdiff([1:N],channel1);
? ? ? ? ? ? ? ? ? ? th(3,j1)=0.006+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=channel(1);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? end
? ? ? ? ? ? j1=j1+1;
? ? ? ? ? ? end
? ? ? ? end ? ? ??
? ? ? ? end
? ? ? ? elseif length(number_CR)+length(th(1,:))>0&&length(number_CR)+length(th(1,:))<N
? ? ? ? ? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? ? ? while any(m == ts(6,number_CR))&&any(m == th(6,:))
? ? ? ? ? ? ? ? ? m = ceil(rand*N); ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? end
? ? ? ? ?ts(3,i) = 0.005;
? ? ? ? ?ts(4,i) = ts(1,i)+ts(2,i)+ts(3,i); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? ?ts(5,i) = 1; %其標志位置 1 ,即次用戶在用當前信道
? ? ? ? ?ts(6,i) = m; %依次記錄次用戶占用信道的序號
? ? ? ? ?B=[B m];?
? ? ? ? ?member_CR = [member_CR,i]; %如果系統有次用戶正在接受服務,且系統等待隊列未滿,則第i個次用戶進入系統
? ? ? ? handoff1=find(tp(1,:)>ts(1,i));
? ? ? ? handoff2=find(tp(1,:)<ts(4,i));
? ? ? ? if isempty(handoff1)==0&&isempty(handoff2)==0
? ? ? ? handoff3=setdiff(handoff1,handoff2);%當前次用戶通信期間(時間段)到達的主用戶
? ? ? ? handoff=setdiff(handoff1,handoff3);
? ? ? ? handoff4=[];
? ? ? ? for puid=1:length(handoff)
? ? ? ? ? ?if tp(6,handoff(puid))==ts(6,i)
? ? ? ? ? ? ? ?handoff4=[handoff4,handoff(puid)];
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? end ? ?
? ? ? ? if isempty(handoff4)==0
? ? ? ? ? ? if j1<=arr_numh
? ? ? ? ? ? th(1,j1)=tp(1,handoff4(1));
? ? ? ? ? ? th(2,j1)=ts(4,i)-tp(1,handoff4(1));
? ? ? ? ? ? ts(4,i)=tp(1,handoff4(1));
? ? ? ? ? ? tsh=[tsh,ts(:,i)];?
? ? ? ? ? ? ?%切換到其他可用信道
? ? ? ? ? ? ? ? num_arrivep=find(tp(1,:)<=th(1,j1));
? ? ? ? ? ? ? ? num_leavep=find(tp(4,:)>=th(1,j1));
? ? ? ? ? ? ? ? num_present1=setdiff(num_arrivep,num_leavep);
? ? ? ? ? ? ? ? num_present2=setdiff(num_arrivep,num_present1);%當前在的主用戶
? ? ? ? ? ? ? ? num_arrives=find(ts(1,:)<th(1,j1));
? ? ? ? ? ? ? ? num_leaves=find(ts(4,:)>th(1,j1));
? ? ? ? ? ? ? ? num_present3=setdiff(num_arrives,num_leaves);
? ? ? ? ? ? ? ? num_present4=setdiff(num_arrives,num_present3);%當前在的次用戶
? ? ? ? ? ? ? ? num_present6=[];
wait=0;
? ?if j1>1
? ? ? j2=1:j1-1;
? ? ? num_arriveh=find(th(1,j2)<th(1,j1));
? ? ? num_leaveh=find(th(4,j2)>th(1,j1));
? ? ? num_present5=setdiff(num_arriveh,num_leaveh);
? ? ? num_present6=setdiff(num_arriveh,num_present5);%當前在的切換用戶
? ? ? for j3=1:length(num_present6)
? ? ? wait=wait+th(3,num_present6(j3));
? ? ? end
? ? ? th(3,j1)=wait;%切換用戶排隊等待時間
? ?end
? ? ? ? ? ? ? ? if length(num_present2)==N
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==tp(4,num_present2(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait2=num_present2(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ?th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ?th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tp(6,wait2);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif isempty(num_present2)&&length(num_present4)==N
? ? ? ? ? ? ? ? ? ? wait1=ts(4,num_present4(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==ts(4,num_present4(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait3=num_present4(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=ts(6,wait3);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)==N&&isempty(num_present2)==0&&isempty(num_present4)==0
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? tps=[tp(:,num_present2),ts(:,num_present4)];
? ? ? ? ? ? ? ? ? ? for k=1:length(tps)
? ? ? ? ? ? ? ? ? ? ? ?if wait1==tps(4,k)
? ? ? ? ? ? ? ? ? ? ? ?wait4=k;
? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ? ?end
? ? ? ? ? ? ? ? ? ? end?
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tps(6,wait4);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)<N
? ? ? ? ? ? ? ? ? ? channel1=[tp(6,num_present2),ts(6,num_present4)];
? ? ? ? ? ? ? ? ? ? channel=setdiff([1:N],channel1);
? ? ? ? ? ? ? ? ? ? th(3,j1)=0.006+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=channel(1);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? end
? ? ? ? ? ? j1=j1+1;
? ? ? ? ? ? end
? ? ? ? end ? ? ??
? ? ? ? end
? ? ? ? elseif number_CR+length(th(1,:)) >= N %如果系統已滿,則系統拒絕第i個次用戶,其標志位置 0 ?//次用戶阻塞
? ? ? ? ? ? ts(5,i) = 0; %其標志位置 0 ,即次用戶在用當前信道
? ? ? ?end
? ? end ??
?end
end
else
? ? %***********************第一個次用戶到達信息
? ? ? ? ts(3,1) = 0.005; %其等待時間為 0
? ? ? ? ts(4,1) = ts(1,1)+ts(2,1)+ts(3,1); %其離開時刻等于到達時刻與服務時間之和?
? ? ? ? ts(5,1) = 1; %其標志位置 1 ,即次用戶在用當前信道
? ? ? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? ts(6,1) = m; %依次記錄次用戶占用信道的序號
? ? ? ? B=[B m];
? ? ? ? member_CR =[1];
? ? %************************第一個之后的次用戶到達信息
? ? for i = 2:arr_nums ?
? ? number = find(ts(4,:) > ts(1,i)); ?%當前占用信道的主用戶個數
? ? if isempty(number) %如果系統為空,則第i個主用戶直接接受服務
? ? ? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? ts(3,i)=0.005;
? ? ? ? ts(4,i)=ts(1,i)+ts(2,i)+ts(3,1); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? ts(5,i) = 1; %其標志位置 1 ??
? ? ? ? ts(6,i) = m; %依次記錄主用戶占用信道的序號
? ? ? ? B=[B m];
? ? ? ? member_CR = [member_CR,i]; %如果系統有主用戶正在接受服務,且系統等待隊列未滿,則第i個主用戶進入系統
? ? elseif isempty(number)==0&&length(number)<N
? ? ? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? while any(m==ts(6,number))
? ? ? ? ? ? ?m = ceil(rand*N);
? ? ? ? end ? ? ? ? ? ?
? ? ? ? ts(3,i)=0.005;
? ? ? ? ts(4,i)=ts(1,i)+ts(2,i)+ts(3,1); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? ts(5,i) = 1; %其標志位置 1 ??
? ? ? ? ts(6,i) = m; %依次記錄主用戶占用信道的序號
? ? ? ? B=[B m]; ?
? ? ? ? member_CR = [member_CR,i]; %如果系統有主用戶正在接受服務,且系統等待隊列未滿,則第i個主用戶進入系統
? ? elseif ?length(number) >= N %如果系統已滿,則系統拒絕第i個主用戶,其標志位置 0 ?//主用戶阻塞
? ? ? ? ts(5,i) = 1; %其標志位置 1 ,即主用戶在用當前信道 ? ? ? ? ? ? ? ?
? ? end ? ??
end
end
else
? ? !echo No Cognitive Radio Users!!!!
end
%*****************************************以上是第一個主用戶到達時刻之前可能到達的次用戶信息 OK 10月26日
%*****************************************以下是第一個主用戶之后到達的主用戶信息
if arr_nump>=1
for i = 2:arr_nump ?
? ? number = find(tp(4,:) > tp(1,i)); ?%當前占用信道的主用戶個數
? ? if isempty(number)==1 %如果系統為空,則第i個主用戶直接接受服務
? ? ? ? n = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? tp(3,i)=0;
? ? ? ? tp(4,i)=tp(1,i)+tp(2,i); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? tp(5,i) = 1; %其標志位置 1 ??
? ? ? ? tp(6,i) = n; %依次記錄主用戶占用信道的序號
? ? ? ? A=[A n];
? ? ? ? ?member = [member,i]; %如果系統有主用戶正在接受服務,且系統等待隊列未滿,則第i個主用戶進入系統
? ? elseif isempty(number)==0&&length(number)<N
? ? ? ? n = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ? ? while any(n==tp(6,number))
? ? ? ? ? ? ?n = ceil(rand*N);
? ? ? ? end ? ? ? ? ? ?
? ? ? ? tp(3,i)=0;
? ? ? ? tp(4,i)=tp(1,i)+tp(2,i); %其離開時刻等于到達時刻與服務時間之和
? ? ? ? tp(5,i) = 1; %其標志位置 1 ??
? ? ? ? tp(6,i) = n; %依次記錄主用戶占用信道的序號
? ? ? ? A=[A n];?
? ? ? ? ?member = [member,i]; %如果系統有主用戶正在接受服務,且系統等待隊列未滿,則第i個主用戶進入系統
? ? elseif ?length(number) >= N %如果系統已滿,則系統拒絕第i個主用戶,其標志位置 0 ?//主用戶阻塞
? ? ? ? tp(5,i) = 0; %其標志位置 1 ,即主用戶在用當前信道 ? ? ? ? ? ? ? ?
? ? end ? ? ? ??
end
end
?
if arr_nump>=1&&arr_nums>=1
? ? if tp(4,end)>=ts(1,end)
? ? ? ?arr_numss=arr_nums;
? ? else?
? ? ? ?xxx=find(ts(1,:)<=tp(1,end));
? ? ? ?arr_numss=xxx(end);
? ? end?
? ? if k1<arr_nums
? ? ? ? j = k1+1;
for i=2:arr_nump
? ? ? ? num_arrive=find(tp(1,:)<ts(1,j));
? ? ? ? num_leave=find(tp(4,:)>ts(1,j));
? ? ? ? num_P=[];
? ? ? ? num_S=[];
? ? for num=1:length(num_arrive)
? ? ? ?if any(num_arrive(num)==num_leave)
? ? ? ? ? num_P=[num_P,num_arrive(num)];
? ? ? ?end
? ? end
? ? if k1~=0
? ? ? ? y=1:j-1;
? ? ? ? num_S=find(ts(4,y) > ts(1,j)); ?%當前ts(1,p)時刻占用信道的次用戶個數
? ? end
? ? [th1,th2]=find(th==0);
? ? th(:,th2)=[];
? ? if isempty(num_S)&&isempty(num_P)&&isempty(th) ? ?
? ? m = ceil(rand*N); %產生一個在N范圍內的隨機數作為接入的信道序號
? ? ts(3,j) = 0.005;
? ? ts(4,j) = ts(1,j)+ts(2,j)+ts(3,j); %其離開時刻等于到達時刻與服務時間之和 ? ? ? ??
? ? ts(5,j) = 1; %其標志位置 1 ? ? ? ??
? ? ts(6,j) = m; %依次記錄次用戶占用信道的序號 ? ? ? ?
? ? B=[B m];?
? ? member_CR = [member_CR,j]; %如果系統有次用戶正在接受服務,且系統等待隊列未滿,則第c個次用戶進入系統 ? ? ? ??
? ? handoff1=find(tp(1,:)>ts(1,j));
? ? ? ? handoff2=find(tp(1,:)<ts(4,j));
? ? ? ? if isempty(handoff1)==0&&isempty(handoff2)==0
? ? ? ? handoff3=setdiff(handoff1,handoff2);%當前次用戶通信期間(時間段)到達的主用戶
? ? ? ? handoff=setdiff(handoff1,handoff3);
? ? ? ? handoff4=[];
? ? ? ? for puid=1:length(handoff)
? ? ? ? ? ?if tp(6,handoff(puid))==ts(6,j)
? ? ? ? ? ? ? ?handoff4=[handoff4,handoff(puid)];
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? end ? ? ? ?
? ? ? ? if isempty(handoff4)==0
? ? ? ? ? ? if j1<=arr_numh
? ? ? ? ? ? th(1,j1)=tp(1,handoff4(1));
? ? ? ? ? ? th(2,j1)=ts(4,j)-tp(1,handoff4(1));
? ? ? ? ? ? ts(4,j)=tp(1,handoff4(1));
? ? ? ? ? ? tsh=[tsh,ts(:,i)];?
? ? ? ? ? ? ?%切換到其他可用信道
? ? ? ? ? ? ? ? num_arrivep=find(tp(1,:)<=th(1,j1));
? ? ? ? ? ? ? ? num_leavep=find(tp(4,:)>=th(1,j1));
? ? ? ? ? ? ? ? num_present1=setdiff(num_arrivep,num_leavep);
? ? ? ? ? ? ? ? num_present2=setdiff(num_arrivep,num_present1);%當前在的主用戶
? ? ? ? ? ? ? ? num_arrives=find(ts(1,:)<th(1,j1));
? ? ? ? ? ? ? ? num_leaves=find(ts(4,:)>th(1,j1));
? ? ? ? ? ? ? ? num_present3=setdiff(num_arrives,num_leaves);
? ? ? ? ? ? ? ? num_present4=setdiff(num_arrives,num_present3);%當前在的次用戶
? ? ? ? ? ? ? ? num_present6=[];
wait=0;
? ?if j1>1
? ? ? j2=1:j1-1;
? ? ? num_arriveh=find(th(1,j2)<th(1,j1));
? ? ? num_leaveh=find(th(4,j2)>th(1,j1));
? ? ? num_present5=setdiff(num_arriveh,num_leaveh);
? ? ? num_present6=setdiff(num_arriveh,num_present5);%當前在的切換用戶
? ? ? for j3=1:length(num_present6)
? ? ? wait=wait+th(3,num_present6(j3));
? ? ? end
? ? ? th(3,j1)=wait;%切換用戶排隊等待時間
? ?end
? ? ? ? ? ? ? ? if length(num_present2)==N
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==tp(4,num_present2(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait2=num_present2(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ?th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ?th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tp(6,wait2);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif isempty(num_present2)&&length(num_present4)==N
? ? ? ? ? ? ? ? ? ? wait1=ts(4,num_present4(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? ? ? if wait1==ts(4,num_present4(k))
? ? ? ? ? ? ? ? ? ? ? ? ? ? wait3=num_present4(k);
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=ts(6,wait3);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)==N&&isempty(num_present2)==0&&isempty(num_present4)==0
? ? ? ? ? ? ? ? ? ? wait1=tp(4,num_present2(1));
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present2)
? ? ? ? ? ? ? ? ? ? wait1=min(tp(4,num_present2(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? for k=1:length(num_present4)
? ? ? ? ? ? ? ? ? ? wait1=min(ts(4,num_present4(k)),wait1);
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? tps=[tp(:,num_present2),ts(:,num_present4)];
? ? ? ? ? ? ? ? ? ? for k=1:length(tps)
? ? ? ? ? ? ? ? ? ? ? ?if wait1==tps(4,k)
? ? ? ? ? ? ? ? ? ? ? ?wait4=k;
? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ? ?end
? ? ? ? ? ? ? ? ? ? end?
? ? ? ? ? ? ? ? ? ? th(3,j1)=wait1-th(1,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=tps(6,wait4);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? elseif length(num_present2)+length(num_present4)<N
? ? ? ? ? ? ? ? ? ? channel1=[tp(6,num_present2),ts(6,num_present4)];
? ? ? ? ? ? ? ? ? ? channel=setdiff([1:N],channel1);
? ? ? ? ? ? ? ? ? ? th(3,j1)=0.006+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(4,j1)=th(1,j1)+th(2,j1)+th(3,j1);
? ? ? ? ? ? ? ? ? ? th(5,j1)=1;
? ? ? ? ? ? ? ? ? ? th(6,j1)=channel(1);
? ? ? ? ? ? ? ? ? ? tsh=[tsh,th(:,j1)];
? ? ? ? ? ? ? ? end
? ? ? ? ? ? j1=j1+1;
? ? ? ? ? ? end
? ? ? ? end ? ? ? ??
? ? ? ? end
? ? elseif length(num_S)+length(num_P)+length(th(1,:))>0&&length(num_S)+length(num_P)+length(th(1,:))< N
? ? ? ? m = ceil(rand*N);
? ? ? ? while any(m == tp(6,num_P))&&any(m == ts(6,num_S))&&any(m == th(6,:)) ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? m = ceil(rand*N); ? ? ? ? ? ?
? ? ? ? end
? ? ? ? ts(3,j) = 0.005;
? ? ? ? ts(4,j) = ts(1,j)+ts(2,j)+ts(3,j); %其離開時刻等于到達時刻與服務時間之和 ? ? ? ??
? ? ? ? ts(5,j) = 1; %其標志位置 1 ? ? ? ??
? ? ? ? ts(6,j) = m; %依次記錄次用戶占用信道的序號 ? ? ? ?
? ? ? ? B=[B m];
? ? ? ? member_CR = [member_CR,j];?
? ? ? ? handoff1=find(tp(1,:)>ts(1,j));
? ? ? ? handoff2=find(tp(1,:)<ts(4,j));
? ? ? ? if isempty(handoff1)==0&&isempty(handoff2)==0
? ? ? ? handoff3=setdiff(handoff1,handoff2);%當前次用戶通信期間(時間段)到達的主用戶
? ? ? ? handoff=setdiff(handoff1,handoff3);
? ? ? ? handoff4=[];
? ? ? ? for puid=1:length(handoff)
? ? ? ? ? ?if tp(6,handoff(puid))==ts(6,j)
? ? ? ? ? ? ? ?handoff4=[handoff4,handoff(puid)];
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? end ? ? ? ?
? ? ? ? if isempty(handoff4)==0
? ? ? ? ? ? if j1<=arr_numh
? ? ? ? ? ? th(1,j1)=tp(1,handoff4(1));
? ? ? ? ? ? th(2,j1)=ts(4,j)-tp(1,handoff4(1));
? ? ? ? ? ? ts(4,j)=tp(1,handoff4(1));
? ? ? ? ? ? tsh=[tsh,ts(:,i)];?
? ? ? ? ? ? ?%切換到其他可用信道
? ? ? ? ? ? ? ? num_arrivep=find(tp(1,:)<=th(1,j1));
? ? ? ? ? ? ? ? num_leavep=find(tp(4,:)>=th(1,j1));
? ? ? ? ? ? ? ? num_present1=setdiff(num_arrivep,num_leavep);
? ? ? ? ? ? ? ? num_present2=setdiff(num_arrivep,num_present1);%當前在的主用戶
? ? ? ? ? ? ? ? num_arrives=find(ts(1,:)<th(1,j1));
? ? ? ? ? ? ? ? num_leaves=find(ts(4,:)>th(1,j1));
? ? ? ? ? ? ? ? num_present3=setdiff(num_arrives,num_leaves);
? ? ? ? ? ? ? ? num_present4=setdiff(num_arrives,num_present3);%當前在的次用戶
? ? ? ? ? ? ? ? num_present6=[];
?
總結
以上是生活随笔為你收集整理的认知无线电切换算法,基于排队论源码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [html] 说说你对WEB标准和W3C
- 下一篇: java 按拼音模糊搜索汉字_数据查询支