-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathmain_plotting.m
53 lines (51 loc) · 2.68 KB
/
main_plotting.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
51
52
53
%% Function
function main_plotting(problem,TXbitsTot,THTot,baseFlows,lastSelFlow)
for id = 1:problem.nUsers
figure(1); subplot(problem.nUsers,2,2*id - 1); hold on;
bar((1:1:problem.Tsym-1),TXbitsTot(:,id),'LineWidth',2,'EdgeColor','none','FaceColor','red');
bitsToTxTot = zeros(1,max(baseFlows(id).slots{lastSelFlow(id)}));
for fl = 1:lastSelFlow(id)
slots = baseFlows(id).slots{fl};
reqTXbits = baseFlows(id).TH(fl).*problem.Tslot.*1e-3.*ones(1,length(slots));
bitsToTxTot(slots) = bitsToTxTot(slots) + reqTXbits;
end
lastSlot = max(slots);
bar((1:1:lastSlot),bitsToTxTot,'LineWidth',3,'EdgeColor','none','FaceColor','blue','FaceAlpha',0.4);
% title('Number of Bits transmitted','FontSize',12);
xlabel('Slot index','FontSize',12);
ylabel('Bits TX','FontSize',12);
lg = legend('TX Bits over the channel','Baseline required Bits to be TX');
set(lg,'FontSize',12,'Location','Northeast');
grid minor;
figure(1); subplot(problem.nUsers,2,2*id); hold on;
bitsToTxTot = zeros(1,max(baseFlows(id).slots{lastSelFlow(id)}));
for fl = 1:lastSelFlow(id)
slots = baseFlows(id).slots{fl};
reqTXbits = baseFlows(id).TH(fl).*problem.Tslot.*1e-3.*ones(1,length(slots));
bitsToTxTot(slots) = bitsToTxTot(slots) + reqTXbits;
bar(slots ,bitsToTxTot(slots),'LineWidth',3,'EdgeColor','none','FaceAlpha',0.8);
end
% lastSlot = max(slots);
% bar((1:1:lastSlot),reqTXbits,'LineWidth',3,'EdgeColor','none','FaceAlpha',0.1);
xlabel('Slot index','FontSize',12);
ylabel('Bits to be TX','FontSize',12);
lg = legend('Agg. bits flow 1','Agg. bits flow 1+2','Agg. bits flow 1+2+3');
set(lg,'FontSize',12,'Location','Northeast');
grid minor;
figure(2); subplot(problem.nUsers,1,id); hold on;
bar((1:1:problem.Tsym-1),THTot(:,id).*1e-6,'LineWidth',3,'EdgeColor','none','FaceColor','red');
for fl = 1:lastSelFlow(id)
slots = baseFlows(id).slots{fl};
reqTH = baseFlows(id).TH(fl).*1e-6.*ones(1,length(slots));
bar(slots,reqTH,'LineWidth',2,'EdgeColor','none','FaceColor','blue','FaceAlpha',0.4);
end
% title('Throughput required per slot','FontSize',12);
xlabel('Slot index','FontSize',12);
ylabel('Throughput (Mbps)','FontSize',12);
lg = legend('Achieved','Initially Required');
set(lg,'FontSize',12,'Location','Northeast');
grid minor;
a = get(gcf,'Position');
set(gcf,'Position',[a(1) a(2) 560 168])
end
end