我试图使用这些代码来添加高斯噪声和降噪。检查后,图像输出为原始噪声,但降噪功能不起作用。有什么适合QAM的降噪功能的想法吗?
def add_noise(modulated_signal,SNR_db):**
modulated_signal_abs_val = list(abs(x) for x in modulated_signal)
mod_sig_phase_values = list(cmath.phase(x) for x in modulated_signal)
k=1/(10**(SNR_db/10))
noise = k*np.random.normal(0,1,len(modulated_signal_abs_val))
noisy_signal = noise+modulated_signal_abs_val
noisy_modulated_signal = list(cmath.rect(noisy_signal[i],
mod_sig_phase_values[i]) for i in range(0,len(modulated_signal)))
return np.asarray(noisy_modulated_signal)
def denoise(recv_signal,SNR_db):
recv_signal_abs_val = list(abs(x) for x in recv_signal)
recv_signal_phase_values = list(cmath.phase(x) for x in recv_signal)
k=1/(10**(SNR_db/10))
correction = k*np.random.normal(0,1,len(recv_signal_abs_val))
denoisy_signal = recv_signal_abs_val - correction
denoisy_signal = list(cmath.rect(denoisy_signal[i],
recv_signal_phase_values[i]) for i in range(0,len(recv_signal)))
return np.asarray(denoisy_signal)