Commit 5c3e0c95 authored by Byiringi's avatar Byiringi

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5706 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 13f034dc
......@@ -128,32 +128,28 @@ for idx=1:length(d1)
%% rssi(dBm) versus distance (log scale)
% We will plot the rssi versus the distance with the data before the passing of the train, and with the data after the passingof the train
% We will plot the rssi versus the distance. We separate the data
% before and after the passing of the train for run 3 and run 4 because
% all the antennas are poiting at the same direction
% we heuristically determine a starting point and a ending point for the linear fitting
if idx==1
distance_before_break1_start=0.4;%in km
distance_before_break1_end=7.5;
distance_before_break2_start=0.4;
distance_before_break2_end=7.5;
distance_break1_start=0.4;%in km
distance_break1_end=7.5;
distance_break2_start=0.4;
distance_break2_end=7.5;
distance_after_break1_start=0.9;%in km
distance_after_break1_end=4.5;
distance_after_break2_start=0.9;
distance_after_break2_end=4.5;
end
if idx==2
distance_before_break1_start=0.8;%in km
distance_before_break1_end=4.5;
distance_before_break2_start=0.8;
distance_before_break2_end=4.5;
distance_break1_start=0.8;%in km
distance_break1_end=4.5;
distance_break2_start=0.8;
distance_break2_end=4.5;
distance_after_break1_start=0.5;%in km
distance_after_break1_end=7.5;
distance_after_break2_start=0.5;
distance_after_break2_end=7.5;
end
if idx==3
......@@ -180,6 +176,18 @@ for idx=1:length(d1)
distance_after_break2_end=8;
end
if idx==1 || idx==2
% indexes of the starting and ending points
index_break1_start=1;
index_break2_start=1;
index_break1_end=1;
index_break2_end=1;
end
if idx==3 || idx==4
% indexes of the starting and ending points with the data before the passing of the
% train
index_break1_before_start=1;
......@@ -194,6 +202,29 @@ for idx=1:length(d1)
index_break1_after_end=I_RSSI_max1;
index_break2_after_end=I_RSSI_max2;
end
if idx==1 || idx==2
%starting points
while (index_break1_start<length(new_distances1)) && (new_distances1(index_break1_start)>distance_break1_start)
index_break1_start=index_break1_start+1;
end
while (index_break2_start<length(new_distances2)) && (new_distances2(index_break2_start)>distance_break2_start)
index_break2_start=index_break2_start+1;
end
%ending points
while (index_break1_end<length(new_distances1)) && (new_distances1(index_break1_end)>distance_break1_end)
index_break1_end=index_break1_end+1;
end
while (index_break2_end<length(new_distances2)) && (new_distances2(index_break2_end)>distance_break2_end)
index_break2_end=index_break2_end+1;
end
end
if idx==3 || idx==4
%starting points
while (index_break1_before_start<length(new_distances1)) && (new_distances1(index_break1_before_start)>distance_before_break1_start)
index_break1_before_start=index_break1_before_start+1;
......@@ -226,8 +257,71 @@ for idx=1:length(d1)
index_break2_after_end=index_break2_after_end+1;
end
end
if idx==1 || idx ==2
figure(idx*10+3)
hold off
linearCoef1 = polyfit(10*log10(new_distances1(index_break1_end:index_break1_start)),data1{idx}(index_break1_end:index_break1_start,13),1);
linearFit1 = polyval(linearCoef1,10*log10(new_distances1(index_break1_end:index_break1_start)));
semilogx(new_distances1(1:I_RSSI_max1),data1{idx}(1:I_RSSI_max1,13),'rx',new_distances1(index_break1_end:index_break1_start),linearFit1,'r-')
display(sprintf('Run %d :slope UHF : %f',idx,linearCoef1(1)))
hold on
linearCoef2 = polyfit(10*log10(new_distances2(index_break2_end:index_break2_start)),data2{idx}(index_break2_end:index_break2_start,13),1);
linearFit2 = polyval(linearCoef2,10*log10(new_distances2(index_break2_end:index_break2_start)));
semilogx(new_distances2(1:I_RSSI_max2),data2{idx}(1:I_RSSI_max2,13),'bx',new_distances2(index_break2_end:index_break2_start),linearFit2,'b-')
display(sprintf('Run %d :slope 2.6GHz : %f',idx,linearCoef2(1)))
title(sprintf('Run %d: With the data the passing of the train',idx))
legend('UHF','UHF:linear fitting','2.6GHz card 1','2.6GHz card 1:linear fitting');
xlabel('distance [km]')
ylabel('RSSI [dBm]')
% Zoom on the linear fitting
figure(idx*10+4)
hold off
linearCoef1 = polyfit(10*log10(new_distances1(index_break1_end:index_break1_start)),data1{idx}(index_break1_end:index_break1_start,13),1);
linearFit1 = polyval(linearCoef1,10*log10(new_distances1(index_break1_end:index_break1_start)));
semilogx(new_distances1(index_break1_end:index_break1_start),data1{idx}(index_break1_end:index_break1_start,13),'rx',new_distances1(index_break1_end:index_break1_start),linearFit1,'r-')
%display(sprintf('Run %d :slope UHF : %f',idx,linearCoef1(1)))
hold on
linearCoef2 = polyfit(10*log10(new_distances2(index_break2_end:index_break2_start)),data2{idx}(index_break2_end:index_break2_start,13),1);
linearFit2 = polyval(linearCoef2,10*log10(new_distances2(index_break2_end:index_break2_start)));
semilogx(new_distances2(index_break2_end:index_break2_start),data2{idx}(index_break2_end:index_break2_start,13),'bx',new_distances2(index_break2_end:index_break2_start),linearFit2,'b-')
%display(sprintf('Run %d :slope 2.6GHz : %f',idx,linearCoef2(1)))
title(sprintf('Run %d: ',idx))
legend('UHF','UHF:linear fitting','2.6GHz card 1','2.6GHz card 1:linear fitting');
xlabel('distance [km]')
ylabel('RSSI [dBm]')
end
if idx==3 || idx==4
figure(idx*10+3)
......@@ -321,6 +415,7 @@ for idx=1:length(d1)
xlabel('distance [km]')
ylabel('RSSI [dBm]')
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment