signal processing - BPSK modulation and SNR : Matlab -
considering additie white gaussian communication channel signal taking values bpsk modulation being transmitted. then, received noisy signal :y[k] = s[k] + w[k]
s[k]
either +1,-1 symbol , w[k]
0 mean white gaussian noise.
-- want estimate signal s
, evaluate performance varing snr 0:40 db. let, estimated signal hat_s
.
so, graph have on x axis snr range , on y axis mean square error obtained between known signal values , estimates i.e., s[k] - hat_s[k]
question 1: how define signal-to-noise ratio? formula of snr sigma^2/sigma^2_w
. confused term in numerator: variance of signal, sigma^2, considered?
question 2: but, don't know value of variance of noise is, how 1 add noise?
this have done.
n = 100; %number of samples s = 2*round(rand(n,1))-1; %bpsk modulation y = awgn(s,10,'measured'); %adding noise don't know variance of signal , noise %estimation using least squares hat_s = y./s; mse_s = ((s-hat_s).^2)/n;
please correct me wrong. thank you.
first think important know things have bpsk system:
the constellation of bpsk system [-a , a] in case [-1,1] snr vary 0 db 40 db
i thing answer in function:
y = awgn( ... ); matlab central:
y = awgn(x,snr) adds white gaussian noise vector signal x. scalar snr specifies signal-to-noise ratio per sample, in db. if x complex, awgn adds complex noise. syntax assumes power of x 0 dbw.
y = awgn(x,snr,sigpower) same syntax above, except sigpower power of x in dbw.
y = awgn(x,snr,'measured') same y = awgn(x,snr), except awgn measures power of x before adding noise.
you use y = awgn(x,snr,'measured'), not need worry, beacuse matlab carries you, measure power of signal, , apply channel noise variance needed snr ratio.
let's see how can happen
snrbit = eb/no = a^2/no = dmin^2 /4n0 constelation [a,-a] in case [-1,1] 10 log10(a^2/n0) = 10 log10(1/n0) = snrbitdb snrlineal = 10^(0.1*snrdb)
so that:
noise_var=0.5/(ebn0_lin); % s^2=n0/2
and signal this
y = s + sqrt(noise_var)*randn(1,size);
so in case, generate signal do:
>> n = 100; %number of samples >> s = 2*round(rand(n,1))-1; %bpsk modulation
then prepare snr varies 0 40 db
>> snr_db = 0:1:40;
after calulating posible signals:
>> y = zeros(100,length(snr_db)); >> = 1:41 y(:,i) = awgn(s,snr_db(i),'measured'); end
at point best way see signal using constellation plot this:
>> scatterplot(y(:,1)); >> scatterplot(y(:,41));
you can see bad signal 0 db noise equal power signal , signal signal bigger 40 db noise. eb/no = power signal - power noise db, 0 means power noise equal power of signal, 40 db means power of signal bigger bigger bigger power of noise
then plot calculate mse, matlab has 1 function this
err = immse(x,y) description
example
err = immse(x,y) calculates mean-squared error (mse) between arrays x , y. x , y can arrays of dimension, must of same size , class.
so this:
>> = 1:41 err(i) = immse(s,y(:,i)); end >> stem(snr_db,err)
for plots, , since working in db, should beeter use logarithmic axes
Comments
Post a Comment