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
t=[(-25E-9):ts:(400)*1E-9)];
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);
noisePow=Fs.*sigPow./(2*snratio);
stddev=sqrt(noisePow);
noise=stddev*randn(1,length(y));
r = y + noise;
I am not sure what I am doing is right here:
noisePow=Fs.*sigPow./(2*snratio);
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
noise=stddev*randn(1,length(y));
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,
Steve.