Clear Filters
Clear Filters

how can i add AWGN noise to signal

5 views (last 30 days)
Hello
I have a communcation system and i need to calculate the bit error rate by comparing the I/P stream with O/P stream
i added the AWGN noise using awgn(x,snr) function but it add random values with each run and the error rate is changing according to that. therefore i can't find thresold value for snr to calculate the correct bit error rate
how can i solve this issue?
thanks in advance

Accepted Answer

Abderrahim. B
Abderrahim. B on 27 Jul 2022
Perhaps setting random number generator will be helpful. use rng
MWs Example:
% Generate random data symbols and the 4-PSK modulated signal.
M = 4;
k = log2(M);
snr = 3;
data = randi([0 M-1],2000,1);
x = pskmod(data,M);
% Set the random number generator seed.
seed = 12345;
rng(seed);
y = awgn(x,snr);
% Compute the bit errors.
dataHat = pskdemod(y,M);
numErr1 = biterr(data,dataHat,k)
numErr1 = 300
% Reset the random number generator seed.
rng(seed);
% Demodulate the PSK signal and compute the bit errors.
y = awgn(x,snr);
dataHat = pskdemod(y,M);
numErr2 = biterr(data,dataHat,k)
numErr2 = 300
% Compare numErr1 to numErr2. The errors are equal even after you reset the random number generator seed.
isequal(numErr1, numErr2)
ans = logical
1

More Answers (0)

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!