import matplotlib.pyplot as plt
import numpy as np
N = np.arange(1, 20)
def sir_db(N, n):
  q = np.sqrt(3 * N)
  sir = 1 / (
      2 * (q + 1) ** (-n) + 2 * (q - 1) ** (-n) + 2 * q ** (-n)
  )
  return 10 * np.log10(sir)
plt.figure(figsize=(8, 6))
for n in [2, 3, 4]:
  plt.plot(
      N,
      sir_db(N, n),
      marker="o",
      linewidth=2.5,
      markersize=6,
      label=f"n = {n}",
  )
plt.xlabel("Cluster Size (N)", fontsize=12)
plt.ylabel("S/I (dB)", fontsize=12)
plt.title("Worst Case Scenario: S/I vs Cluster Size", fontsize=14)
plt.xticks(np.arange(1, 20))
plt.grid(True, linestyle="--", alpha=0.6)
plt.legend()
plt.tight_layout()
plt.show()
