Is noise with awgn function or randn fucntion can guarantee SNR?

80 次查看(过去 30 天)
I saw 2 ways to add WGN
1st is noise_power/sqrt(2)*(randn+1j*randn)
2nd is awgn(signal,SNR,signal_power)
I think these 2 method cant guarantee SNR because of random (of course awgn fucntion is random too)
Am i thinking right?

回答(1 个)

Pooja Kumari
Pooja Kumari 2023-9-15
Hello,
I understand that you want to know if two different methods of adding noise to a signal can guarantee SNR or not. There are two ways to add White Gaussian noise either by using “randn” function or by “awgn” function, we cannot guarantee SNR for real scenarios. However, the simulations for noise that we perform in MATLAB should achieve the exact noise levels as we want.
The “randn” function generates random numbers from a standard normal distribution, which can be used to generate Gaussian noise. However, using “randn” alone does not guarantee a specific SNR.
On the other hand, the “awgn” function in MATLAB is used to add additive white Gaussian noise (AWGN) to a signal. It allows you to specify the desired signal-to-noise ratio (SNR) to achieve a specific level of noise in the signal.
Here is a code snippet for your understanding:
t=linspace(0,10,1000);
x=sin(2*pi*0.01.*t+pi/3).*cos(2*pi*0.01.*t+pi/3); %Original signal
n=2*randn(size(x)); %white noise
xn=x+n; %noisy signal method 1
SNR = snr(xn)
SNR = -12.8873
[x2,np]=awgn(x,SNR,'measured'); %noisy signal method 2
snr2 = snr(x2)
snr2 = -12.6339
You can refer to the documentation for more information on “awgn” function :
You can refer to the below documentation for more information on “snr” function:
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Propagation and Channel Models 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by