1

Considering an Additive White Gaussian Noise (AWGN) communication channel where a signal taking values from BPSK modulation is being transmitted. Then, the received noisy signal is :y[k] = s[k] + w[k] where s[k] is either +1,-1 symbol and w[k] is the zero mean white gaussian noise.

-- I want to estimate the signal s and evaluate the performance by varing SNR from 0:40 dB. Let, the estimated signal be hat_s.

So, the graph for this would have on X axis the SNR range and on Y Axis the Mean Square Error obtained between the known signal values and the estimates i.e., s[k] - hat_s[k]

Question 1: How do I define signal-to-noise ratio? Would the formula of SNR be sigma^2/sigma^2_w. I am confused about the term in the numerator: what is the variance of the signal, sigma^2, usually considered?

Question 2: But, I don't know what the value of the variance of the noise is, so how does one add noise?

This is what I have done.

N = 100; %number of samples
s = 2*round(rand(N,1))-1;
 %bpsk modulation
y = awgn(s,10,'measured'); %adding noise but I don't know
the variance of the signal and noise 

%estimation using least squares

hat_s = y./s;


 mse_s = ((s-hat_s).^2)/N;

Please correct me where wrong. Thank you.

Psi
  • 268
  • 4
  • 13
SKM
  • 959
  • 2
  • 19
  • 45

1 Answers1

4

First I think that it is important to know what are the things we have an a BPSK system:

The constellation of a BPSK system is [-A , A] in this case [-1,1] the SNR will vary from 0 db to 40 db

I thing that the answer is in this function:

y = awgn( ... ); from matlab central:

y = awgn(x,snr) adds white Gaussian noise to the vector signal x. The scalar snr specifies the signal-to-noise ratio per sample, in dB. If x is complex, awgn adds complex noise. This syntax assumes that the power of x is 0 dBW.

y = awgn(x,snr,sigpower) is the same as the syntax above, except that sigpower is the power of x in dBW.

y = awgn(x,snr,'measured') is the same as y = awgn(x,snr), except that awgn measures the power of x before adding noise.

you use y = awgn(x,snr,'measured'), so you do not need to worry, beacuse matlab carries all for you, measure the power of the signal, and then apply to channel a noise with the variance needed to get that SNR ratio.

let's see how can this happen

SNRbit = Eb/No = A^2/No = dmin^2 /4N0

the constelation [A,-A] in this case is [-1,1] so

10 log10(A^2/N0) = 10 log10(1/N0) = SNRbitdb

SNRlineal = 10^(0.1*SNRdb)

so with that:

noise_var=0.5/(EbN0_lin); % s^2=N0/2

and the signal will be something like this

y = s + sqrt(noise_var)*randn(1,size);

so in your case, I will generate the signal as you do:

>> N = 100; %number of samples
>> s = 2*round(rand(N,1))-1; %bpsk modulation

then prepare a SNR varies from 0 to 40 db

>> SNR_DB = 0:1:40;

after that calulating all the posible signals:

>> y = zeros(100,length(SNR_DB));

>> for i = 1:41
y(:,i) = awgn(s,SNR_DB(i),'measured');
end

at this point the best way to see the signal is using a constellation plot like this:

>> scatterplot(y(:,1));
>> scatterplot(y(:,41));

scatter plot 40 db

scatter plot 0 db

you can see a bad signal 0 db noise equal power as signal and a very good signal signal bigger than 40 DB noise. Eb/No = Power signal - Power noise db, so 0 means power noise equal to power of signal, 40 db means power of signal bigger bigger bigger than power of noise

then for you plot calculate the mse, matlab has one function for this

err = immse(X,Y) Description

example

err = immse(X,Y) calculates the mean-squared error (MSE) between the arrays X and Y. X and Y can be arrays of any dimension, but must be of the same size and class.

so with This:

>> for i = 1:41
err(i) = immse(s,y(:,i));
end
>> stem(SNR_DB,err)

enter image description here

For plots, and since we are working in db, it should be beeter to use logarithmic axes

anquegi
  • 11,125
  • 4
  • 51
  • 67
  • Thank you for your answer along with the plots, however few things are unclear. Could you please clarify? (1) Since, `awgn` takes care of the signal noise parts, most of the times from the research articles it is unclear what is the noise variance and signal variance. When writing papers, I need to mention this as well, hence I have asked the question. Can you please say what is the variance of signal and noise that should be written theoretically?(2) I don't understand how th value of 1 comes in the formula `A^2=1` – SKM Jul 28 '17 at 16:24
  • I corrected the formula for question (2), you where right it was inexact. For first question as far as I know the important thing here is the energy per bit of the signal and the variance of the noise. – anquegi Jul 29 '17 at 06:44
  • Sorry to sound noisy. I could not understand what is `dmin^2 /4N0` and could not find any reference how you got this value and noise_var=0.5/(EbN0_lin); % s^2=N0/2`. Can you please explain/ provide reference how you got this value. Thank you for your time and effort. – SKM Sep 02 '17 at 04:29
  • Hi, do not worry, I like digital modulations, here is aa good summary http://users.ecs.soton.ac.uk/sqc/ELEC6214/AWCNS-L7.pdf, and for the definition is the minimum distance (dmin) among phasors constellation points, which is the characteristic of the noise immunity of the scheme. so in this case is easy to calculate. the other where notions from my university, maybe I was innacurate in any term, but that case of noise_var is only take the equation and separate the noise – anquegi Sep 02 '17 at 15:19
  • Thank you for the link and followup. I have another question which i have posted here https://stackoverflow.com/questions/46041131/matlab-help-to-understand-the-difference-between-snr-and-esno-with-an-example It is in continuation to the one asked here. It would be immensely helpful if you can help again. Basically I am confused whether I should use the snr in terms of EsNo, or in terms of snr when the transmitted data is in symbols. If I use snr instead of EsNo, would it be wrong? Can you please take a glance at the new question? Thanks once again. – SKM Sep 04 '17 at 16:35
  • :Thank you for the clarifications. Was wondering if you saw my other question about which I had requested for help. – SKM Sep 05 '17 at 19:08