How to add Guassian Noise to non sinusoidal signal
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jayant chouragade
le 10 Mai 2020
Réponse apportée : Ameer Hamza
le 10 Mai 2020
Hi,
Given a SNR value in dB I want to add noise to my below narrow pulsed signal .
Fs=200e6;
Fs=200e6;
t=t=0:1/Fs:255/Fs;
Fc=50e6;
tau1=400e-9;
tau2=80e-9;
Req_SNR=10; % in dB
Sn= sin(2*pi*Fc*t).*exp(-4*pi*(((t-tau1)/tau2).^2));
I am following below steps to add noise to signal.
Pow_Sn=sum(St.^2); % compute signal power
rn=randn(1, size(t));
rn_power=sum(rn.^2);
Noise_amp=sqrt(Pow_Sn./((10^(Req_SNR/10)))); %
Noise=rn.*Noise_amp;
Sn_Noise=Sn+Noise;
SNR_measured=snr(Sn_Noise,Noise); % to test.
My questions are as followings:
- Is Signal power computation correct.
- Is noise generation method correct.
- Why SNR_measured do not equal to Req_SNR.
Note: randn outout are not in range of -3.25 to 3.02
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291832/image.bmp)
0 commentaires
Réponse acceptée
Ameer Hamza
le 10 Mai 2020
You are confusing the energy and power of the signal. Calculate the value power of signal like this
Pow_Sn=sum(Sn.^2)/numel(Sn);
Try the following code
Fs=200e6;
t=0:1/Fs:255/Fs;
Fc=50e6;
tau1=400e-9;
tau2=80e-9;
Req_SNR=10; % in dB
Sn= sin(2*pi*Fc*t).*exp(-4*pi*(((t-tau1)/tau2).^2));
Pow_Sn=sum(Sn.^2)/numel(Sn); % compute signal power
rn=randn(1, numel(t));
rn_power=sum(rn.^2);
Noise_amp=sqrt(Pow_Sn./((10^(Req_SNR/10)))); %
Noise=rn.*Noise_amp;
Sn_Noise=Sn+Noise;
SNR_measured=snr(Sn,Noise); % to test.
snr requires the clean signal and the noise.
Result:
SNR_measured =
10.2936
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Measurements and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!