Commit 6c202249 by JRock007

### Fix convention for users' power

parent 4467e388
 ... ... @@ -21,7 +21,7 @@ def generate(g, sigma, P, N): signes = [i + 1 for i in range(len(S)) if S[i] == 1] # Knowing the signs, we can compute the values of the amplitude for each user r = [math.sqrt(P[i] / 2) * sgn(signes, i + 1) for i in range(len(P))] r = [math.sqrt(P[i]) * sgn(signes, i + 1) for i in range(len(P))] # Sum the signals (to do NOMA) x = sum(r) ... ... @@ -43,9 +43,9 @@ def decode(y, g, P, N): for i in range(N, 0, -1): # Decode the bit at index i if y > 0: r_decoded.insert(0, g * math.sqrt(P[i - 1] / 2)) r_decoded.insert(0, g * math.sqrt(P[i - 1])) else: r_decoded.insert(0, -g * math.sqrt(P[i - 1] / 2)) r_decoded.insert(0, -g * math.sqrt(P[i - 1])) # Remove this decoded value from the interpreted value y -= r_decoded[0] ... ...
 ... ... @@ -73,7 +73,7 @@ def theory(g, sigma, P, N, nuser=-1): signes_bar = [i + 1 for i in range(len(s)) if s[i] == 0] # Knowing the signs, the r_n can be computer r = [math.sqrt(P[i] / 2) * sgn(signes, i + 1) for i in range(len(P))] r = [math.sqrt(P[i]) * sgn(signes, i + 1) for i in range(len(P))] for e in E_n: # Find the indices where an error is expected ... ...
 ... ... @@ -59,13 +59,13 @@ def boundary_string(n, signs, epsilon, N_u): nbr_items += power_coeffs[i - 1] != 0 if power_coeffs[i - 1] == 2: formula += " + 2 \\sqrt{\\frac{P_{" + str(i) + "}}{2}}" formula += " + 2 \\sqrt{P_{" + str(i) + "}}" elif power_coeffs[i - 1] == 1: formula += " + \\sqrt{\\frac{P_{" + str(i) + "}}{2}}" formula += " + \\sqrt{P_{" + str(i) + "}}" elif power_coeffs[i - 1] == -1: formula += " - \\sqrt{\\frac{P_{" + str(i) + "}}{2}}" formula += " - \\sqrt{P_{" + str(i) + "}}" elif power_coeffs[i - 1] == -2: formula += " - 2 \\sqrt{\\frac{P_{" + str(i) + "}}{2}}" formula += " - 2 \\sqrt{P_{" + str(i) + "}}" # Format it (remove the leading " + ", and replace the leading " - " by "-") if len(formula) > 0: ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!