📄 mobmovescale.m
字号:
function [xym,xyv] = mobmoveScale(xym,xyv,amean,vmean,dt,rombvec,centerBsLoc,desireBsLoc,dmin)
% DESCRIPTION [xym,xyv] = mobmove(xym,xyv,amean,vmean,dt,rombvec)
% Move and initiate position of users.
% INPUT
% xym -- Complex position of users possibly. NaN for users that have not yet
% received any position and thus are regarded as new.
% xyv -- Complex speed [m/s].
% amean -- Average acceleration of mobiles.
% vmean -- Mean speed of mobiles.
% dt -- Time interval since last call to this routine.
% rombvec -- Two complex vectors determining the area within which
% mobiles are folded.
% centerBsLoc --
% location which should be the base station for investigation,
% users will move in an area under this cell, this is mainly
% for SFN investigations. Keep nan to investigate multi cell
% rot -- Rotation of user area, use complex values with abs(rot)=1,
%
% OUTPUT
% xym -- New position.
% xyv -- New speed.
% TRY
% plot(mobmove(zeros(1000,1),zeros(1000,1),1,10,1,[1 i]*1000),'.')
% plot(mobmove(zeros(1000,1),zeros(1000,1),1,10,1,[1 i]*1),'.')
% plot(mobmove(nans(1000,1),zeros(1000,1),1,10,1,[1+i i]*1000),'.')
% SEE ALSO
% mrequest, terminate
% by Magnus Almgren 000505
% Move users.
raa = exp(-mdiv(dt.*amean,vmean));
% raa is the correlation between the new and the old xyv
% and does not impact the variance.
xyv = xyv.*raa+sqrt(1-raa.^2).*vmean/sqrt(pi/2).*irandn(size(xyv));
xym = xym + xyv.*dt;
% Give new mobiles speed and position.
newones = isnan(xym);
% Generate position and wrap into simulated area.
xym(newones)= 0;
dist_new_ones = abs(xym - desireBsLoc);
newones2 = or(dist_new_ones<dmin,newones);
if isnan(centerBsLoc)==1
centerBsLoc=-mean(rombvec);
end
if exist('rombvec','var')
if all(isfinite(rombvec))
while ~isempty(newones2)
xym(newones2) = rand(size(xyv(newones2),1),2)*rombvec(:);
xym = (wrapinto(xym+centerBsLoc,rombvec,'romb')-centerBsLoc);
dist = abs(xym - desireBsLoc);
newones2 = find(dist<dmin);
end
end
end
% Init speed.
xyv(newones) = vmean/sqrt(pi/2).*irandn(size(xyv(newones)));
xym = xym(:); % Make sure only first dimension.
xyv = xyv(:);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -