Code covered by the BSD License  

Highlights from
Desenvolvimento de Aplicacoes com MATLAB

image thumbnail

Desenvolvimento de Aplicacoes com MATLAB

by

 

Slides and demo files from the webinar "Desenvolvimento de Aplicacoes com MATLAB"

myCelltowersetup(N,up,seed)
function  [R,xL,xU,yL,yU,lb,ub,x0] = myCelltowersetup(N,up,seed) 
% CELLTOWERSETUP creates a randomly generated celltower problem.
%   [R,xL,xU,yL,yU,lb,ub,x0] = CELLTOWERSETUP(N, SIDE, SEED)
%
%   Input:
%           N    : number of towers
%           SIDE : length of the side of area
%           SEED : random seed for initial cell location (integer)
%   Output:
%           R    : radius of cell tower coverage
%           xL   : 0       % for plotting
%           xU   : SIDE    % for plotting
%           yL   : 0       % for plotting
%           yU   : SIDE    % for plotting
%           lb   : lower bound values for x, y (based on the radius)
%           ub   : upper bound values for x, y (based on the radius) 
%           x0   : initial center points (x, y pairs)
%
% Copyright 2003 The MathWorks, Inc. 

low = 0;
rand('seed',seed);
R = rand(N,1)+1; % allocate array

% Generate bound constraints
xL = low; xU = up;
yL = low; yU = up;
% 2*N variables in the order [x1,y1,x2,y2...,xn,yn]'
lb = zeros(2*N,1);
ub = lb;
lb(1:2:2*N) = xL + R;
lb(2:2:2*N) = yL + R;
ub(1:2:2*N) = xU - R;
ub(2:2:2*N) = yU - R;

% Random start point
x0 = up*rand(2*N,1);

Contact us