1 Star2 Stars3 Stars4 Stars5 Stars (17 votes, average: 3.71 out of 5)
Loading ... Loading ...
Print Print

Bit Error Rate (BER) for BPSK modulation

by Krishna Sankar on August 5, 2007

In this post, we will derive the theoretical equation for bit error rate (BER) with Binary Phase Shift Keying (BPSK) modulation scheme in Additive White Gaussian Noise (AWGN) channel. The BER results obtained using Matlab/Octave simulation scripts show good agreement with the derived theoretical results.

With Binary Phase Shift Keying (BPSK), the binary digits 1 and 0 maybe represented by the analog levels and respectively. The system model is as shown in the Figure below.

Figure: Simplified block diagram with BPSK transmitter-receiver

Channel Model

The transmitted waveform gets corrupted by noise , typically referred to as Additive White Gaussian Noise (AWGN).

Additive : As the noise gets ‘added’ (and not multiplied) to the received signal

White : The spectrum of the noise if flat for all frequencies.

Gaussian : The values of the noise follows the Gaussian probability distribution function, with and .

Computing the probability of error

Using the derivation provided in Section 5.2.1 of [COMM-PROAKIS] as reference:

The received signal,

when bit 1 is transmitted and

when bit 0 is transmitted.

The conditional probability distribution function (PDF) of for the two cases are:

.

Figure: Conditional probability density function with BPSK modulation

Assuming that and are equally probable i.e. , the threshold 0 forms the optimal decision boundary.

  • if the received signal is is greater than 0, then the receiver assumes was transmitted.
  • if the received signal is is less than or equal to 0, then the receiver assumes was transmitted.

i.e.

and

.

Probability of error given was transmitted

With this threshold, the probability of error given is transmitted is (the area in blue region):

,

where,

isĀ  the complementary error function.

Probability of error given was transmitted

Similarly the probability of error given is transmitted is (the area in green region):

.

Total probability of bit error

.

Given that we assumed that and are equally probable i.e. , the bit error probability is,

.

Simulation model

Matlab/Octave source code for computing the bit error rate with BPSK modulation from theory and simulation. The code performs the following:

(a) Generation of random BPSK modulated symbols +1’s and -1’s

(b) Passing them through Additive White Gaussian Noise channel

(c) Demodulation of the received symbol based on the location in the constellation

(d) Counting the number of errors

(e) Repeating the same for multiple Eb/No value.

Click here to download Matlab/Octave script for simulating BER for BPSK modulation in AWGN chnanel.

Figure: Bit error rate (BER) curve for BPSK modulation – theory, simulation

Reference

[DIGITAL COMMUNICATION: PROAKIS] Digital Communications by John Proakis

Related posts

  1. Symbol Error Rate (SER) for 4-PAM
  2. Symbol Error Rate (SER) for QPSK (4-QAM) modulation
  3. BER for BPSK in Rayleigh channel
  4. Symbol Error Rate for 16PSK
  5. 16QAM Bit Error Rate (BER) with Gray mapping

D id you like this article? Make sure that you do not miss a new article by subscribing to RSS feed OR subscribing to e-mail newsletter. Note: Subscribing via e-mail entitles you to download the free e-Book on BER of BPSK/QPSK/16QAM/16PSK in AWGN.

{ 5 trackbacks }

BER for BPSK in Rayleigh channel
August 10, 2008 at 8:50 pm
Receive diversity in AWGN
August 19, 2008 at 6:39 am
Receiver diversity - selection diversity
September 6, 2008 at 2:49 pm
Download free e-book on error probability in AWGN
October 1, 2008 at 9:42 pm
dspLog turns two! Happy Birthday!
October 21, 2009 at 5:56 am

{ 275 comments… read them below or add one }

1 Siti naimah August 6, 2007 at 9:14 pm

Hey your BPSK theory and simulation is very useful.Do you have it for FSK modulation too?If you don’t mind please send to me. thanks.

Reply

2 srinivas March 5, 2009 at 7:50 am

close all
clear all
clc

N = 10^6 % number of bits or symbols
rand(’state’,100); % initializing the rand() function
randn(’state’,200); % initializing the randn() function

% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance
Eb_N0_dB = [-3:10]; % multiple Eb/N0 values

for ii = 1:length(Eb_N0_dB)
% Noise addition
y = s + 10^(-Eb_N0_dB(ii)/20)*n; % additive white gaussian noise

% receiver – hard decision decoding
ipHat = real(y)>0;

% counting the errors
nErr(ii) = size(find([ip- ipHat]),2);

end

simBer = nErr/N; % simulated ber
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
theoryBer1 = 0.5*erfc(sqrt(0.5.*(10.^(Eb_N0_dB/10)))); % theoretical ber

figure
semilogy(Eb_N0_dB,theoryBer,’b.-’);
hold on
axis([-3 10 10^-5 0.5])
grid on
legend(’theory’);
xlabel(’Eb/No, dB’);
ylabel(’Bit Error Rate’);
title(’Bit error probability curve for BPSK modulation’);

figure
semilogy(Eb_N0_dB,theoryBer1,’b.-’);
hold on
axis([-3 10 10^-5 0.5])
grid on
xlabel(’Eb/No, dB’);
ylabel(’Bit Error Rate’);
title(’Bit error probability curve for BFSK modulation’);

In bfsk need double bit error rate to maintain the same avarage error rate in BPSK.
Feeel the difference..

Reply

3 Krishna Pillai March 5, 2009 at 8:34 am

@srinivas: It is not double the bit error. Infact the BER result with BFSK is 3dB poorer than BPSK. You may look @
http://www.dsplog.com/2007/08/30/bit-error-rate-for-frequency-shift-keying-with-coherent-demodulation/

Reply

4 kk November 7, 2009 at 1:44 am

Hey Krishna,

I need help regarding the simulation for the fig 1 for the IEEE paper:
Xiaodi Zhang and N.C. Beaulieu, “A Closed-Form BER Expression for BPSK Using MRC in Correlated CCI and Rayleigh Fading,” IEEE Trans. Communications, vol. 55, no. 12, pp. 2249-2252, Dec. 2007.

I am getting stuck with the simulation code. Can you please give a possible MATLAB code.

kk

Reply

5 Krishna Sankar November 8, 2009 at 8:58 am

@kk: Sorry, I do not have time to simulate that work. Good luck.

6 pvt April 19, 2009 at 3:25 pm

do you have this program write by c++ ?
upload for me ???

Reply

7 Krishna Pillai April 21, 2009 at 5:45 am

@pvt: Sorry, I do not have the c code version

Reply

8 Krishna August 7, 2007 at 10:21 am

Thanks.
I have not checked for FSK modulation. Once I understand, hopefully will be try put together a post.

Reply

9 Sus September 19, 2007 at 9:32 am

Thanks a lot, your BPSK BER was very useful, i got to know about the errors i made when i did the code

Reply

10 Krishna September 23, 2007 at 9:23 am

@sus: Thanks :)

Reply

11 shareef January 23, 2008 at 7:08 pm

Dear Krishna,
Your simulation and theory prgram is very usefull and helpfull.
Could you please send me the syntax matlab comand of QPSK modulation for OFDM under multipath (i.e 3 path) fading.
Very thanks in advance.
shareef

Reply

12 Krishna January 24, 2008 at 8:09 pm

@shareef:
Thanks. The next post is planned to be on OFDM.

Reply

13 David April 2, 2008 at 5:45 am

Hey,
I found theBit error curve for BPSK modulation – theory, simulation very useful. How do we demodulate , decode and compare it with the input signal

Reply

14 Krishna April 2, 2008 at 7:54 am

@ David: Thanks :)

Oh… were you unable to find the Matlab/Octave code? The link to the code is under the heading Simulation model.

Anyways, for BPSK it is simple. We observe the real part of the received symbol. If the real part is greater than 0 decode as +1, if the real part is less than 0 decode as -1.

Once we have the decoded symbols available, the number of differing symbols can be obtained by
nErr = size(find([ip- ipHat]),2);
Ofcourse, using find() is only one among the many different ways to compute this.

Thanks,
Krishna

Reply

15 babar April 11, 2008 at 6:42 pm

why are we using this term 10^(-Eb_N0_dB(ii)/20) in the code to get the final signal y. why cant we write y=s+n; ???????????????

Reply

16 babar April 11, 2008 at 6:46 pm

sorry for my previuos question i got it just after posting my previuos mesg…its coz we want to add the noise to the signal so we need to convert it to dB … right? thnx

Reply

17 babar April 11, 2008 at 6:48 pm

nope i didnt get it plz explain it a bit i shal be thankful

Reply

18 babar April 11, 2008 at 7:12 pm

hello! i am unable to understand the FOR loop operation in this code kindly explain a bit
thnaks in advance

Reply

19 Krishna April 12, 2008 at 7:44 pm

@babar:
The term 10^(-Eb_N0_dB(ii)/20) is for scaling the noise power as per the defined bit to noise ratio. The for loop is for computing the bit error rate for each Eb/N0 value.

Reply

20 srinivas March 11, 2009 at 5:31 pm

Hi..
Why you are multiplying ‘n’ with The term 10^(-Eb_N0_dB(ii)/20).
The didnot understans the concept behind this from the previous posts..

Reply

21 Krishna Pillai March 21, 2009 at 7:09 am

@srinivas: This is to scale the noise term ‘n’, so that we can obtain BER for different values of Eb/No. In the simulations, we define Eb/No in dB. To convert dB to define a scaling term for noise voltage, we use 10^(Eb_N0_dB/20).

Hope this helps.

Reply

22 Jhony May 13, 2008 at 5:54 pm

hi
hope you are doing fine…in the matlab program u have given here, why didnt you use the awgn matlab function to introduce the noise? why have we taken this formula? thanks

Reply

23 Krishna Pillai May 13, 2008 at 7:07 pm

@Jhony: Thanks. Am doing good. How are u? Glad to notice that you are not desperate now :)
Typically, to keep the code simple, I tried to avoid in-built functions. The randn() function + scaling the does the job. Thats all.

Reply

24 Jhony May 13, 2008 at 7:11 pm

yeah ! trying to get hold of things slowly now… i hope u dnt mind me asking foolish and lots of Qz…
about the formula u uzed for awgn … i didnt get how it produces awgn … :(

Reply

25 Krishna Pillai May 13, 2008 at 7:21 pm

@Jhony: The randn() function generates a random variable having Gaussian distribution and the spectrum of this random variable is same across frequencies. Hence the name White Gaussian Noise (WGN).

This is then Added to the signal, hence the name Additive White Gaussian Noise (AWGN)….

Reply

26 Jhony May 13, 2008 at 7:27 pm

1/sqrt(2)*[randn(1,N) + j*randn(1,N)];

1/sqrt(2) ==> this is the scaling term?
j*randn(1,N) ==> this is to generate complex noise values?
I am thankful to u for helping me

Reply

27 Krishna Pillai May 13, 2008 at 7:34 pm

[randn(1,N) + j*randn(1,N)] generates complex Gaussian noise with mean 0 and variance 2. To make the variance to 1, the scaling factor of 1/sqrt(2) is used.

yes, the j term is for complex noise.

Reply

28 Jhony May 13, 2008 at 7:42 pm

thanks alot … u helped me alot i m very happy to learn all this … thanks once again … and plz keep helping me as i want to learn …

Reply

29 Jhony May 15, 2008 at 6:46 pm

hi i hope you are in good health. Can you please tell me what a fading co-efficient is? and what does it signifies in few lines. I shall be very thankful to you.

Reply

30 Krishna Pillai May 17, 2008 at 3:34 pm

@Jhony: If I may put very briefly, fading is the characteristic of the wireless channel. The channel (read enviornment) will vary with time and will exhibit different behaviour for differnt frequencies.

One of the most simplest and useful model of fading is to visualize it as filter whose coefficients change in time.

Ofcourse, this is a simplistic description. For a detailed overview, may I recommend chapter 2 from the book
Fundamentals of Wireless Communication – David Tse, Pramod Viswanath

Reply

31 marjano May 29, 2008 at 9:52 pm

please send me a source code for bpsk modulation in matlab

Reply

32 Krishna Pillai May 30, 2008 at 5:34 am

@marjano:
The link to the code is provided just above the figure. Anyhow attaching the link again
Please click here to downlod

Reply

33 marjano June 8, 2008 at 2:35 am

thank you but it is not exactly what I’m schearching about :/
I need code for modulation BPSK/PM or only BPSK

Reply

34 rahul June 11, 2008 at 8:57 pm

thanks a lot code is very useful

even i want a code using upsampling and pulse sampling in BPSK mod and downsampling and pulse sampling in BPSK demod

Reply

35 Krishna Pillai June 12, 2008 at 5:39 am

@rahul: Thanks.
I believe you are looking for the code for transmit pulse shaing filter. You can look at the article and the code in the posts with the tag ‘pulse-shaping’
http://www.dsplog.com/tag/pulse-shaping/
That should help you get going.

Btw, what is pulse sampling?

Reply

36 Vinay Kumar July 29, 2008 at 12:43 pm

i m very satisfy to this site, bcause it is very hepful to me to make mmy project. if u have bpsk matlab code then send me .

Reply

37 Krishna Pillai July 30, 2008 at 6:11 am

@Vinay:Thanks.
The code is present in this post. Click here to download
http://www.dsplog.com/2007/08/05/bit-error-probability-for-bpsk-modulation/#Simulation%20Model

Reply

38 khurshid September 7, 2008 at 2:56 am

hi, hope every1 doing well. all the posts are very useful
thanks

Reply

39 antiwina September 8, 2008 at 8:16 pm

Hi,

I do not understand why a complex gaussian noise is required. The source here belongs to a BPSK modulation so I think, in practice we have a real noise, because we do just activate the in phase component and not the quadrature phase component.

Reply

40 Krishna Pillai September 9, 2008 at 9:39 am

@antiwina: You are right, the imaginary component is ignored. Infact if you see the simulation model, for demodulating the symbol, we use only the real part of the received signal.

However, our definition of noise is with a variance of N0/2 on the real arm and N0/2 on the imaginary arm.

Reply

41 ravi kumar September 16, 2008 at 11:06 pm

hi,
I do not understand why the BER curves for both BPSK and BPSK with OFDM are almost same where the BPSK with OFDM get
advantage i.e., decrease in BER in case of BPSK with OFDM.
So please give me the idea by differentiate the two curves and how the BER can be decreased with OFDM as soon as possible. iam waiting for u r response hopefully,thanku

Reply

42 farie September 17, 2008 at 2:07 am

hi,

Is there a demodulation matlab code which i can apply on most modulation methods like 8 psk, QPSK, 16QAM..etc.

Also do you have 8psk and 16 QAM modulation and demodulation codes in matlab?

thank you

Reply

43 Krishna Pillai September 17, 2008 at 4:48 pm

@ravi kumar: In AWGN, there should not be any advantage by using OFDM modulation. OFDM can be thought of as a simple up-conversion scheme where each information gets multiplied on different sub-carrier frequencies.

However, the BER difference should come in multipath simulations.

Reply

44 Krishna Pillai September 17, 2008 at 4:52 pm

@farie: The demodulation approaches for PSK is a different from QAM. For 16-PSK case, you can find two posts:

Symbol Error Rate for 16PSK
http://www.dsplog.com/2008/03/18/symbol-error-rate-for-16psk/

Bit error rate for 16PSK modulation using Gray mapping
http://www.dsplog.com/2008/05/18/bit-error-rate-for-16psk-modulation-using-gray-mapping/

You should be able to modify the code for 16-PSK to 8-PSK case.

For 16-QAM case, there are two posts on error rate computation:

16QAM Bit Error Rate (BER) with Gray mapping
http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/

Symbol Error Rate (SER) for 16-QAM
http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/

Hope this helps.

Reply

45 siddhartha September 28, 2008 at 1:22 am

hey krishna,
can you please help me with the case of DPSK

Reply

46 Krishna Pillai September 28, 2008 at 11:28 am

@siddhartha: I have written a post on Coherent deomdulation of DBPSK (Differential Binary Phase Shift Keying).
URI: http://www.dsplog.com/2007/09/30/coherent-demodulation-of-dbpsk/

Please check out. Hope this helps.

Reply

47 Micman October 8, 2008 at 1:02 am

Hello Krishna

Your simulation and theory prgram is very useful. Do you have the matlab code with qpsk symbols ? Would be great !

I want to compare the theoretical bit error curve for qpsk with a simulated bit error curve with a zero force equalizer. Can you please give me an advice of how to implement this.

Thank you in advance

Best regards

Micman

Reply

48 Krishna Pillai October 8, 2008 at 5:51 am

@Micman: Thanks. I have written a post on symbol error rate computation for QPSK in AWGN.
Symbol Error Rate (SER) for QPSK (4-QAM) modulation
URI: http://www.dsplog.com/2007/11/06/symbol-error-rate-for-4-qam/

Maybe that helps.

Reply

49 Hussien October 24, 2008 at 6:24 am

Hi Krishna

thank you very much for Your simulation and theory prgram, really they are very useful. Do you have the matlab code for OFDM with 16-QAM in AWGN and Rayleigh Channels.
Best Regards
Hussien

Reply

50 Krishna Pillai October 24, 2008 at 6:32 pm

@Hussein: Thanks. I do not have the codes, but I would think that it will be reasonable to extend the available simulation models to 16QAM case.
For 16-QAM in AWGN (without OFDM) you may look at the posts,
URI: http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/
URI: http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/

For extending them to OFDM, you may use the following posts as reference:
http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/
http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/

Hope this helps.

Reply

51 poor grad student November 4, 2008 at 10:25 pm

Nice graphics and derivation.

Might want to consider using a separate integration variable for the definition of the erfc function, since the variable x was used for both the erfc argument and integration variable.

Perhaps just use ‘z’ or ‘y’ for the erfc integration variable, i.e., erfc(x) = 2/sqrt(pi) * Integral_x_inf { exp(-z^2/2)*dz } . This will then make it clear that the erfc argument ‘x’ is used to modify the integration limits, as opposed to the actual function being integrated.

Reply

52 Krishna Pillai November 5, 2008 at 5:56 am

@grad student: Yeah, thanks for the suggestion. I agree that your proposal will make the text even more readable.

Anyhow, may I recommend to keep status quo given that the current text is not making it very difficult for the reader.

Reply

53 banovic mladen November 9, 2008 at 1:17 am

exelent!

Reply

54 Sky Stradlin November 14, 2008 at 5:42 pm

for QPSK modulation, the variance is

sigma = 1/sqrt(10.0^(snr/10.0));
sigma=sigma/2;

Do you have any idea why it has to devide by 2?

Thanks alot

Reply

55 Krishna Pillai November 15, 2008 at 8:42 am

@Sky Stradlin: There is noise on the real and imaginary dimension. So, to make the total variance of the complex noise to unity, there is scaling by 1/2.

Reply

56 Ideal November 21, 2008 at 2:15 pm

Dear Krishna,

I have made a program for BER of BPSK in AWGN and Rayleigh fading channel, now I want to combine the both results in one graph, when I combine the results, the curve for rayleigh change but for awgn not change, can you give any idea what should i do, either i make a functions of both separately and call in one program or i should do something else?

anyone have idea about it plz comment

Reply

57 Krishna Pillai November 22, 2008 at 7:51 am

@Ideal: So you are able to plot both the curves using independent functions/scripts, but not able to combine them. Correct? This should be a reasonably easy aspect to resolve.
You can have a main script which generates the transmit symbol, Eb/No values etc. Pass it two function
(a) for awgn channel y = x + n,
(b) for rayleigh channel y = hx+n
Each function will count equalize, count the errors and report the number of errors for each value of Eb/No.

That should address your concern. Hope this helps.

Reply

58 Ideal November 24, 2008 at 4:57 pm

hi
Dear Krishna,

% receiver – hard decision decoding
ipHat = real(y)>0;
here what do you mean by hard decision decoding? plz reply in brief.

Reply

59 Krishna Pillai November 25, 2008 at 5:55 am

@Ideal: It just means that any value of y (real component) greater than 0 is assigned to 1 and if less than 0 is assigned as 0. This is called hard decision decoding.

Soft decisions – where we do not decide on what was transmitted based on the received constellation – are used typically when there is a decoder block (like Viterbi) following the constellation demapping.

Does this help?

Reply

60 Zoe December 22, 2008 at 12:56 am

Hi Krishna,
Thanks for the good information.

Could you shade light on the derivation of Sigma^2 = No/2 from correlation and spectral density of noise stand point?

Thanks,
Zoe

Reply

61 Krishna Pillai December 25, 2008 at 7:29 am

@Zoe: The term N0/2 corresponds to the spectral density of white noise. In typical systems, we experience white noise filtered by an ideal LPF. The variance of this filtered noise contributes to the noise term in the system.
You may look at chapter 9 in Communication Systems – An introduction to Signals and noise in Electrical Communication by A. Bruce Carlson, Paul Crilly, Janet Rutledge for further details.
Hope this helps

Reply

62 mak December 25, 2008 at 6:44 pm

Hi all

hope u all r f9

can any one help me for BER performance of adaptive modulation
(QPSK,4QAM,16QAM)in AWGN only I need to draw them in single graph

thankz in advance

Reply

63 Krishna Pillai December 26, 2008 at 6:17 am

@mak: As I understand from your query, you want to switch from one modulation scheme to another based on a defined error rate constraint. For eg, for lower SNR’ you would want to use BPSK, then move on to QPSK/4QAM for medium SNR’s and then hit 16QAM at high SNR’s.

I do not have any code explicitly doing this, but I would think that it would be reasonably easy to build using the following posts:
(a) Bit Error Rate (BER) for BPSK modulation
(b) Symbol Error Rate (SER) for QPSK (4-QAM) modulation
(c) Symbol Error Rate (SER) for 16-QAM
(d) 16QAM Bit Error Rate (BER) with Gray mapping

Hope this helps.

Reply

64 leth March 4, 2009 at 3:02 pm

dear sir

i want simulation for adaptive modulation

please if have such code send it to me

thanks

Reply

65 Krishna Pillai March 5, 2009 at 5:35 am

@leth; Sorry, I have not discussed adaptive modulation

Reply

66 manju January 26, 2009 at 2:51 pm

hi..how 2 generate -ve rectangular pulse 4 bin sym 0 & +ve rectangular pulse 4 bin sym 1

Reply

67 Krishna Pillai January 27, 2009 at 6:24 am

@manju: You may use the following steps provided in the Matlab code snippet
clear all
N = 7; % number of bits
ipBit = rand(1,N) > 0.5; % random 1’s and 0’s
ipMod = 2*ipBit – 1; % converting 1’s to 1 and 0’s to -1
os = 4; % oversampling factor
ipMod_os = [ipMod; zeros(os-1, length(ipMod))]
ipMod_os = ipMod_os(:).’;
ipMod_filter = conv(ipMod_os,ones(1,os)/os);

Does that help?

Reply

68 wap January 30, 2009 at 12:18 pm

Hi krishna

can any one help me for code SIC (Successive Interference Cancellation).i will tray it for study…..

thanks………………..

Reply

69 Krishna Pillai January 31, 2009 at 6:38 am
70 bullah February 3, 2009 at 9:15 am

who can help me to find the formula bit error rate when coding for bpsk…?

Reply

71 Krishna Pillai February 10, 2009 at 7:18 pm

@bullah: It depends on the coding which is applied. There are couple of posts discussing BPSK in AWGN with rate 1/2 convolutional coding.
Convolutional coding
http://www.dsplog.com/2009/01/04/convolutional-code/
Hard decision Viterbi
http://www.dsplog.com/2009/01/04/viterbi/
Soft input Viterbi
http://www.dsplog.com/2009/01/14/soft-viterbi/

Hope this helps.

Reply

72 invizible soul February 6, 2009 at 1:59 pm

hi hope you are fine. In your code you have scaled the noise with the term 10^(-Eb_N0_dB(ii)/20)
my question is why we do this?I mean why we need to scale the noise power as per the defined bit to noise ratio? Any references will help me a lot
fire back soon plz !!!

Reply

73 Krishna Pillai February 10, 2009 at 7:53 pm

@invizible soul: Sorry for the delayed response. I am traveling with out a reliable access to internet.

In this analysis, our objective is to analyze the impact of noise on the reliable decoding of BPSK modulation. To analyze the impact, we need to find out the performance (bit error rate) for different values of noise. Hence we scale the noise by noise power.

Hope this helps.

Reply

74 invizible soul February 13, 2009 at 6:59 pm

thanx alot krishna … sorry i missed it …

Reply

75 santosh February 21, 2009 at 10:39 pm

@manju I got a better solution for your question.We need to untilmately multiply with standard deviation of noise so we get 20 there.

Reply

76 wap February 9, 2009 at 5:46 pm

thanks khrishna with your help………..

i late reply n visit your site coz im busy….
how abaut this???
% BER_sic=sim_sic_fn(SNR_dB, P, Nb, code_matrix, chan_type)
% return bit error rate of the sic receiver in AWGN or rayleigh fading
%
% PARAMETER:
% SNR_dB=signal-ti-nopise ratio in dB
% P=power control vector, P(i)=transmitted power of i-th user
% Nb=number of transmitted bit
% code_matrix=matrix of the spreading code used
% chan_type=channel type(1=AWGN, 2=rayleigh fading channel)
%
% output:
% BER_sic=bit error of the sic receiver
%
function BER_sic=sim_sic_fn(SNR_dB, P, Nb, code_matrix, chan_type)

BER_sic=zeros(size(SNR_dB));
K=length(P); %number of user
N=size(code_matrix,2); %spreading factor

G(:,1)=code_matrix(33,:)’;
G(:,2:K)=code_matrix(1:K-1,:)’;

Reply

77 Krishna Pillai February 10, 2009 at 8:12 pm

@Wap: Sorry, I did not get your question

Reply

78 invizible soul February 9, 2009 at 6:06 pm

kindly reply me !!! i am still waiting … from where we get this expression:
10^(-Eb_N0_dB(ii)/20)

thnx

Reply

79 nyna February 11, 2009 at 9:49 am

hello..
who will help me to understand the function of a filter in a block diagram of a basic communication system in BPSK?
What the purpose of finding the value of delay in the program of BPSK?

Reply

80 Krishna Pillai February 12, 2009 at 6:44 am

@nyna: Filter is used for controlling the spectrum of the transmission. However, when doing the filtering we do not want to introduce ISI. Hence we typically go for filters like raised cosine etc. You may find some more details @
http://www.dsplog.com/2008/04/14/transmit-pulse-shape-nyquist-sinc-rectangular/
http://www.dsplog.com/2008/04/22/raised-cosine-filter-for-transmit-pulse-shaping/
http://www.dsplog.com/2008/05/01/eye-diagram-plot-matlab-raised-cosine-filter/

Hope this helps.

Reply

81 invizible soul February 11, 2009 at 5:37 pm

hi … i think my username “invizible soul” has really made me invizible :) … as no one has answered my questions …
waitinn……

Reply

82 Krishna Pillai February 12, 2009 at 6:22 am

@invizible soul:
I thought I replied already. Plz check my response @
http://www.dsplog.com/2007/08/05/bit-error-probability-for-bpsk-modulation/comment-page-2/#comment-5038

Reply

83 nyna February 12, 2009 at 6:37 pm

thanks krishna…i’m really appreciate it..thanks so much

Reply

84 mansi February 21, 2009 at 11:09 am

hi i have plotted the results for some coding
i just want is biterr with no coding

i.e. simply take msg, modulate add noise and demodulate

now find the biterr or symerr for oiginal msg and recovered msg

pls help as early as possible

Reply

85 Krishna Pillai February 22, 2009 at 2:42 pm
86 santosh February 21, 2009 at 10:40 pm

sdadasdad

Reply

87 mohamed March 2, 2009 at 3:21 pm

The term 10^(-Eb_N0_dB(ii)/20) is for scaling the noise power as per the defined bit to noise ratio, why divided it by 20 >>??to convert it to voltage

Reply

88 Krishna Pillai March 5, 2009 at 5:05 am

@mohamed: Yes, divided it by 20 is to convert to voltage.

Reply

89 Einstein March 2, 2009 at 3:38 pm

I want to do a matlab simulation for the the GFSK. Plot the BER vs. EbNo.

Reply

90 Krishna Pillai March 5, 2009 at 5:08 am

@Einstein: Sorry, I do not have Matlab simulations with GFSK. However, you may check up the post on BER for FSK in AWGN @
http://www.dsplog.com/2007/08/30/bit-error-rate-for-frequency-shift-keying-with-coherent-demodulation/

Hope this helps.

Reply

91 pragya August 23, 2009 at 1:28 am

sir,
i want matlab programs for MCCDMA,whtever u hve on dis topic ,plz mail me as soon as possible,since MCCDMA is my thesis topic, but i m facing many prblms regarding matlab programs

thank u,
pragya

Reply

92 Krishna Sankar August 24, 2009 at 4:59 am

@pragya: Sorry, I have not written Matlab models on MC-CDMA.

Reply

93 bullah March 3, 2009 at 10:58 pm

hai..krishna..i want ask you the function of hamming code and bCh code..it because i already simulate the block using that coding…can you give me the formula for i’m calculate theory the bit error rate when using coding for i compare between theory and simulate…..also can you give me the graph ber vs Eb/No when coding..tq

Reply

94 Krishna Pillai March 5, 2009 at 5:35 am

@bullah: Sorry, I have not discussed hamming codes or BCH codes till date. You may look at the posts describing convolutional coding and Viterbi decoding @
http://www.dsplog.com/tag/viterbi

Hope this helps.

Reply

95 nyna March 8, 2009 at 7:08 pm

krishna can u help to understand more about the function of transmitter filter in BPSK and also how the ISI(intersymbol interference)will occur at transmitter filter??

Reply

96 Krishna Pillai March 8, 2009 at 7:52 pm

@nyna: In the transmitter, we will first be converting bits into analog voltage (+1/-1 in the case of BPSK). However, we cannot transmit them as is, as it will occupy lots of spectrum (which is not desirable). Hence we need to do filtering. However, when doing filtering, we introduce ISI (inter symbol inteference) i.e each symbol may interfere with the next symbol and so on.

So, the question is: can we do filtering without introducing ISI? The answer is YES. There are simple filters like rectangular, ideal filter like sinc and practical filters like raised cosine, which can do the job. You may read more about them @
http://www.dsplog.com/2008/04/14/transmit-pulse-shape-nyquist-sinc-rectangular/
http://www.dsplog.com/2008/04/22/raised-cosine-filter-for-transmit-pulse-shaping/
http://www.dsplog.com/2008/05/01/eye-diagram-plot-matlab-raised-cosine-filter/

Hope this helps.

Reply

97 shoumi March 10, 2009 at 1:25 pm

hi

I wanna matlab simulation code for AODV routing protocol. Can you help me ….

Reply

98 Krishna Pillai March 21, 2009 at 7:01 am

@shoumi: Sorry, I have not worked on AODV protocol.

Reply

99 Aditya March 13, 2009 at 11:48 am

Hey krishna,

I am new here. I find this site really very useful. Thanks for everything. I have a question reg BPSK sim. I did it with awgn function and I am not getting theo and sim graphs overlapping. Please answer this as soon as you get time . thanks

Reply

100 Krishna Pillai March 21, 2009 at 7:44 am

@Aditya: You should have got similiar curves with awgn() function too. Is the slope of the graphs matching. Then its quite likely some power normalization issue.

Reply

101 nyna March 13, 2009 at 6:54 pm

tq krishna…i understand it more than before..i really appreciate it..
however can i ask u bout the graph of BPSK between simulation and theoretical in term of BER vs SNR…
how the shape of graph become like that?

Reply

102 Krishna Pillai March 21, 2009 at 7:53 am

@nyna: The shape of the curve is determined by the probability of error which we have defined in the post.

Reply

103 Matt K March 17, 2009 at 7:13 pm

Hi there, very useful site. I have a couple of questions regarding the BPSK:

1) Could you go in to a little more detail why you use complex noise vs. real. Although it doesn’t make a difference for BPSK, I’m assuming it actually will with other modulation methods. I didn’t see this in any of my textbooks.

2) In your code for the BPSK, you divide by 20. Shouldn’t that be 10? Given an SNR in dB, we get S/N0 = 10*log(SNR-dB / 10).
This gives N0 for a given signal power S.
The variance^2 = N0/2 and if we assume 0 mean, this gives us our AWGN, which is a random variable describing the noise amplitude. In my simulation, if I use 10 instead of 20, my results were way off, but 10 gives a perfect match with theory.

Thanks much,
Matt

Reply

104 Krishna Pillai March 21, 2009 at 9:04 am

@ Matt K: My replies
1). Yes, for BPSK the noise component on the imaginary arm is ignored. To make the noise model same as with other modulation schemes, I kept it as complex.
2). The division by 20 is to convert the dB to scale the voltage signal. In my simulation model, the noise term n is a Gaussian random variable with mean 0 and variance 1. Therefore, I am scaling the noise voltage by 10^(-Eb_N0_dB(ii)/20)*n. Thats why I used 20.
In general, it depends on how one creates the model. Different people have different coding style. However, its the end result which matters. :)

Hope this helps.

Reply

105 Nafis March 18, 2009 at 4:09 am

Thanks for your codes.It’s helped me a lot.But I want to replace Eb/N0 as SNR how can I do it.Could you pls help me urgently.

Thanking you

Reply

106 Krishna Pillai March 21, 2009 at 9:07 am

@Nafis: For BPSK. Eb/N0 is same as SNR. Agree?

Reply

107 shoumi March 18, 2009 at 2:47 pm

hi
How can i calculate throughtput for a multi-hop wireless network using matlab. please give me some suggestion ragarding this….

thanks

Reply

108 Krishna Pillai March 21, 2009 at 9:10 am

@shoumi: Sorry, am not familiar with modelng multi-hop networks.

Reply

109 Krishna Pillai March 21, 2009 at 9:11 am

@shoumi: Sory, I have not worked on modeling multihop wireless networks.

Reply

110 Krishna Pillai March 21, 2009 at 9:12 am

@shoumi: Sorry, I have not worked on modeling multihop wireless networks.

Reply

111 Shahrukh March 30, 2009 at 10:53 pm

Can someone pls provide me the matlab code for the below mentioned project work:

A randomly generated bit stream should be transmitted through an AWGN channel using BPSK. THe received symbols should then be converted again to a bit stream. The received bit stream should be compared with the original one to determine the total number of errors and hence the bit error probability. The probability of error should be calculated for several values of EB/No.
Once the above system is succesfully simulated an additional block of channel coding should be incorporated in the system. A (15,11) Hamming code should be used for this purpose. Simulation of this should be performed to increase the performance of the system.

RESULT to be DISPLAYED:

1. Bit error probability versus EB/No graph of BPSK
2. Bit error probability versus Eb/No graph of BPSK using equation
3.Bit error probability versus Eb/No graph of BPSK system with channel coding/decoding

The written code shuld allow the user to perform simulation for any number of bits and for any range of Eb/No.

THANKS..

Looking forward for your assitance.

Reply

112 Krishna Pillai April 4, 2009 at 4:26 pm

@Shahrukh: My replies:
1. Example Matlab code is provided in this post
2. The equation for BER for BPSK for a given value of Eb/N0 is provided in this post
3. I have not tried simulating with Hamming code. However, you may check the article on convolutional coding
with Viterbi decoding
http://www.dsplog.com/2009/01/04/viterbi/

Hope this helps.

Reply

113 Shahrukh April 1, 2009 at 8:35 pm

pls sumbody help me out!!!…………:(….

Reply

114 Murali Kris April 8, 2009 at 7:26 am

Hi Krishna,

All your posts have been very helpful and easily understandable. I was looking for a code that has all the modulations(bpsk,qpsk,mpsk,ask,bfsk,msk etc…) in a single program and to compare their BER, PSD curves. please let me know if you have any.

Thanks

Reply

115 Krishna Pillai April 11, 2009 at 6:48 am

@Murali: No, I have not posted a single code putting all the BER curves in a single plot. However, I have discussed about multiple modulation schemes in dspdesignline.com
http://www.dsplog.com/2008/07/08/compare-bpsk-qpsk-4pam-16qam-16psk-64qam-32psk/
Hope this helps.

Reply

116 R@y April 12, 2009 at 12:49 am

Hi, can you help with this issue,consider QPSK transmission over flat fading Rayleigh channels and a 1×2 system.The channels on the different diversity branches are assumed to have the same variance and the noise samples are assumed to be uncorrelated and circularly symmetric Gaussian variables with the same variance.
Consider three combining schemes: MRC, EGC and SC, for plot the BER versus the average signal-to-noise ratio (SNR).
I hope you can help me

Reply

117 Krishna Pillai April 16, 2009 at 5:27 am

@R@y: Using BPSK modulation, I have written articles for a 1 transmit, 2receive system in a flat fading uncorrelated Rayleigh channel.
http://www.dsplog.com/2008/09/06/receiver-diversity-selection-diversity/
http://www.dsplog.com/2008/09/19/equal-gain-combining/
http://www.dsplog.com/2008/09/28/maximal-ratio-combining/
Hope this helps.

Reply

118 Einsein April 12, 2009 at 8:29 pm

Hello,

Do you know how you can build a zero-crossing detector or delay-and-multiply detector for the FSK.

Thanks.

Reply

119 Krishna Pillai April 16, 2009 at 5:35 am

@Einsein: I have written a post on BER computation for FSK using coherent demodulation. That may provide some pointers
http://www.dsplog.com/2007/08/30/bit-error-rate-for-frequency-shift-keying-with-coherent-demodulation/
Hope this helps.

Reply

120 Student April 13, 2009 at 12:30 pm

Dear Krishna Pillai :
How can I change Amplitude Modulation to BPSK(y1 = ammod(x1,Fc1,Fs) to bpsk . I hope for a positive response.
clc
close all
clear all

t = 0:0.00001:0.001;

Fc1 = 1000;

Fs = 12000;
y1 = 1;
x1 = cos(2*pi*1000*t);

in_p = input(’\nDo you want to enter user Y/N: ‘,’s’);

if(in_p == ‘Y’ | in_p == ‘y’)
y1 = ammod(x1,Fc1,Fs);
end

Reply

121 Krishna Pillai April 16, 2009 at 5:40 am

@Student: Sorry, I do not have the functions ammod(). Maybe the post on symbol error rate computation using 4-PAM be of help.
http://www.dsplog.com/2007/10/07/symbol-error-rate-for-pam/

Reply

122 Oluwafemi April 16, 2009 at 9:05 pm

Please i dont know how i can acess the e book.
I am working on super orthogonal space time turbo codes in OFDM systems and will need this e book .Thank u

Reply

123 Krishna Pillai April 18, 2009 at 8:11 am

@ Oluwafemi: I had mailed you the instructions. Please check your inbox.

Reply

124 Student April 29, 2009 at 5:30 pm

Dear Krishna Pillai
How can I correlate demodulated signal and binary code in BPSK ?I mean reteriving back of binary code.

Reply

125 Krishna Pillai April 30, 2009 at 5:44 am

@Student: At the receiver, using hard decision decoding you can find out whether the received symbol is +1 or -1. Then we can easily map to +1 to bit1 and -1 to bit0 respectively.

Reply

126 bwk April 29, 2009 at 6:46 pm

Hi,
I would need equations of bit error probability for this modulation technique: MSK, GMSK, QPSK, ASK. Do you know it?
Thank for answer

Reply

127 Krishna Pillai April 30, 2009 at 5:46 am

@bwk: I have not tried simulating MSK/GMSK. Something to do in future. However, you may look at the posts:
a/. Symbol error rate for QPSK
http://www.dsplog.com/2007/11/06/symbol-error-rate-for-4-qam/
b/. Symbol error rate for 4-PAM
http://www.dsplog.com/2007/10/07/symbol-error-rate-for-pam/

Reply

128 Student April 30, 2009 at 9:37 am

Dear Krishna Pillai
Thanks a lot for ur suggestion.When I domodulate following code it gives a simple sine wave.How can I demodulate it?
close all
b=[0 1 1 0 1 0 1 0 0 1];
fc=10;
n=1;
while n<=length(b)
if b(n)==0 %0 is -1
tx=(n-1)*0.1:0.1/100:n*0.1;
m=(-1)*sin(2*pi*fc*tx);
plot(tx,m,’LineWidth’,1.5);grid on;
else
tx=(n-1)*0.1:0.1/100:n*0.1;
m=(1)*sin(2*pi*fc*tx);
subplot(2,1,1)
plot(tx,m,’LineWidth’,1.5);grid on;
hold on;
end
n=n+1;
end
title(’BPSK modulated Signal’)

How coherent detection can be applied on it?
Thanks in advance.

Regards,

Reply

129 Krishna Pillai May 12, 2009 at 4:39 am

@Student: hmm..let me try to understand. For bit0 you are sending -ve sine wave, and for bit1 you are sending +ve sinewave right. At the receiver you cmay undo the effect of the sine wave by multiplying the received signal with the sine wave and taking the mean. Then perform hard decision decoding on that signal.
Does that help?

Reply

130 Elias April 30, 2009 at 1:42 pm

Bonjour
Je cherche des programmes MATLAB pour la gƩnƩration des codes LDPC Quasi Ciclique
Alors si vous avez des programmes ou des liens utiles priĆØre de me les envoyer a ce mail
eliasknopfler@hotmail.com
Je vous remercie

Reply

131 Krishna Pillai May 12, 2009 at 4:42 am

@Elias: Sorry, I have not discussed LDPC coding till date. Hopefully in the near future.

Reply

132 bowang May 5, 2009 at 7:07 pm

wah ini dia data yang aku cari-cari akhirnya menemukan yang namanya BPSK
thanks yaaaaaaaaaaaaaaaa…
sip sip sip sip

Reply

133 Krishna Pillai May 12, 2009 at 5:10 am

@bowang: good

Reply

134 Student May 6, 2009 at 8:17 am

Dear Krishna Pillai :
Please reply my question dated April 30, 2009 at 9:37 am.

Regards,

Reply

135 Krishna Pillai May 12, 2009 at 5:16 am

@Student: I just did. Hope you are happy with the response. Sorry for the delay in my reply. Good luck.

Reply

136 Student May 12, 2009 at 6:04 pm

Dear Krishna Pillai

Thank u. I am really happy and trying to do what u have suggested.

Reply

137 kanchana May 15, 2009 at 1:09 pm

hello sir

i am doing my project in cdma can u tell me the purpose of rake receiver and details about maximum ratio combining

Reply

138 Krishna Pillai May 20, 2009 at 5:24 am

@kanchana: Well, I have not quite discussed about cdma in the blog till date. Hope to do so in future.
I beleive the intent of the rake receiver is to coherently combine information from all the multipath taps such that the bit-error rate is reduced. I have posted about maximal ratio combining for a 1 transmit 2 receive receive diversity case.
http://www.dsplog.com/2008/09/28/maximal-ratio-combining/
Though the context is different, I think you should be able to adapt that to suit your needs.

Good luck.

Reply

139 Ideal May 27, 2009 at 12:57 pm

Dear Krishna
how can we simulat the angular delay profile. can you just give me simple example plz?

Reply

140 Krishna Pillai May 31, 2009 at 8:31 pm

@Ideal: Sorry, am not familiar with modeling angular profile.

Reply

141 aam_log May 28, 2009 at 7:26 pm

Dear krishna
I hope you are fine. I am in 5th semister of my bachelors of telecommunications. So I am new to this field and facing lots of difficulties. I find your site very impressive and have joined it recently. Can you kindly tell me why we normalize things? thnx

Reply

142 Krishna Pillai May 31, 2009 at 8:36 pm

@aam_log: Good luck for your studies. We normalize, because we want to have a fair comparison when trying out different approaches….

For eg, if we are comparing 100apples with 100grapes, we would want to know the price per kilogram, no?

Reply

143 maya May 29, 2009 at 5:38 pm

HEY sir can u plzz help me in getting the main concept of vblast detection scheme,,i am not geting how it estimates the data…

Reply

144 Krishna Pillai May 31, 2009 at 8:43 pm

@maya: Well, understanding V-BLAST with Zero Forcing equalization is the most simplest way. From our linear algebra days, we know that if we have two unknowns, we need atleast two equations to solve them.

Adapting them to MIMO V-BLAST, the two unknowns are the unknown transmitted data, and the two equations are provided by the two receive antennas. Just putting a simple example,
y1 = a*x1 +b*x2
y2 = c*x1 + d*x2
where
y1, y2 are received symbols
a,b,c,d are channel taps (which are known) and
x1, x2 are unknown transmit symbols.

The following post might be of bit more help.
http://www.dsplog.com/2008/10/24/mimo-zero-forcing/

Hope this helps.

Reply

145 maya May 31, 2009 at 10:26 pm

thnx for ur response,,it means dat u need to have atleast 2 no of rcvd bits at da reciever 2 be compared..but my confusion is that how to use vblast when i am considering diversity mimo,where i have to use combing technique first?? can i implement vblast in dat case or not???

Reply

146 Krishna Pillai June 1, 2009 at 5:22 am

@maya: Well, try to write the equation in matrix form. For eg, consider a simple case where we have two transmit antennas and 3 receive antennas. The matrix dimensions will be of:
y = Hx + n, where
y – received symbols of dimension [nrx x 1]
H – channel matrix of dimension [nrx x ntx]
x – transmit symbols of dimension [ntx x 1]
n – noise of dimension [nrx x 1]

If we write the zero forcing equalizer for this equation, then we can find that
W = (H^H*H)-1*H^H

This equalization also performs the diversity combining via Maximal Ratio Combining way. Does this help?

Reply

147 M S Sasidhar June 2, 2009 at 1:15 pm

hi every body can any one tell me the code for “signal to noise ratio using autocorrelation in time domain” using MATLAB

thanks in advance…..

Reply

148 Krishna Pillai June 7, 2009 at 1:57 pm

@sasidhar: The question is not clear to me. Can you please provide some more details….

Reply

149 Eduardo Solano June 4, 2009 at 1:55 am

i have a question..
i have a program wich makes bpsk modulation and i need to show Bit error curve for BPSK modulation – theory, simulation (both) as you do here in this page at top.

ok but there is something that happens with simulation curve that appears a little bit more to the right side of teoric curve.

i wanna know a reason why does it happens.

Reply

150 Krishna Pillai June 7, 2009 at 2:11 pm

@Eduardo Solano: If the simulation curve is happening to the right of the theoretical curve, it typically means that you are adding more noise than what is required. Also make sure that you simulate for atleast 10^6 bits, such that you get statistically accurate results.

Reply

151 Assad Abbasi June 6, 2009 at 1:03 am

Dear Krishna, thanks for your codes. I am plotting BER for BPSK and QPSK but i am not getting same BER curve. As it should be same for both. I know that the plot should be BER vs EbN0. But how to get EbN0 from SNR? In your codes you have written Eb_N0_dB, is this EbN0?? I think it is SNR. If this is EbN0, why am i not getting same curve for BPSK and QPSK… Please Help

Reply

152 Krishna Pillai June 7, 2009 at 2:31 pm

@Assad Abbasi: Well, as you said BER vs EB/N0 curve for both BPSK and QPSK should be comparable. In general,
Es/N0 = kEb/N0, where k = log2(M) and M is the constellation size.

I have discussed a post comparing BPSK, QPSK, QAM etc @ http://www.dsplog.com/2008/07/08/compare-bpsk-qpsk-4pam-16qam-16psk-64qam-32psk/
Hope this helps.

Reply

153 Mathew June 8, 2009 at 2:37 am

Have you got any code to 16-apsk?

Reply

154 Krishna Pillai June 8, 2009 at 6:02 am
155 Mathew June 9, 2009 at 6:21 pm

I mean 16-apsk modulation sth like that http://commons.wikimedia.org/wiki/File:Const_16APSK.gif

Reply

156 Krishna Pillai June 10, 2009 at 5:25 am

@Mathew: Sorry, I have not tried simulating 16-APSK. Thanks to you, I just realized that it is used in DVB-S2. I will try to do a write up in future.

Reply

157 RAO June 9, 2009 at 8:12 pm

Hello.

I need matlab code for DPSK and also its BER.

regards,

Reply

158 Krishna Pillai June 10, 2009 at 5:26 am

@RAO: I have a post on Coherent Demodulation of DBPSK
http://www.dsplog.com/2007/09/30/coherent-demodulation-of-dbpsk/
Hope this helps.

Reply

159 RAO June 10, 2009 at 3:58 pm

thanks Krishna.

Actually i need matlab code for non-coherent detection of either bpsk or dpsk and also corresponding BER vs Eb/No plots.

regards,

Reply

160 RAO June 10, 2009 at 4:00 pm

sorry. in addition, i want noncoherent detection of bpsk or dpsk for both AWGN AND RAYLEIGH channel.

regards,

Reply

161 Krishna Pillai June 11, 2009 at 4:50 am

@RAO: Sorry, I have not tried simulating non-coherent detection dpsk.

Reply

162 RAO June 12, 2009 at 5:12 pm

Thanks Krishna for reply.

I want to plot BER vs Eb/No for MPSK and MDPSK. Can u help me in this regard ?

Also do u have code for FSK coherent and non-coherent with corresponding BER vs Eb/No plot?

163 Olguin June 10, 2009 at 2:55 pm

first of all, thanks a lot for ur job, it“s really useful for all the DSP internet communty.

here my question, I“m carrying out some simulations on simulink. modulating BPSK, spreading w/ gold code, going through awgn, despreading and demodulating BPSK, and at the end I measure the BER.

using simple BPSK mod/demod provided in the communications block set, IĀ“ve got a relative high BER (.5), then I found the so-called “Real BPSK mod/demod” which basically a “real-imag to complex”/”complex to real-imag” block is added to the BPSK mod/demod, and the resulting BER is around .1.

I“ve tried to find unsuccessfully an explanation to this on technical literature.

maybe you know something about that.

Thanks in advance.

Reply

164 Krishna Pillai June 11, 2009 at 4:49 am

@Olguin: Well, having BER of 0.5 means there is some error in the simulation code. If you wish you refer the post on
(a) BPSK BER with matched filtering
http://www.dsplog.com/2009/05/08/ber-with-matched-filtering/

Hope that helps you to debug the code.

Reply

165 RAO June 13, 2009 at 12:30 am

Thanks Krishna for reply.

I want to plot BER vs Eb/No for MPSK and MDPSK. Can u help me in this regard ?

Also do u have code for FSK coherent and non-coherent with corresponding BER vs Eb/No plot?

Your early response will b highly appreciated.

Reply

166 Swetha June 18, 2009 at 10:24 am

Hi All,

Can any one guide me to good source…
How to calculate Bit error probability for given SNR, any modulation technique with error correcting codes(convolution coding).

Please give some information on this.

-Thanks
Swetha

Reply

167 Krishna Pillai June 21, 2009 at 12:48 pm

@Sweta: The book Digital Communications by John Proakis is a good reference

Reply

168 komari June 22, 2009 at 11:20 pm

please can you tell me what does this instruction do exactly

ipHat = real(y)>0;

is it equivalent to
if (real(y)>0)
ipHat = 1
else
ipHat = 0
end

Thanks

Reply

169 Krishna Pillai June 23, 2009 at 4:40 am

@komari: Your explanation is correct.
As you may be aware, Matlab provides lots of ‘quick one liner’ ways to do things. :)

Reply

170 Ali June 23, 2009 at 8:36 pm

Ok Thanks very much krishna :)

Reply

171 ahmed June 23, 2009 at 8:41 pm

Hello
i just want to ask about this statement in the code
ipHat = real(y)>0;
what exactly it do
is it equivalent to
if real(y)>0
real(y)=1
else
real(y)=1
end

Thx

Reply

172 Krishna Pillai June 25, 2009 at 5:47 am

@ahmed: No, your explanation is not correct. As komari mentioned, it is equivalent to
if (real(y)>0)
ipHat = 1
else
ipHat = 0
end

Reply

173 jo June 23, 2009 at 9:14 pm

i wanna know what does this statement exactly do
ipHat = real(y)>0;

is it equivalent to
if real(y)>0
real(y)=1
else
real(y)=0
end

thanks

Reply

174 Krishna Pillai June 25, 2009 at 5:48 am

@jo: Plz refer the reply provided to ahmed

Reply

175 Srinivas June 27, 2009 at 10:13 pm

Can anyone help me out with a matlab code for this.
For ISI channel with L real coeffnts and BPSK modulation write a Viterbi algo decoder with decoding delay >0

Reply

176 Krishna Pillai June 30, 2009 at 5:10 am

@Srinivas: I have not done MLSE equalization in multipath channel, but plan to do that in near future.

Reply

177 Srinivas June 27, 2009 at 10:25 pm

Can someone help me out with a Matlab code for this.
For ISI chanell with real coeffnts and BPSK modulation write a Viterbi algo decoder with decoding delay >0 (say ‘delta’)

plot BER vs SNR for varying ‘delta’s

Reply

178 Moon June 29, 2009 at 5:39 pm

Thank you for your effort…
i have some question
1. y = s + 10^(-Eb_N0_dB(ii)/20)*n;
2. theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10)))
i don`t know why Eb_N0_dB(ii) has minus value…
and
At first term,^(-Eb_N0_dB(ii) is divided by 20 but, at second term Eb_N0_dB is divided by 10.
Why Eb_N0_dB is divided by diferrent value??
My question is very poor, nevertheless i will wait for your comment
Have a nice day

Reply

179 Krishna Pillai June 30, 2009 at 5:14 am

@Moon: My replies
1/ Before this scaling, the signal term s and the noise term n has the same variance of 1. The term -Eb_N0_dB reduces the noise variance
2/ The scaling is happening on the noise voltage signal, hence the factor of 1/20. In the theoretical equation, note that there is a square root term outside the 1/10 factor. This is equivalent to having 1/20 factor. Agree?

Reply

180 BOUHAFS July 1, 2009 at 10:18 pm

please simulation for BER MIMO (2,2)

Reply

181 Krishna Pillai July 2, 2009 at 5:24 am

@BOUHAFS: Please refer to the post
http://www.dsplog.com/2008/10/24/mimo-zero-forcing/

Reply

182 Vijay July 7, 2009 at 11:05 am

Hi, I am want to plot the pdf for various SNR(Symbol Error) for various modulation schemes. Do you have matlab code for it.

The derivation in this link is SER Vs SNR, How to change the SER to PDF(of SNR)?

Thanks in advance

Reply

183 Krishna Pillai July 15, 2009 at 4:42 am

@Vijay: I have written an article on error rate for various modulation schemes in dspdesignline.com @
http://www.dspdesignline.com/howto/208801783;jsessionid=3ISGUXHINOVIAQSNDLRSKHSCJUNN2JVN?pgno=1

Further, you may also check out the post
http://www.dsplog.com/2008/10/01/download-free-e-book/

Reply

184 leth July 18, 2009 at 9:04 am

hi
i need matlab code for adaptive modulation from BPSK,QPSK,16QAM,64QAM

so if you have not such code, i hope to guide me how to make it , as you know for low SNR we use like BPSK and for high SNR use like 64QAM

so how to make this via matlab?

regards

Reply

185 Krishna Pillai July 19, 2009 at 8:58 am

@leth: I do not have a code combining BPSK/QPSK/QAM etc to do adaptive modulation. However, you may find individual posts describing these modulation schemes @ http://www.dsplog.com/2008/10/01/download-free-e-book/
As you said, one way to make an adaptive modulation scheme is to define a BER threshold (lets say 10^04) to switch from one modulation scheme to another.

Reply

186 leth July 18, 2009 at 10:07 am

hi can you tell me how to make adaptive modulation ?

thanks

Reply

187 gdkorde July 25, 2009 at 6:01 pm

plz help me for changing code rate and delay spread in bpsk modulation used in hiperlan/2

Reply

188 Krishna Pillai July 28, 2009 at 4:29 am

@gdkorde: Quick questions:
1/ What is the coding technique used ? Convolutional coding?
2/ What is the model of the multipath channel? Exponential model?

Reply

189 sam July 30, 2009 at 2:29 pm

hi kirishna pillai
i need simulink’s (matlab) block for accunting BPSK BER
thanks

Reply

190 Krishna Sankar July 31, 2009 at 4:53 am

@sam: Sorry, I do not have Simulink.

Reply

191 Diego July 31, 2009 at 5:54 am

Hi, my english is not very good looking, but…what is the noise variance for 16QAM and 64QAM?, AWGN channel.

Reply

192 Krishna Sankar August 5, 2009 at 5:39 am

@Diego: The noise variance is independent of the modulation scheme. However, I think you might be looking for error rate for different modulation schemes for a given value of noise variance. You may refer posts:
http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/
http://www.dsplog.com/2008/03/29/comparing-16psk-vs-16qam-for-symbol-error-rate/
http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/
http://www.dsplog.com/2008/07/08/compare-bpsk-qpsk-4pam-16qam-16psk-64qam-32psk/

Reply

193 sam August 1, 2009 at 1:51 pm

hi everybody
i need simulink’s (matlab) block for accunting BPSK BER

Reply

194 Alex August 14, 2009 at 5:00 am

Hi Pillai

I would like to ask you a simple question. I am trying to make a simple simulation using a matlab. It is about that one node using SF(spreading factor)=2, and another node using SF = 8 (orthogonal to each) are encoding the data and sending to one node (asynchronous network) with same power but from different distance at the same time. how can i simulate it? when decoding at the receiver, it uses same ovsf code as the node using SF = 8.

Thanks in advance.

Reply

195 Krishna Sankar August 14, 2009 at 5:15 am

@Alex: Well, let me try to write the pseudo code for this case
y1 = x1*code1; % code with SF=2
y2 = x2*code2; % code with SF=8
n = noise; % AWGN noise, lets take mean=0, variance = 1
r1 = y1*scaling1; % scaling factor for first signal
r2 = y2*scaling2; % scaling factor for second signal
r = r1+r2+n; % receiver collects both signals corrupted by noise
x2Hat = r*code2 % receiver tries to correlate r with code2 to recover x2.

Makes sense?

Reply

196 I.Selvadenniz August 17, 2009 at 5:51 pm

hi,can any one help me to derive BER for physical layer network coding(PNC) modulation scheme…:-)

Reply

197 Krishna Sankar August 18, 2009 at 3:53 am

@Selvadenniz: Sorry, have not studied PNC coding.

Reply

198 tommy October 16, 2009 at 5:19 pm

hiii… you have BER for physical layer network coding(PNC) modulation scheme….

Reply

199 Krishna Sankar October 17, 2009 at 4:15 am

@tommy: Sorry, no

Reply

200 Tito August 27, 2009 at 5:28 pm

Hi Krishna,

I am working on Forward error correction codes. I have plotted the BER performance curve for Reed solomon codes using BPSK modulation over an AWGN channel from EbNo 0 – 1 . However, the curves are overlapping at the begining between EbNo values 0 and 1 and also in the middle.

Also the curves for convolutional codes overlap at the begining between 0 and 1. and also in the concatenated codes.

Could you please give me a detailed explanationc on the reason why the overlapping occurs and the significance.

The RS codes used were RS(255,191), RS(255,223), RS(255,239) and RS(255,247).
Thanks, hope to hear from you soon.

Reply

201 Krishna Sankar September 7, 2009 at 5:13 am

@Tito: Firstly, a clarification. When you mentioned about “curve-overlapping”, I guess you meant that – “with coding, the BER becomes poorer than no coding for very low values of Eb/N0″. Agree?

At-least with respect to convolutional codes, I think it can be attributed to the large number of errors in received coded bits, which makes the Viterbi algorithm go haywire.

Reply

202 Tito September 8, 2009 at 7:28 pm

Thanks that is exactly what i mean. Why does this occur.
And i also have an curve RS curve with and without an interleaver, these curves are overlapping at two points. Why does this occur.

Reply

203 thenmozhi September 5, 2009 at 9:30 pm

can you send me the matlab coding for physical layer network coding modulation

Reply

204 Krishna Sankar September 9, 2009 at 5:43 am

@thenmozhi: Sorry, I do not have matlab code for physical layer network coding modulation

Reply

205 Anvesh September 13, 2009 at 11:37 am

Thanks a lot, man.
Was very useful.

Reply

206 Hung October 7, 2009 at 8:00 am

hello Krishna Pillai!
I’m a student in Ho Chi Minh City, Viet Nam. I’m searching about “the impact of real channel over MiMo system”. your code is useful. So, we assume that receiver is unknown h matrix and we must explore channel by channel estimation. Do you help me?
Hope you will response me!

Reply

207 Krishna Sankar October 8, 2009 at 5:35 am

@Hung: Yes, the receiver is trained to estimate the MIMO channel by sending known preamble.

Reply

208 ahmed October 8, 2009 at 12:42 am

I knew that OFDM technique, improve the BER performance in frequency selective fading channel, Can you help me in writing code using matlab program show that , I have probem in how write code for frequence selective fading.
Thank you .

Reply

209 Krishna Sankar October 8, 2009 at 5:41 am

@ahmed: In OFDM, though the channel is frequency selective, channel as seen by each subcarrier is flat. Hence the expression for flat fading holds good. Please refer to the post http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/

Reply

210 najat October 8, 2009 at 12:44 am

Dear Krishna:
I knew that OFDM technique, improve the BER performance in frequency selective fading channel, Can you help me in writing code using matlab program show that , I have probem in how write code for frequence selective fading.
Thank you .

Reply

211 Ajay Pratap Singh October 8, 2009 at 2:07 pm

This Krishna Pillai guy is a great help and his website undoubtedly very good resource on communication system topic. I got necessary informations about Vitervi Algorithm, Hard and soft decision.

Ajay Pratap Singh apts

Reply

212 Krishna Sankar October 12, 2009 at 5:27 am

@Ajay: Thanks for the nice words.

Reply

213 christine October 13, 2009 at 11:21 am

Thank you for this website ,it is awesome
could you help me to know what is the role of the following

rand(’state’,100); % initializing the rand() function
randn(’state’,200); % initializing the randn() function
thank you

Reply

214 Krishna Sankar October 15, 2009 at 5:22 am

@christine: The random numbers generated by the program can be initialized to enable us to run multiple simulations with the ‘exact same’ random numbers ;) . Setting the state of the rand() or randn() enables one to do so.
Use >>help rand or >> help randn to get more information.

Reply

215 3mor October 25, 2009 at 2:59 pm

Hi Krishna,

thanx a lot for your website

i have a simple question:

what about the unequally probable, e.g. when P(s0)=0.25 & P(s1)=0.75 ??

Reply

216 Krishna Sankar October 27, 2009 at 5:45 am

@3mor: If the probabilities are un equal, we would want to shift the threshold for making the decision. The chapter 5.1.3 Digital Communications by John Proakis discuss that case.

Reply

217 Egerue Nnamdi November 2, 2009 at 10:26 pm

Hi krishna, I have actually read the answers given to you by the concerns generated by the formula below
10^(-Eb_N0_dB(ii)/20)*n
for further clarification, i have actually divided by 18,16,14,12——3 to get different plots that actually decreases down the graph . Want to know if is how one can plot for BER with variable noise in the channel. I will appreciate if you reply me soon. Thanks

Reply

218 Krishna Sankar November 8, 2009 at 8:39 am

@Egerue: Do not change the division factor. Rather change the value of Eb_N0_dB. The division by 20 is required to convert dB into voltage.

Reply

219 Egerue Nnamdi November 4, 2009 at 2:19 pm

Hi krishna, I have actually read the answers given to you by the concerns generated by the formula below
10^(-Eb_N0_dB(ii)/20)*n
for further clarification, i have actually divided by 18,16,14,12——3 to get different plots that actually decreases down the graph . Want to know if is how one can plot for BER with variable noise in the channel. I will appreciate if you reply me soon. Thanks

Reply

220 Egerue Nnamdi November 8, 2009 at 8:00 pm

Hi Krishna.
Thank you very much. God will bless you. Below is the answer you gave me for my concern on this formular 10^(-Eb_N0_dB(ii)/20)*n
“Do not change the division factor. Rather change the value of Eb_N0_dB. The division by 20 is required to convert dB into voltage”.
Please give me more direction, by giving me an example of what you mean by changing the VALUE of Eb_No_dB.
Am thinking is Eb_No_dB =[0:10], [0:20], [0:30] and so on, but am not very sure. Pls, you are indeed a very good teacher, help me out

Thanks, you are really very helpful, you must really reap the fruit of your efforts.
NNAMDI

Reply

221 Krishna Sankar November 12, 2009 at 5:33 am

@Egerue:
You are right.
Eb_No_dB =[0:10], –> 0 to 10dB in steps of 1dB
Eb_No_dB =[0:20], –> 0 to 20dB in steps of 1dB
Eb_No_dB =[0:30], –> 0 to 30dB in steps of 1dB

Reply

222 Egerue Nnamdi November 9, 2009 at 2:29 am

Hi Krishna.
Thank you very much. God will bless you. Below is the answer you gave me for my concern on this formular 10^(-Eb_N0_dB(ii)/20)*n
ā€œDo not change the division factor. Rather change the value of Eb_N0_dB. The division by 20 is required to convert dB into voltageā€.
Please give me more direction, by giving me an example of what you mean by changing the VALUE of Eb_No_dB. or how do we get the value
Am thinking is Eb_No_dB =[0:10], [0:20], [0:30] and so on, but am not very sure. Pls, you are indeed a very good teacher, help me out

Thanks, you are really very helpful, you must really reap the fruit of your efforts.
NNAMDI

Reply

223 Egerue Nnamdi November 9, 2009 at 3:09 am

Hi krishna
Pls in essence how and where do we set the different values for EbNo/ or S/N or SNR to achieve different BER plots using your simulation example. Pls i will appreciate ur reply.

Thanks

Reply

224 Krishna Sankar November 12, 2009 at 5:39 am

@Egerue: Change Eb_N0_dB

Reply

225 Egerue Nnamdi November 10, 2009 at 3:42 pm

Hi krishna
Pls in essence how and where do we set the different values for EbNo/ or S/N or SNR to achieve different BER plots using your simulation example. Pls i will appreciate ur reply.

Thanks

Reply

226 student November 10, 2009 at 9:03 pm

Hi Krishna,

I was working on a IEEE paper titled”Xiaodi Zhang and N.C. Beaulieu, “A Closed-Form BER Expression for BPSK Using MRC in Correlated CCI and Rayleigh Fading,” IEEE Trans. Communications, vol. 55, no. 12, pp. 2249-2252, Dec. 2007.”.
Since you have also worked on similar field, I hope u can help me..

I was stuck with re creating the 1st fig in the paper.
SO, can you please look into it and help me out..

Thanks,
Student

Reply

227 Krishna Sankar November 13, 2009 at 5:29 am

@student: Sorry, due to time constraints, may I pass that opportunity. Good luck.

Reply

228 Jatin Chakravarti November 10, 2009 at 11:18 pm

Hi…
I need to Simulink Probability of error for PSK, 16QAM & MFSK. but don’t know how to simulink the equation: Pe=0.5*erfc(sqrt(snr)).
I tried to call the fuction from Matlab using Embedded Function Block in Simulink. But, the program din’t work. Can u suggest me a Block for finding Pe or a Program to call from .m file..?

Reply

229 Krishna Sankar November 13, 2009 at 5:31 am

@Jatin: Does this help?
Eb_N0_dB = [-3:10];
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
close all; figure;
semilogy(Eb_N0_dB,theoryBer,’b.-’);

Reply

230 Faisal November 11, 2009 at 2:20 am

I am working on an adaptive modulation model on Simulink. For that first I am trying to get probability of error rate vs snr of different modulation techniques. On modelling 16 QAM modem I have problem plotting its graph by getting bit err rate from simulink model and performing graph plotting on matlab. following is the code im using in matlab..

clear; clf;
M=16; % for simulink
snr=0:10;
err_vec=[];

for i=1:length(snr)
EbNo=snr(i);
sim(’QAM_16′);
err_vec(i)=bit_err_rate(1);
end;
semilogy(EbNo,err_vec,’b-*’);
grid on

please guide what is the error in this code… thanks

Reply

231 Krishna Sankar November 13, 2009 at 5:34 am

@Faisal: For BPSK,
Eb_N0_dB = [-3:10];
theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
close all; figure;
semilogy(Eb_N0_dB,theoryBer,’b.-’);

Reply

232 Hamid November 25, 2009 at 4:37 pm

hi

Why you are using 10^(-Eb_No_db(ii)/20) the minus sign in this formula because for voltage scaling it should be 10^(Eb_No_db(ii)/20).

Reply

233 Krishna Sankar December 7, 2009 at 4:34 am

@Hamid: The negative sign came as I am scaling the noise voltage. I am keeping the signal swing the same and reducing the swing of noise voltage to simulate various Eb/N0 values.

Reply

234 Obinna O November 26, 2009 at 1:09 am

Please guys I am having trouble writing a code for non coherent detection, I am required as part of my project to Assume Rayleigh fading channel with BPSK modulation. Using MAT-LAB plot bit error probability (BEP) under non-coherent de-tection. Your ĀÆgures should include plots from both analysis and simulation.Use average SNR (complex) from -5 to 20 dB.

Thanks a lot, i will be very grate ful to get help from you guys.

Reply

235 Krishna Sankar December 7, 2009 at 4:38 am

@Obinna O: Hope you have finished the project by now. Hope this post might be of help
http://www.dsplog.com/2008/08/10/ber-bpsk-rayleigh-channel/

Reply

236 alok joshi November 27, 2009 at 7:48 pm

hi sir
i have problem in BPSK with RS codes…..when i/p is given to pskmod function it says that “does not support complex airthmatic”.however i/p given is in 1 0 form

Reply

237 Krishna Sankar December 7, 2009 at 4:42 am

@alok joshi: Sorry, I do not have the pskmod() function.

Reply

238 rai December 3, 2009 at 9:10 am

is erfc equal Q function?

Reply

239 Krishna Sankar December 7, 2009 at 5:09 am

@rai: No, erfc is not equal to Q function, but both are related.
http://en.wikipedia.org/wiki/Q-function

Reply

240 shadat December 6, 2009 at 2:09 pm

hi krisna,
i hope you are fine.plz could you send me BPSK,QPSK,16QAM,64QAM modulation and demodulation simulation in matlab and simulation of adaptive modulation of convolutionaly coded for BPSK,QPSK,16QAM,64QAM?please help me.

Reply

241 Krishna Sankar December 7, 2009 at 5:27 am
242 Krishna Sankar December 7, 2009 at 5:27 am
243 fatima December 7, 2009 at 1:20 am

Hi Krishna
I need to Simulink Probability of error for binary symmetric channel if you don’t mind.

Reply

244 Krishna Sankar December 7, 2009 at 5:33 am

@fatima: I believe it should be reasonably straightforward to modify the gaussian channel used in this post to a binary symmetric channel. good luck.

Reply

245 adah December 10, 2009 at 5:41 am

Hi Krishna,

Actually, im studying about your coding for BER vs SNR for BPSK modulation. For simulation, when i changed the value for EbNodB = [-3:10] to [1:10], i cant get the result. why this problem happened?

Reply

246 Krishna Sankar December 10, 2009 at 10:12 am

@adah: What is the error which you are getting?

Reply

247 rama krishna December 14, 2009 at 11:29 am

i am doing simualtion to find the ber of bpsk modulation in pass band case.could you help me.

Reply

248 Krishna Sankar December 22, 2009 at 5:39 am

@rama: Please ask queries. I will try to answer to the best of my knowledge.

Reply

249 mouhamed December 16, 2009 at 10:04 pm

i want matlab programs for ‘BER MIMO’,thank u,please help me

Reply

250 Krishna Sankar December 23, 2009 at 5:25 am

@mouhamed: Please look at http://www.dsplog.com/tag/mimo

Reply

251 waheed December 17, 2009 at 6:23 pm

Hello friends: i am working on MAP , ML decoding for convolutional codes..is there any one who too work on similar field ..?

Reply

252 Krishna Sankar December 23, 2009 at 5:29 am

@waheed: For the Viterbi way of ML decoding, you may look at
http://www.dsplog.com/tag/viterbi

Reply

253 adah December 21, 2009 at 4:36 am

dear krishna…

From my past question, actually i got my result and understand..but..i have a problem with my coding…can you help me please…
My coding…
%directional antenna
d=100;
Pt=100:100:1000;
theta10=10*pi/180;
v=int(’cos(x)*sin(x)’,0,pi/2);
x=int(v,’x',0,2*pi);
gt10=(4*pi)*cos(theta10)/double(x);
grd=180*pi/180;
c=3e8;
f=2.4e9;
L=1;
lamda=c/f;
Pr10=(Pt.*gt10.*grd)./(((4.*pi.*d)./lamda).^2)*L;

%power noise
k=1.38e-23; %k=Boltzman’s constant
t=300; %t=noise temperature in Kelvin
b=5e6; %b=bandwidth
Pn=k*t*b;

%directional antenna
snr10=Pr10/Pn;

Rb=54e6;
ebno10=snr10/Rb;

ebno101=10.*log10(ebno10);

N = 10^6; % number of bits or symbols
rand(’state’,100); % initializing the rand() function
randn(’state’,200); % initializing the randn() function

% Transmitter
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance
% Eb_N0_dB = [-3:10]; % multiple Eb/N0 values
% k=1:1:10;
%
% for ii = 1:length(k)
% % Noise addition
% yomni = s + 10.^(-k(ii)./20)*n; % additive white gaussian noise
%
% % receiver – hard decision decoding
% ipHatomni = real(yomni)>0;
%
% % counting the errors
% nErromni(ii) = size(find([ip- ipHatomni]),2);
%
% end

for ii = 1:length(ebno101)
% Noise addition
y10 = s + 10.^(-ebno101(ii)./20)*n; % additive white gaussian noise

% receiver – hard decision decoding
ipHat10 = real(y10)>0;

% counting the errors
nErr10(ii) = size(find([ip- ipHat10]),2);

end

simBer10 = nErr10./N;
k1=1:1:10

figure
%semilogy(k,simBeromni,k1,simBer10)
semilogy(k1,simBer10)
grid on
legend(’theta=10′)
xlabel(’Eb/No, dB’);
ylabel(’Bit Error Rate’);
title(’Bit error probability curve for BPSK modulation in simulation’);

when i changed the Pt=10:10:100; actually i got the result..can you help me pliz….

thanks a lot…

Reply

254 Krishna Sankar December 23, 2009 at 5:47 am

@adah: what is the problem which you are seeing?

Reply

255 adah December 30, 2009 at 7:12 am

dear krishna…

In theory, when i applied my SNR into your coding, i got the result.
But, when i applied my SNR into your coding for simulation, i got the problem. I think that problem occurred at SNR or BER. But i dont know where my coding is problem? Can you help me pliz…
Thanks a lot..

Reply

256 Mitoo2007 December 27, 2009 at 3:10 am

please can u help me in this project ::::–

2) final report(OFDM):

* genearte large no of bits using randint

* modulate the data once with bpsk & then 16-QAM

* bpsk mod is 2*data-1

* after modulation u should loop on the data with step of 64’s

each time calculating their ifft

* add the noise to each 64

* if u remeber how to add noise then do it as u know,
else use awgn

sigandnoise=awgn(signal, SNR in dB , ‘measured’ )

* do fft with steps of 64’s , the same groups of symbols that were ifft’ed

* demodulate the data ( if bpsk then bits= recdata > 0)

*calculate ber using
ber=sum(xor( transmitted bits , received bits ) )

* the whole program should be done in a large loop that loops over

SNR -5 -> 15

* in case of fading
multiply with channel before ifft then divide after ifft

* multiplication is done using (.*) not just (*)

Reply

257 Winnie December 31, 2009 at 8:42 am

Hi Krishna,
I know the BER of BPSK is 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))),
if I put channel coding before the modulation,and the code rate is R,
then if the BER equals 0.5*erfc(sqrt(R*10.^(Eb_N0_dB/10)))?
then BER with code rate 1/2 is higher than 3/4,but acturally ,it should be
lower. where is my mistake ?

Hoping for your help, thank you

Student

Reply

258 abhishek January 4, 2010 at 8:00 pm

please give help about matlab code in optimization for co channel and adjacent channel interference using ANN

Reply

259 Anvesh January 6, 2010 at 7:49 pm

haiiiiiii
i need Matlab code for digital modulation techniques.
plz give reply to me….plz

Reply

260 Amjad January 10, 2010 at 7:06 am

Dear Krishna,

Can you little bit tell me how to simulate the Uncoded BER and ergodic capacity for webb channel using QPPM modulation.

Reply

261 Amjad January 10, 2010 at 12:47 pm

Dear Krishna,

I already ask this question please. reply
Can you little bit tell me how to simulate the Uncoded BER and ergodic capacity for webb channel using QPPM modulation.

Reply

262 kishore January 25, 2010 at 9:07 pm

Hi krishna!

I need matlab code to obtain BER vs SNR curve for binary on-off keying.
also ,code for generating SER vs SNR curve for 3ASK modulation

Reply

263 anis January 28, 2010 at 4:04 pm

Hi there,
i just wondering why we need to initialize the rand and randn function?

Reply

264 anne na February 4, 2010 at 2:24 pm

hi,

I would like to demodulate QPSK but using soft decision. can you help me or guide me how I want to do this? I try the matlab function using

demodh= modem.pskdemod(ht, ‘outputType’, ‘bit’,'DecisionType’, ‘LLR’, ‘NoiseVariance’, sigma);
dec_inputt=demodulate(demodh,rt);

but the bit that I’m receive sort like it have inverse sign.
for example: if I transmit bit : 1; 0; 1 ,
I received : -10.8; +9.7; -11.2.
I’m expecting that : +10.8;-9.7;+11.2.

Or is it LLR gives this inverse sign? TQ so much if you can help me.

Reply

265 Krishna Pillai June 20, 2009 at 8:48 am

@RAO: My replies;

1/ I have written a post on symbol error rate and bit error rate for 16-PSK.
http://www.dsplog.com/2008/03/18/symbol-error-rate-for-16psk/
http://www.dsplog.com/2008/05/18/bit-error-rate-for-16psk-modulation-using-gray-mapping/
The equation and code should be easily adapted to M-PSK case.

2/ I have not tried modeling MDPSK.

3/ I have written a post on coherent demodulation of FSK
http://www.dsplog.com/2007/08/30/bit-error-rate-for-frequency-shift-keying-with-coherent-demodulation/

Hope this helps.

Reply

266 Ali June 21, 2009 at 9:58 pm

please can you tell the differences in the code if we made it such that the noise is only Gaussian noise with 0 mean and No/2 variance

Reply

267 Krishna Pillai June 22, 2009 at 5:45 am

@Ali: We are discussing this case, no?

Reply

268 Ali June 22, 2009 at 6:44 pm

please can you tell me how that is discussed if you write this statement 0db variance
in this line of code

n = 1/sqrt(2)*[randn(1,N)] %+ j*randn(1,N)]; % white gaussian noise, 0dB variance

Reply

269 Ali June 22, 2009 at 11:31 pm

really , please can you illustrate me which part exactly in the code do this thing as the part the i see in the code is

n = 1/sqrt(2)*[randn(1,N)]; %+ j*randn(1,N)]; % white gaussian noise, 0dB variance

and you write as comment that the noise is 0 db variance

thanks for your great efforts

Reply

270 hemant July 19, 2009 at 9:24 am

Hi Pillai..my Mtech project is Cs-OFDMa ,here we are using LAS (smart codes),pls let me know if hav any matlab simulation for the subject mentioned.

Reply

271 Krishna Pillai June 23, 2009 at 4:39 am

@Ali: The 0dB variance is for complex noise (on both real and imaginary part). For BPSK we use only real part and the variance is 1/2. Agree?

Reply

272 Krishna Pillai July 20, 2009 at 7:11 pm

@hemant: Sorry, I have not worked on LAS. Infact, I was unaware of the acronym till I googled and found Large Area Synchronous.

Reply

273 anil November 7, 2009 at 1:23 pm

Hi Krishna,
I just read your answers in this website.
I am working in convolutional codes with 8psk and AWGN. I have some doubts in Iterative decoding. Can you help me.
Anil

Reply

274 Krishna Sankar November 8, 2009 at 9:00 am

@anil: You may ask. I will reply to the best of my knowledge

Reply

275 student November 10, 2009 at 9:05 pm

Hi Krishna,

I am working on a IEEE paper titled”Xiaodi Zhang and N.C. Beaulieu, “A Closed-Form BER Expression for BPSK Using MRC in Correlated CCI and Rayleigh Fading,” IEEE Trans. Communications, vol. 55, no. 12, pp. 2249-2252, Dec. 2007.”.

Since you have worked on similar field, I was hoping you can help me.

I was stuck with re creating the 1st fig from the paper.
Can you please look into it and help me.

Student

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Straight line fit using least squares estimate

Next post: CORDIC for phase rotation