function bs pAC_values = [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45]; target_Ps = [0.1, 0.01, 0.001]; for pAC = pAC_values for target_P = target_Ps z = calculate_min_blocks(pAC, target_P); fprintf('For pAC = %.2f and target P = %.3f, the minimum number of blocks is %d\n', pAC, target_P, z); end end end function z = calculate_min_blocks(pAC, target_P) pMC = 1 - pAC; k = 0; current_P = 1; while current_P > target_P k = k + 1; % Increase in the number of blocks sum_prob = 0; alpha = k * (pAC / pMC); for x = 0:k sum_prob = sum_prob + poisspdf(x, alpha) * (1 - power(pAC/pMC, (k - x))); end current_P = 1 - sum_prob; % Calculate the current attack success probability current_P = current_P ^ 3; % Change the probability to the third power of the original probability end z = k; end