-
Notifications
You must be signed in to change notification settings - Fork 0
/
react_script.m
30 lines (26 loc) · 916 Bytes
/
react_script.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
% Main script for Reactive scheme:
% Comparison of the analytical et simulation values of the service
% time tau for different values of success probabiliity p
clear;
T_tx = 1;
T_dp = 1;
T_fb = 1;
T_up = 1;
step = 1/5000; % simulations points step (p is in abscisses)
start = 0.2;
stop = 1;
n_elements = (stop - start)*1/step + 1; % number of simulation points
P = start:step:stop;
n_pack = 1000; % number of packets, for simulated values
tau_anal = analTauReact(T_tx, T_dp, T_fb, T_up, P); % analytical value
tau_sim = zeros(1, n_elements);
for i=1:n_elements
tau_sim(i) = simTauReact(n_pack, T_tx, T_dp, T_fb, T_up, P(1,i));
end
figure(1)
clf
plot(P, tau_sim , 'b', P, tau_anal, 'r')
xlabel('Transmission success probability p')
ylabel('Mean transmission delay')
title('Reactive Scheme')
legend('simulated', 'analytical')