-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcase1graph1.m
More file actions
41 lines (34 loc) · 1.31 KB
/
case1graph1.m
File metadata and controls
41 lines (34 loc) · 1.31 KB
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
clc; clear; close all;
Bm_values = [400, 600, 800];
LR = 25 * 1e3;
PT = 0.9; % ask maam about this
PON = 1;
max_split_ratio = 128;
violation_percentages = linspace(0.001, 100, 15) / 100;
% Poisson probability function
poisson_prob = @(NA, r) (NA.^r .* exp(-NA)) ./ factorial(r);
% Compute NA function (Fixed Syntax)
compute_NA = @(Bm) arrayfun(@(violation) ...
max([arrayfun(@(S) ...
S * (sum(poisson_prob(PON*S, 1:ceil(LR / Bm))) >= (PT - violation)), ...
linspace(max_split_ratio, 2, 500)) 0]), ...
violation_percentages);
% Compute NA for different Bm values
NA_1 = compute_NA(Bm_values(1));
NA_2 = compute_NA(Bm_values(2));
NA_3 = compute_NA(Bm_values(3));
% NA_100 = compute_NA(100);
% NA_200 = compute_NA(200);
% NA_300 = compute_NA(300);
% Plot results
figure; hold on; grid on;
plot(violation_percentages * 100, NA_1, 'o-', 'DisplayName', 'B_m = 400 Mbps');
plot(violation_percentages * 100, NA_2, 's-', 'DisplayName', 'B_m = 600 Mbps');
plot(violation_percentages * 100, NA_3, '^-', 'DisplayName', 'B_m = 800 Mbps');
% plot(violation_percentages * 100, NA_300, 'd-', 'DisplayName', 'B_m = 300 Mbps');
% labels and title
xlabel('Violation of Promised Availability (%)');
ylabel('Number of Active Users (N_A)');
title('Number of Users vs Violation of Promised Availability');
legend('Location', 'best');
hold off;