import numpy as np

# Given values
Pt_dBm = 23             # Transmit power in dBm
Gain_rx_dB = 80         # Receiver gain in dB
Bandwidth_Hz = 20e6     # 20 MHz
Noise_Figure_dB = 12    # Noise figure in dB

# Step 1: Calculate noise power (dBm)
kT_dBm_Hz = -174  # Thermal noise density in dBm/Hz
Pn_dBm = kT_dBm_Hz + 10 * np.log10(Bandwidth_Hz) + Noise_Figure_dB

# Step 2: Received power
Pr_dBm = Pt_dBm + Gain_rx_dB

# Step 3: Calculate SNR
SNR_dB = Pr_dBm - Pn_dBm

# Output results
print(f"Noise Power (Pn): {Pn_dBm:.2f} dBm")
print(f"Received Power (Pr): {Pr_dBm:.2f} dBm")
print(f"SNR at receiver output: {SNR_dB:.2f} dB")
