Calculation of Noise for a given SNR

Started by Steve Thomas September 4, 2007
Hello All,
I am trying to find the right method of finding the noise power to
extrapolate from the SNR value.

I have a signal in a variable y which is a second derivative Gaussian pulse:

I normalized to make it 2v peak to peak

Fs^9;%sample rate-10 times the highest frequency
ts=1/Fs;%sample period

y = SEC_GAUSN[x] % y is a second derivative gaussian pulse
y = y/abs(max(y)); normalized to make it 2v peak to peak
Now I want to add noise (SNR = 3dB) to it and I proceed in the following way:

% Find signal power
sigPow=sum(y.*y)/length(y); % Compute the signal power per sample.
snrdb = 3;
snratio = 10.^(0.1*snrdb);

r = y + noise;

I am not sure what I am doing is right here:

Do I have to consider Fs in the above equation?
The reference textbook that I have says:

var =sigma^2 = (No/2) * Fs

So I concluded my standard deviation as follows:

No = sigma^2 * 2/Fs

SNR = Eb/No
= Eb/(sigma^2 * 2/Fs)

>From which sigma = SQRT(Fs*Eb/(2*SNR))
and I generate noise by

after which I add this to y to get the noisy signal.

I am not exactly sure if I am doing right.

Can anybody correct me if I am doing wrong?

Thanks for the help,