⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usermobility.m

📁 这是一个基于matlab/RUNE环境的移动通信网络仿真程序包
💻 M
字号:
%figure index
cnt_fig=0;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the base stations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

par.cellradius=500;
    par.sps=1;
    par.km=1;
    par.lm=0;
    par.ncluster=1;

    
[xyb,fib,rombvec]=crecells(par.cellradius,par.sps,par.km,par.lm,par.ncluster);
plothex(xyb,fib)
% Plot the system
% cnt_fig=cnt_fig+1;
% figure(cnt_fig);

% plothex(xyb,fib);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Computing the correlated log normal shadow fading
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Here 33 is the correlation distance and we shall consider 99%correlation
[lognmap,mapvec]=crelognmap(xyb,rombvec,33); 
% figure;
% mesh(lognmap)


%%%%%%%%%%%%%%%%%%%%%%%%
%  Create new mobiles  %
%%%%%%%%%%%%%%%%%%%%%%%%

    par.vmean=1;
    par.amean=1;
    par.dt=2;

    nmob=2;
    xym=nans(nmob,1);
    xyv=nans(nmob,1);
    m=(1:nmob).';

    for lp_mob=1:20;

    [xym,xyv]=mobmove(xym,xyv,par.amean,par.vmean,par.dt,rombvec);

        x=real(xym);
        y=imag(xym);
        d=abs(xym);
        
        temp=xym;
        [a,b]=bounce(x,y,d,xym);
    
        new=a+b.*sqrt(-1);
        xym=new;

        complex_dist(:,lp_mob)=xym;
    
            
    
 
    % Plot the system
    % figure(cnt_fig);
    % plothex(xyb,fib,1);
    % hold on;


    
    plot(xym,'bo');
    hold off;
    pause(0.02); %%%%time step of 60 ms 

    end

    
%%%%%%%%%%%%%%%%%%%%%%%%    
%calculating the shadow%
%%%%%%%%%%%%%%%%%%%%%%%%    
   
[p,q]=size(complex_dist);

for j=1:p
    for k=1:q
        logn4(j,k)=uselognmap(complex_dist(j,k),lognmap,mapvec)*4;
    end
end
    
% 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %calculate the CIR and do the averaging%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
% 
% [CIR1_raw] = CIR_calculation(complex_dist,logn4,logn4a,logn4b,logn4c,logn4d,logn4e,logn4f,1); 
% [CIR2_raw] = CIR_calculation(complex_dist,logn4,logn4a,logn4b,logn4c,logn4d,logn4e,logn4f,2);
% 
% 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %make CIR table - simulate the realtime CIR for unicast%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% [CIR1_realtime_unicast] = CIR_realtime_for_unicast(CIR1_raw);
% [CIR2_realtime_unicast] = CIR_realtime_for_unicast(CIR2_raw);
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %make CIR table - simulate the realtime CIR for multicast%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% [CIR1_realtime_multicast] = CIR_realtime_for_multicast(CIR1_realtime_unicast); 
% [CIR2_realtime_multicast] = CIR_realtime_for_multicast(CIR2_realtime_unicast);
%
% %%%%%%%%%%%%%%%%%
% %convert into CS%
% %%%%%%%%%%%%%%%%%
% 
% 
% %a,b,c is boundary to make decision of CS that is used
% %     CS <= a    use CS1 ==> output = 1
% % a < CS <= b    use CS2 ==> output = 2
% % b < CS <= c    use CS3 ==> output = 3
% %     CS >  c    use CS4 ==> output = 4
% % syntax CS=CIR_to_CS(CIR1,a,b,c)


% %for unicast
% 
% CS1_unicast=CIR_to_CS(CIR1_realtime_unicast,a,b,c);
% CS2_unicast=CIR_to_CS(CIR2_realtime_unicast,a,b,c);



% %for umulticast
% 
% CS1_multicast=CIR_to_CS(CIR1_realtime_multicast,a,b,c);
% CS2_multicast=CIR_to_CS(CIR2_realtime_multicast,a,b,c);





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -