Você está na página 1de 2

clc;

clear all;
close all;

rx = 0 + (5-0)*rand(5,1);
ry = 0 + (2-0)*rand(5,1);
rz = 0 + (3-0)*rand(5,1);

co = [rx,ry,rz];

Ad = round(rand(5)); %ad1 = triu(Ad);


Ad = triu(Ad) + triu(Ad,1)'; %ad2 = triu(Ad,1);

Ad = Ad - diag(diag(Ad)); %ad3 = triu(Ad,1)';

n = length(Ad);

Rgrid = Grid(Ad,(co(:,1))',(co(:,2))',(co(:,3))',n);
%ORgrid = sort(Rgrid,'descend');
ORgrid = Rgrid;
s = length(Rgrid);
bfr = zeros(1,7);
for i = 1:1:s
li=i;
for j = i+1:1:s
if (Rgrid(j,7)>Rgrid(li,7))
li=j;
end
end
bfr = Rgrid(i,:);
Rgrid(i,:) = Rgrid(li,:);
Rgrid(li,:) = bfr;

end
rss = randi([-70 -30],1, 5);
Rss = sort(rss,'ascend');

w = Rgrid(:,7);
W = sort(w,'descend');
%{
ni = 1;
i = 1;
text(ORgrid(i,1),ORgrid(i,2),ORgrid(i,3),num2str(ni));
ni = ni + 1;
text(ORgrid(i,4),ORgrid(i,5),ORgrid(i,6),num2str(ni));
ni = ni + 1;
for i = 2:1:n
c = i - 1;
cnt1 = 0;
cnt2 = 0;
for j = 1:1:c
if(ORgrid(i,1) ~= ORgrid(j,1)) && (ORgrid(i,1) ~= ORgrid(j,4))
cnt1 = cnt1 + 1;
end
if(ORgrid(i,4) ~= ORgrid(j,1)) && (ORgrid(i,4) ~= ORgrid(j,4))
cnt2 = cnt2 + 1;
end
end
if (cnt1 == c)
text(ORgrid(i,1),ORgrid(i,2),ORgrid(i,3),num2str(ni));
ni = ni + 1;
end
if (cnt2 == c)
text(ORgrid(i,4),ORgrid(i,5),ORgrid(i,6),num2str(ni));
ni = ni + 1;
end
end

%}

%{
x = rand; % creates a random value for x in the interval 0 - 1. Eg. 0.867

x1 = rand(4); % creates a 4*4 matrix of random numbers in the range of 0 - 1.Eg.U


get it right?

x2 = -5 + (5+5)*rand(10,1); %Generate a 10-by-1 column vector of uniformly


distributed..
%..numbers in the interval (-5,5).

%In general, you can generate N random numbers in the interval (a,b) with the..
%..formula r = a + (b-a).*rand(N,1).

x3 = randi([-10 10],1,10); %The 'randi' function to generate n(10 in this


case),random..
%..'integers' from the uniform distribution between x(10) and
y(50)
%}

Você também pode gostar