📄 plothex.m
字号:
function plothex(xyb, fib, chgroup)% DESCRIPTION plothex(xyb, fib, chgroup)% Plots the homogeneous hexagon cell pattern with BS identities. If chgroup% is specified the hexagons are filled with a color.% INPUT% xyb -- Base station coordinates, given as a complex row vector.% fib -- The base station antenna vector, given as a complex row% vector pointing from base to middle of cell.% chgroup -- Row vector. Contains the channel group number of the cell.% This number is used to set the color of the cell.% TRY% plothex(0,0)% plothex([0 1],[0 0])% plothex(irandn(1,3),irandn(1,3),(1:3))% SEE ALSO% crecells% By Fredric Kronestedt 960212 modified by MA 000522 OQ 000523% TBS 050111 (notational and graphical)% Preserve the hold stateholdState=ishold;% Calculate the cell radiusif all(fib==0) % omni cell (fib==0) b2b = sort(abs(xyb-xyb(1))); % shortest dist between cellcenters if length(b2b)>1 cellradius = mplus(fib,b2b(2)*j/sqrt(3)); else cellradius = 1000*j; % the case with one omnibase only end tpos = cellradius(1)/4; % Place text slightly off the cell centerelse % Directional antennas cellradius = fib; tpos = 0; % Place text in the middle of the cell.end% Plot the hexagonal pattern% Each column of 'points' contain the corner points of each cellpoints=mplus(xyb,fib,exp(j*pi*(0:6)/3).'*cellradius);if(exist('chgroup','var')) % Channel groups are specified. Draw filled hexagons cmap=rgb2hsv(hsv(max(chgroup))); cmap=mprod(cmap,[1 0.3 1]); % Create unsaturated colors and set as colormap colormap(hsv2rgb(cmap)); % We must have a for loop to avoid problems when we have 3 cells for i=1:size(chgroup,2) fill(real(points(:,i)),imag(points(:,i)),chgroup(i)); hold on; % Hold the image so that the text and hexagons show up at the same plot. endelse % No colors are specified. Just plot the borders plot(real(points),imag(points),'k'); hold on; % Hold the image so that the text and hexagons show up at the same plot.end% Plot base positionsPHnd = plot(real(xyb),imag(xyb),'ro');set(PHnd, 'LineWidth', 2);axis('equal')% and antenna directions for directional antennas (TBS)if all(fib==0) % omni cell (fib==0) - do nothingelse % Directional antennas antvec = [xyb; xyb+ 0.5*fib]; LHnd = plot(real(antvec), imag(antvec), 'k'); set(LHnd, 'LineWidth', 2);end% Plot BS idts=get(gcf,'DefaultTextFontSize'); % Preserve font sizeset(gcf,'DefaultTextFontSize',7); % Set font size to 7pos = xyb + fib + tpos; % BS text posfor s=1:length(xyb) text(real(pos(s)),imag(pos(s)),num2str(s),'HorizontalAlignment','center')endset(gcf,'DefaultTextFontSize',ts); % Restore old font size % Restore the hold state (if it was off, it has been set to on earlier)if(~holdState) hold off;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -