add white gaussian noise

조회 수: 7 (최근 30일)
Jessie Bessel
Jessie Bessel 2018년 6월 19일
편집: Meg Noah 2025년 8월 7일
I tried to add noise to a signal. The signal noise ratio must be 0 dB. I tried with
signal_noise=awgn(signal,0,'measured')
Is there any method?

답변 (2개)

OCDER
OCDER 2018년 6월 19일
signal_noise=awgn(signal,1,'measured')
SNR = 1 means 0 dB.
  댓글 수: 2
Jessie Bessel
Jessie Bessel 2018년 6월 19일
Ok.Any method, without awgn?
OCDER
OCDER 2018년 6월 19일
noise = sig * randn(size(signal)); %sig is your standard dev.
signa_noise = signal + noise %you have to determine value of "sig".
%sig = std(signal) ?

댓글을 달려면 로그인하십시오.


Meg Noah
Meg Noah 2025년 8월 7일
편집: Meg Noah 2025년 8월 7일
% signal is a sine wave of 2 Hz
nSamples = 1000;
f = 2; % [Hz]
time = linspace(0, 2, nSamples+1);
signal = sin(2*pi*f*time);
signal_noise=awgn(signal,0,'measured');
% calculate the signal power
signalPower = sum((signal).^2)./nSamples;
% the gaussian white noise
noiseValues = signal_noise - signal;
% verify the Signal-to-Noise value
noisePower = sum(noiseValues.^2)/numel(noiseValues);
SNR = 10*log10(signalPower/noisePower);
fprintf(1,"standard deviation of noise = %f\n", std(noiseValues));
standard deviation of noise = 0.720478
fprintf(1,"SNR: %f\n", SNR);
SNR: -0.158400
% Method WITHOUT the awgn
% SNR in db is 10log(Psignal/Pnoise)
snrDb = 0; % [dB]
% noise power such that signal power is 10 dB more
% 10 = 10 log (Ps / Pn)
% Pn is variance which for zero mean gaussian noise
% is essentially - square sum of all samples -> divided by numSamples
noiseStd = sqrt(signalPower / 10^(snrDb/10));
noiseMean = 0;
% generate the gaussian white noise
noiseValues = noiseStd*randn(nSamples,1) + noiseMean;
% verify the Signal-to-Noise value
noisePower = sum(noiseValues.^2)/numel(noiseValues);
SNR = 10*log10(signalPower/noisePower);
fprintf(1,"noiseStd: model input: %f simulation output: %f\n", noiseStd, std(noiseValues));
noiseStd: model input: 0.707107 simulation output: 0.699265
fprintf(1,"SNR: %f\n", SNR);
SNR: 0.094870

카테고리

Help CenterFile Exchange에서 Propagation and Channel Models에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by