function [ map ] = processdata( cellinfo ) %%%%% DATA AND VARIABLES %%%%% %%%%% first, a few (educated) guesses %%%%% antennawidth = 120; %describes how wide of an angle the cell tower radiates at antennaloss = 13; %describes how much attenuation comes from the back of the antenna pathloss = 8; %describes how much attenuation from forward propagation sidelobeloss = 10; %describes attenuation from the sides (from 120 degrees to 180 degrees) closenessgain = 5.5; %the gain for very close signals %%%%% next, information about the cell tower %%%%% power = cellinfo.cellSite.eirp; %cell tower effective power xloc = cellinfo.cellSite.BSx; %x location of cell tower yloc = cellinfo.cellSite.BSy; %y location of cell tower height = cellinfo.cellSite.height + double(cellinfo.terrain(xloc,yloc)); %cell tower height frequency = cellinfo.cellSite.freq * 1000000; %cell tower radiated frequency lambda = 299792458 / frequency; %wavelength of radiated signal blocksize = cellinfo.cellSite.cellSize; %the width/height, in meters, of each data block angle = cellinfo.cellSite.azimuth; %the angle of the outputted signal %%%%% next, physical information about the maps %%%%% [xsize,ysize] = size(cellinfo.terrain); %%%%% create new map of same physical dimensions %%%%% map = zeros(xsize,ysize); %%%%% preliminary calculations. these values don't change during calculation %%%%% freqloss = 20 * log10(4 * pi / lambda); %calculate path loss due to frequency. upperangle = angle + antennawidth / 2; if (upperangle > 360) %adjust for additions > 360 upperangle = upperangle - 360; end lowerangle = angle - antennawidth / 2; if (lowerangle < 0) %adjust for subtracitons < 0 lowerangle = lowerangle + 360; end for i=1:xsize for j=1:ysize %calculate a few physical parameters associated with this location dist = blocksize * sqrt((yloc - i)^2 + (xloc - j)^2 + (double(cellinfo.terrain(i,j)) - height)^2); angletoBS = 90 - 180 * atan2(i-yloc,j-xloc) / pi; %angletoBS = angletoBS - 90; if (angletoBS < 0) %adjust for subtracitons < 0 angletoBS = angletoBS + 360; end if (dist > 0) %%%%% set the map to a maximum value using large-scale path loss %%%%% if (dist < 250) %adjustment for signals very close to antenna, which are underestimated map(i,j) = power - freqloss - (20-closenessgain) * log10(dist); else map(i,j) = power - freqloss - 20 * log10(dist); end else map(i,j) = power - freqloss; end %now we adjust for the fact that the antenna is directional if (upperangle > lowerangle) if ~((angletoBS < upperangle) & (angletoBS > lowerangle)) %this lies outside the directional part, but may lie on the %lobes if ((angletoBS < (upperangle + 30)) & (angletoBS > (lowerangle-30))) %adjust for side lobes map(i,j) = map(i,j) - sidelobeloss * log10(dist); else %this is behind the antenna map(i,j) = map(i,j) - antennaloss * log10(dist); end else %this is in front of the antenna map(i,j) = map(i,j) - pathloss * log10(dist); end else if ((angletoBS > upperangle) & (angletoBS < lowerangle)) %this lies outside the directional part, but may lie on the if ~((angletoBS > (upperangle + 30)) & (angletoBS < (lowerangle-30))) %adjust for side lobes map(i,j) = map(i,j) - sidelobeloss * log10(dist); else %this is behind the antenna map(i,j) = map(i,j) - antennaloss * log10(dist); end else %this is in front of the antenna map(i,j) = map(i,j) - pathloss * log10(dist); end end %set the noise floor such that readings cannot go below -120dB if (map(i,j) < -120) map(i,j) = -120; end end end