Consider a system model of the form: $y_n = ax_n + v_n$ where $x_n$ is the input that is corrupted by $v_n$ which is an Additive White Gaussian Noise of zero-mean and variance 1 for $n = 1,2,...,N$ samples. $a$ is an unknown parameter representing the channel coefficient. How do I generate $v_n$ which is White but of a different variance other than $1$ and a particular SNR?
QUESTION: I am not sure whether the following way creates a signal of non-unit variance and how to determine the variance? If I create a signal z_10
using awgn()
with a particular SNR say 10 dB, then would its variance be different from another signal, z_20
created using SNR = 20 dB? What is the proper way to create signal of a particular variance and know its SNR?
y_wnoise = y + sqrt(variance)*randn(size(y))
but how do I include the SNR value?
The way I have implemented in MATLAB is as follows. Did I do it correctly?
%generate data:
N = 50; %number of data points
s = randn(1,N);
a = 0.6;
for n = 1:N
y(n) = a*s(n);
end
SNR = [10,15]
%generate noisy signal of different variance
z_10 = awgn(y,10,'measured');
z_15 = awgn(y,15,'measured');
OR
z1 = y + sqrt(0.6)*randn(1,N);