I have written a simple Matlab simulation for the BER v SNR curve for
BPSK on an AWGN channel. It is only about 50 lines and is pasted below.
It readily shows the same curves given in Proakis. However, I have
performed what I think is a small fudge on the SNR definition to avoid
a sqrt(2) scaling. Here's my question:
Some people define (1) SNR = Eb/N0. (energy per bit/noise spectral
density)
Some people define (2) SNR = var(s)/var(u). (signal power/noise power)
However, because we use a two-sided noise psd, var(u) = No/2.
In which case SNR(1) = SNR(2)/2. In my simulation I have fudged this by
defining the measured SNR as (var(s)/2*var(u)), which is wrong in my
opinion, but gives the right results. Similarly the noise caling I use
is K = sqrt(1/(2*snr)) when I think it should be K = sqrt(1/(snr))
(assumes transmit power var(s) = 1, which is true for equiprobable
{+1,-1} signals).
Although this is a small issue, it troubles me, as the definition seems
inconsistent. Is there even an issue here?
-----------------------------------------------------------------------
% This script is a BER v SNR simulation for BPSK in AWGN
% it uses the block serial approach
nblock = 200; % max number of blocks in sim
SNR = -4:8; % SNR in dB
nsnr = length(SNR); % no. of SNR points tested
nerr = 0; % no. of detected errors
block = 1; % block number
BER = zeros(1,nsnr); % BER values
for isnr = 1:nsnr
% use different block
% lengths for
if SNR(isnr) < 7 % different SNRS
nbits = 1e2;
else
nbits = 1e4;
end
snr = 10.^(SNR(isnr)/10);
K = sqrt(1/(2*snr)); % noise scaling
while block <= nblock
% signals ---------------------------
a = randint(1,nbits); % bits
s = 2*a-1; % bipolar data
u = K*randn(1,nbits); % noise
r = s + u; % received
% decisions -------------------------
d = (r>=0); % hard decisions
nerr = nerr + sum(d~=a); % no. of errors
fprintf(1,'Measured %5d errors on %2d blocks\n',nerr,block)
block = block+1;
end
BER(isnr) = nerr/(nbits*block);
nerr = 0;
block = 1;
fprintf(1,'Measured SNR is %4.2f (dB)\n',...
10*log10(cov(s)/(2*cov(u))))
end
q = (1/2)*erfc(sqrt(idbl(SNR))); % theoretical value
% graphics ==========================================================
if nsnr>1
figure(101);clf;
semilogy(SNR,BER,'k');
hold on;grid on;
semilogy(SNR,q,'r');
l(1)=semilogy(SNR,BER,'kv');
l(2)=semilogy(SNR,q,'r+');
xlabel('SNR (dB)')
ylabel('BER (dB)')
legend(l,'Uncoded, Measured','Uncoded, Theoretical')
end
Q: definition of SNR?
Started by ●May 4, 2005
Reply by ●May 4, 20052005-05-04
just thinking, is it because I have a real baseband system? Does a real baseband system have a 3dB loss compared to a real bandpass system or its complex baseband equivalent?
Reply by ●May 4, 20052005-05-04
I do not have the answer, but I have this question for a couple of years, but found no-one who could give a consistent answer. some of the answers I have heard were about: - passband vs baseband - believing in negative frequencies - ... Maybe you have better luck with your question ...
Reply by ●May 4, 20052005-05-04
porterbo...@yahoo.com wrote:> I have written a simple Matlab simulation for the BER v SNR curve for > BPSK on an AWGN channel. It is only about 50 lines and is pastedbelow.> It readily shows the same curves given in Proakis. However, I have > performed what I think is a small fudge on the SNR definition toavoid> a sqrt(2) scaling. Here's my question: > > Some people define (1) SNR = Eb/N0. (energy per bit/noise spectral > density) > Some people define (2) SNR = var(s)/var(u). (signal power/noisepower)> > However, because we use a two-sided noise psd, var(u) = No/2. > In which case SNR(1) = SNR(2)/2. In my simulation I have fudged thisby> defining the measured SNR as (var(s)/2*var(u)), which is wrong in my > opinion, but gives the right results. Similarly the noise caling Iuse> is K = sqrt(1/(2*snr)) when I think it should be K = sqrt(1/(snr)) > (assumes transmit power var(s) = 1, which is true for equiprobable > {+1,-1} signals). > > Although this is a small issue, it troubles me, as the definitionseems> inconsistent. Is there even an issue here? > >-----------------------------------------------------------------------> % This script is a BER v SNR simulation for BPSK in AWGN > % it uses the block serial approach > > nblock = 200; % max number of blocks in sim > SNR = -4:8; % SNR in dB > nsnr = length(SNR); % no. of SNR points tested > nerr = 0; % no. of detected errors > block = 1; % block number > BER = zeros(1,nsnr); % BER values > for isnr = 1:nsnr > > % use different block > % lengths for > if SNR(isnr) < 7 % different SNRS > nbits = 1e2; > else > nbits = 1e4; > end > snr = 10.^(SNR(isnr)/10); > K = sqrt(1/(2*snr)); % noise scaling > > while block <= nblock > > % signals --------------------------- > a = randint(1,nbits); % bits > s = 2*a-1; % bipolar data > u = K*randn(1,nbits); % noise > r = s + u; % received > > % decisions ------------------------- > d = (r>=0); % hard decisions > nerr = nerr + sum(d~=a); % no. of errors > > fprintf(1,'Measured %5d errors on %2d blocks\n',nerr,block) > block = block+1; > > end > > BER(isnr) = nerr/(nbits*block); > nerr = 0; > block = 1; > fprintf(1,'Measured SNR is %4.2f (dB)\n',... > 10*log10(cov(s)/(2*cov(u)))) > > end > q = (1/2)*erfc(sqrt(idbl(SNR))); % theoretical value > > % graphics ========================================================== > if nsnr>1 > figure(101);clf; > semilogy(SNR,BER,'k'); > hold on;grid on; > semilogy(SNR,q,'r'); > l(1)=semilogy(SNR,BER,'kv'); > l(2)=semilogy(SNR,q,'r+'); > xlabel('SNR (dB)') > ylabel('BER (dB)') > legend(l,'Uncoded, Measured','Uncoded, Theoretical') > endI have a colleague who says he spends half of his working life looking for the same 3 dB. Let us know when you find yours. What I usually do is create complex baseband signals and scale so that var(s) == 1, then I create a complex noise vector scaled so that var(n) == 1 (divide the noise by sqrt(2)). At this point the SNR in a bandwidth of Fs Hz is 0 dB. Typically one wants Eb/No, which is the SNR in a bandwidth of Rb Hz (where Rb is the bit rate), to be set to a target value. To achieve that, multiply the unity-variance noise by 10^(-(ebno+10*log10(Rb/Fs))/20), where ebno is Eb/No in decibels. I hope that is helpful. John
Reply by ●May 5, 20052005-05-05
I wonder has this thread come up before on comp.dsp? I haven't been
able to find it, if it has. I was thinking about it again last night.
Suppose we have a real {+1,-1} sequence. This has unit power. Instead
of adding unit power real AWGN for 0dB SNR, suppose we add unit power
complex AWGN. At the receiver we take the real part of the noisy
signal, which will only have half the noise power as previously. This
would explain the 3dB gain seen in the textbooks.
Why add complex noise, in a real baseband system? Because up conversion
will generate a bandpass signal with twice the bandwidth of the
baseband signal.
Real addidive bandpass noise translates back down to complex additive
baseband noise, because the noise on the positive and negative
frequencies is uncorrelated, whereas the SIGNAL on positive and
negative frequencies is correlated, because a real signal has X(ejw) =
X*(e-jw).
Thus the double sideband system has 3dB gain over single sideband, or
over real baseband system. When Proakis talks about BPSK I presume he
means double sideband? It makes sense that there is a 3dB gain, because
the same information is transmitted on the positive and negative
frequencies, effectively doubling the signal power. What I dont get, is
that surely there is a 3dB loss in bandwith efficiency to go with this?
I'll keep thinking...
Reply by ●May 5, 20052005-05-05
porterboy76@yahoo.com writes:> [...] > Some people define (1) SNR = Eb/N0. (energy per bit/noise spectral > density)And that would be wrong. SNR = Eb/NO * (# bits). SNR is unitless, Eb/NO is not (has units of [1/bit]). -- Randy Yates Sony Ericsson Mobile Communications Research Triangle Park, NC, USA randy.yates@sonyericsson.com, 919-472-1124
Reply by ●May 5, 20052005-05-05
porterboy76@yahoo.com wrote:> I wonder has this thread come up before on comp.dsp? I haven't been > able to find it, if it has. I was thinking about it again last night. > Suppose we have a real {+1,-1} sequence. This has unit power. Instead > of adding unit power real AWGN for 0dB SNR, suppose we add unit power > complex AWGN. At the receiver we take the real part of the noisy > signal, which will only have half the noise power as previously. This > would explain the 3dB gain seen in the textbooks. > > Why add complex noise, in a real baseband system? Because up conversion > will generate a bandpass signal with twice the bandwidth of the > baseband signal. > Real addidive bandpass noise translates back down to complex additive > baseband noise, because the noise on the positive and negative > frequencies is uncorrelated, whereas the SIGNAL on positive and > negative frequencies is correlated, because a real signal has X(ejw) = > X*(e-jw). > > Thus the double sideband system has 3dB gain over single sideband, or > over real baseband system. When Proakis talks about BPSK I presume he > means double sideband? It makes sense that there is a 3dB gain, because > the same information is transmitted on the positive and negative > frequencies, effectively doubling the signal power. What I dont get, is > that surely there is a 3dB loss in bandwith efficiency to go with this? > I'll keep thinking...It's a question of bookkeeping. For a given transmitter power in a double sideband system, the power is spread over twice the base bandwidth, and the noise bandwidth matches that. Upon demodulation, the signal sidebands are correlated but the noise is not, leading to your 3 dB result. (but with ordinary AM, half the power is in the uninformative carrier; there goes the 3 dB. :-( With single sideband and no carrier, the total received signal power remains the same, but the noise bandwidth is halved. That's also a 3 dB gain. So the gain comes from putting what would have been carrier power into the sideband(s). Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●May 5, 20052005-05-05
Randy Yates wrote:> porterboy76@yahoo.com writes: > >>[...] >>Some people define (1) SNR = Eb/N0. (energy per bit/noise spectral >>density) > > > And that would be wrong. SNR = Eb/NO * (# bits). SNR is unitless, > Eb/NO is not (has units of [1/bit]).Thank you sir! Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●May 6, 20052005-05-06
The following paper has a discussion on issue similar to this. "Baseband Equivalents in Digital Communication System Simulation", IEEE Transaction on Education, Vol. 35, No. 4, Nov 1992. Hope it helps... or create more confusion... ;p kc "Jerry Avins" <jya@ieee.org> wrote in message news:pJqdneZDLrHtouffRVn-gA@rcn.net...> Randy Yates wrote: >> porterboy76@yahoo.com writes: >> >>>[...] >>>Some people define (1) SNR = Eb/N0. (energy per bit/noise spectral >>>density) >> >> >> And that would be wrong. SNR = Eb/NO * (# bits). SNR is unitless, >> Eb/NO is not (has units of [1/bit]). > > Thank you sir! > > Jerry > -- > Engineering is the art of making what you want from things you can get. > �����������������������������������������������������������������������
Reply by ●May 18, 20052005-05-18
Hi Ckiancho, That's a good reference, thanks. In fact, a very clear definition of SNR and Eb/N0 is given on page 836 of "Performance Evaluation of Trellis Coded Modulation Schemes" by Bendetto et al, in the June '94 issue of Proceedings of the IEEE. It's not often the definitions are explicitly given, and in fact that whole paper reads very well, thanks to their clarity and conciseness. Porterboy






