Commit 7f450fd6 authored by Florian Kaltenberger's avatar Florian Kaltenberger
Browse files

adding noise figure to log_read.m

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5889 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d8b9682b
clear all clear all
close all close all
top_dir = 'P:\florian\CORRIDOR\trials2 train'; % needs to be updated according to your computer top_dir = 'E:\EMOS\CORRIDOR\trials2 train'; % needs to be updated according to your computer
d1 = dir(fullfile(top_dir,'UHF','*.log')); d1 = dir(fullfile(top_dir,'UHF','*.log'));
d2 = dir(fullfile(top_dir,'2.6GHz','*.log')); d2 = dir(fullfile(top_dir,'2.6GHz','*.log'));
load exmimo2_39_comb.mat
G0_comb = permute(G0_comb,[2 1 3]);
G0_interp = interp1(ALL_gain,G0_comb,0:30);
G0_interp = permute(G0_interp,[2 1 3]);
NF0_comb = permute(NF0_comb,[2 1 3]);
NF0_interp = interp1(ALL_gain,NF0_comb,0:30);
NF0_interp = permute(NF0_interp,[2 1 3]);
%%
start_time = [1.400489088000000e+09 1.400493112000000e+09 1.400499696000000e+09 1.400506864000000e+09]; start_time = [1.400489088000000e+09 1.400493112000000e+09 1.400499696000000e+09 1.400506864000000e+09];
for idx=1:length(d1) for idx=1:length(d1)
...@@ -29,8 +35,18 @@ for idx=1:length(d1) ...@@ -29,8 +35,18 @@ for idx=1:length(d1)
rtime1 = data1{idx}(:,1) - data1{idx}(1,1); rtime1 = data1{idx}(:,1) - data1{idx}(1,1);
rtime2 = data2{idx}(:,1) - data2{idx}(1,1); rtime2 = data2{idx}(:,1) - data2{idx}(1,1);
%% compute the noise level based on the AGC values and the calibrated noise figures
data1{idx}(data1{idx}(:,16)==0,16) = 1;
data2{idx}(data2{idx}(:,16)==0,16) = 1;
data2{idx}(data2{idx}(:,22)==0,22) = 1;
data2{idx}(data2{idx}(:,28)==0,28) = 1;
NF1=[NF0_interp(sub2ind(size(NF0_interp),data1{idx}(:,16),data1{idx}(:,15)+1,ones(length(data1{idx}),1)))];
NF2=[NF0_interp(sub2ind(size(NF0_interp),data2{idx}(:,16),data2{idx}(:,15)+1,ones(length(data2{idx}),1))) ...
NF0_interp(sub2ind(size(NF0_interp),data2{idx}(:,22),data2{idx}(:,21)+1,ones(length(data2{idx}),1))) ...
NF0_interp(sub2ind(size(NF0_interp),data2{idx}(:,28),data2{idx}(:,27)+1,ones(length(data2{idx}),1)))];
%% plot gps coordinates %% plot gps coordinates
figure(idx*10+1); h=figure(idx*10+1);
hold off hold off
plot(data1{idx}(1:100:end,7),data1{idx}(1:100:end,8),'rx') plot(data1{idx}(1:100:end,7),data1{idx}(1:100:end,8),'rx')
hold on hold on
...@@ -39,10 +55,12 @@ for idx=1:length(d1) ...@@ -39,10 +55,12 @@ for idx=1:length(d1)
ylabel('lon [deg]') ylabel('lon [deg]')
legend('UHF','2.6GHz') legend('UHF','2.6GHz')
title(sprintf('Run %d',idx)); title(sprintf('Run %d',idx));
saveas(h,sprintf('figures/gps_trace_run%d.eps',idx));
%% plot RSSI %% plot RSSI
% TODO: convert time (in unix epoch) into something more meaninful % TODO: convert time (in unix epoch) into something more meaninful
figure(idx*10+2); h=figure(idx*10+2);
hold off hold off
plot(rtime1,smooth(data1{idx}(:,13),100),'r') plot(rtime1,smooth(data1{idx}(:,13),100),'r')
hold on hold on
...@@ -53,7 +71,22 @@ for idx=1:length(d1) ...@@ -53,7 +71,22 @@ for idx=1:length(d1)
xlabel('time [seconds]') xlabel('time [seconds]')
ylabel('RSSI [dBm]') ylabel('RSSI [dBm]')
title(sprintf('Run %d',idx)); title(sprintf('Run %d',idx));
saveas(h,sprintf('figures/rssi_vs_time_run%d.eps',idx),'epsc2');
%% plot NF
% TODO: convert time (in unix epoch) into something more meaninful
h=figure(idx*10+5);
hold off
plot(rtime1,smooth(NF1,100),'r')
hold on
plot(rtime2,smooth(NF2(:,1),100),'b')
plot(rtime2,smooth(NF2(:,2),100),'c')
plot(rtime2,smooth(NF2(:,3),100),'m')
legend('UHF','2.6GHz card 1','2.6GHz card 2','2.6GHz card 3');
xlabel('time [seconds]')
ylabel('NF [dB]')
title(sprintf('Run %d',idx));
saveas(h,sprintf('figures/nf_vs_time_run%d.eps',idx),'epsc2');
%% measured distance (km) %% measured distance (km)
...@@ -69,7 +102,7 @@ for idx=1:length(d1) ...@@ -69,7 +102,7 @@ for idx=1:length(d1)
end end
figure (100+idx) figure (10*idx+6)
subplot(1,2,1) subplot(1,2,1)
plot(rtime1,distances1,'r',rtime1,smooth(data1{idx}(:,13),100),'b') plot(rtime1,distances1,'r',rtime1,smooth(data1{idx}(:,13),100),'b')
title(sprintf('Run %d with the measured distance : UHF',idx)); title(sprintf('Run %d with the measured distance : UHF',idx));
...@@ -104,7 +137,7 @@ for idx=1:length(d1) ...@@ -104,7 +137,7 @@ for idx=1:length(d1)
new_distances2=(TGV_speed*abs(rtime2-time02))/1000+min(distances2)*ones(length(rtime2),1);% distance in km new_distances2=(TGV_speed*abs(rtime2-time02))/1000+min(distances2)*ones(length(rtime2),1);% distance in km
end end
figure (200+idx) figure (10*idx+7)
subplot(1,2,1) subplot(1,2,1)
plot(rtime1,new_distances1,'r',rtime1,smooth(data1{idx}(:,13),100),'b') plot(rtime1,new_distances1,'r',rtime1,smooth(data1{idx}(:,13),100),'b')
title(sprintf('Run %d with the estimated distance : UHF',idx)); title(sprintf('Run %d with the estimated distance : UHF',idx));
...@@ -263,7 +296,7 @@ for idx=1:length(d1) ...@@ -263,7 +296,7 @@ for idx=1:length(d1)
if idx==1 || idx ==2 if idx==1 || idx ==2
figure(idx*10+3) h=figure(idx*10+3);
...@@ -282,17 +315,18 @@ for idx=1:length(d1) ...@@ -282,17 +315,18 @@ for idx=1:length(d1)
display(sprintf('Run %d :slope 2.6GHz : %f',idx,linearCoef2(1))) display(sprintf('Run %d :slope 2.6GHz : %f',idx,linearCoef2(1)))
title(sprintf('Run %d: With the data the passing of the train',idx)) title(sprintf('Run %d',idx))
legend('UHF','UHF:linear fitting','2.6GHz card 1','2.6GHz card 1:linear fitting'); legend('UHF','UHF linear fit','2.6GHz','2.6GHz linear fit');
xlabel('distance [km]') xlabel('distance [km]')
ylabel('RSSI [dBm]') ylabel('RSSI [dBm]')
saveas(h,sprintf('figures/rssi_vs_dist_run%d.eps',idx),'epsc2');
% Zoom on the linear fitting % Zoom on the linear fitting
figure(idx*10+4) h=figure(idx*10+4);
...@@ -311,20 +345,21 @@ for idx=1:length(d1) ...@@ -311,20 +345,21 @@ for idx=1:length(d1)
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-') 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))) %display(sprintf('Run %d :slope 2.6GHz : %f',idx,linearCoef2(1)))
title(sprintf('Run %d: ',idx)) title(sprintf('Run %d',idx))
legend('UHF','UHF:linear fitting','2.6GHz card 1','2.6GHz card 1:linear fitting'); legend('UHF','UHF linear fit','2.6GHz','2.6GHz linear fit');
xlabel('distance [km]') xlabel('distance [km]')
ylabel('RSSI [dBm]') ylabel('RSSI [dBm]')
saveas(h,sprintf('figures/rssi_vs_dist_zoom_run%d.eps',idx),'epsc2');
end end
if idx==3 || idx==4 if idx==3 || idx==4
figure(idx*10+3) h=figure(idx*10+3);
subplot(2,1,1) subplot(2,1,1)
...@@ -368,10 +403,11 @@ for idx=1:length(d1) ...@@ -368,10 +403,11 @@ for idx=1:length(d1)
xlabel('distance [km]') xlabel('distance [km]')
ylabel('RSSI [dBm]') ylabel('RSSI [dBm]')
saveas(h,sprintf('figures/rssi_vs_dist_run%d.eps',idx),'epsc2');
% Zoom on the linear fitting % Zoom on the linear fitting
figure(idx*10+4) h=figure(idx*10+4);
subplot(2,1,1) subplot(2,1,1)
...@@ -415,13 +451,10 @@ for idx=1:length(d1) ...@@ -415,13 +451,10 @@ for idx=1:length(d1)
xlabel('distance [km]') xlabel('distance [km]')
ylabel('RSSI [dBm]') ylabel('RSSI [dBm]')
saveas(h,sprintf('figures/rssi_vs_dist_zoom_run%d.eps',idx),'epsc2');
end end
end end
\ No newline at end of file
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