Add analysis of bound curve
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
function [k, b] = linefit(x, y)
|
||||||
|
n = length(x);
|
||||||
|
x = reshape(x, n, 1);
|
||||||
|
y = reshape(y, n, 1);
|
||||||
|
A = [x, ones(n, 1)];
|
||||||
|
bb = y;
|
||||||
|
B = A' * A;
|
||||||
|
bb = A' * bb;
|
||||||
|
yy = B \ bb;
|
||||||
|
k = yy(1);
|
||||||
|
b = yy(2);
|
||||||
|
end
|
||||||
+19
-8
@@ -3,23 +3,34 @@ clear;
|
|||||||
|
|
||||||
M = 50;
|
M = 50;
|
||||||
eps = 1e-5;
|
eps = 1e-5;
|
||||||
delta = 0.3;
|
delta = 1/3;
|
||||||
C = 10.66;
|
C = 10.66;
|
||||||
|
|
||||||
nums = 10:0.1:50;
|
nums = 20:0.1:50;
|
||||||
num = length(nums);
|
len = length(nums);
|
||||||
N = zeros(1, num);
|
N = zeros(1, len);
|
||||||
upper_bound_C1 = zeros(1, num);
|
upper_bound_C1 = zeros(1, len);
|
||||||
upper_bound_C2 = zeros(1, num);
|
upper_bound_C2 = zeros(1, len);
|
||||||
|
log_ub_C1 = zeros(1, len);
|
||||||
|
log_ub_C2 = zeros(1, len);
|
||||||
|
|
||||||
for i = 1: length(nums)
|
for i = 1: len
|
||||||
N(i) = 10^nums(i);
|
N(i) = 10^nums(i);
|
||||||
upper_bound_C1(i) = get_our_ub(1, N(i), C, M, eps);
|
upper_bound_C1(i) = get_our_ub(1, N(i), C, M, eps);
|
||||||
|
log_ub_C1(i) = log(upper_bound_C1(i));
|
||||||
upper_bound_C2(i) = get_wl_ub(N(i), M, eps);
|
upper_bound_C2(i) = get_wl_ub(N(i), M, eps);
|
||||||
|
log_ub_C2(i) = log(upper_bound_C2(i));
|
||||||
N(i) = nums(i);
|
N(i) = nums(i);
|
||||||
end
|
end
|
||||||
|
|
||||||
semilogy(N, upper_bound_C1, 'r-', N, upper_bound_C2, 'b');
|
semilogy(N, upper_bound_C1, 'r-', N, upper_bound_C2, 'b');
|
||||||
|
legend("Our result", "Wang's result");
|
||||||
xlabel("log_{10}(N)");
|
xlabel("log_{10}(N)");
|
||||||
ylabel("Upper bound of K");
|
ylabel("Upper bound of K");
|
||||||
title("Prob(\delta_K < 0.3) >= 1 - 10^{-5}")
|
title_name = strcat("Prob(\delta_K < ", string(delta), ") >= 1 - ", string(eps));
|
||||||
|
title(title_name);
|
||||||
|
|
||||||
|
[k1, b1] = linefit(N, log_ub_C1);
|
||||||
|
[k2, b2] = linefit(N, log_ub_C2);
|
||||||
|
fprintf("Our result gradient: %f\n", k1);
|
||||||
|
fprintf("Wang's result gradient: %f\n", k2);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Reference in New Issue
Block a user