-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDisplay_small_stations1.m
50 lines (44 loc) · 1.21 KB
/
Display_small_stations1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
clear all
close all
clc
format short g
Band=500;
counter=0;
load centers_n_15_2;
string_table=[];
neighbor_limit=80;
Small_Stations(cen1,num1,limits,neighbor_limit);
dij=zeros(n,n);
for k=1:n
for kk=1:n
dij(k,kk)=sqrt((cen1(k,1)-cen1(kk,1))^2+(cen1(k,2)-cen1(kk,2))^2);
end;
end;
% Calculate the stations within range to each one
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k=1:n
ss=['station',num2str(k)];
TH=[];
P1=cen1(k,:);
neighbor=find( (dij(k,:) > 0) & (dij(k,:) <= neighbor_limit));
if (length(neighbor) >=1)
for kk=1:length(neighbor)
P2=cen1(neighbor(kk),:);
theta=theta1(P1,P2);
TH(kk)=theta;
end;
eval([ss,'.neighborsNo = neighbor;']);
eval([ss,'.neighborsAng = TH;']);
else
eval([ss,'.neighborsNo = [];']);
eval([ss,'.neighborsAng = [];']);
end;
end;
% Calculate the stations within range to each one
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xij=zeros(n);
for k=1:n
ss=['station',num2str(k)];
k1=eval([ss,'.neighborsNo']);
xij(k,k1)=1;
end;