x=2 *(rand(N) >= 0.5) - 1
Can someone please explain how the above expression corresponds to BPSK signal please?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.Sign up to join this community
Deviating from dsp a bit, randn(N) may be function you are looking for (numpy.random.randn(N)). Coming to the question, yes randn will generate N gaussian distributed random values around 0. After that you are slicing (hard-decision) around 0.5 to get 0 or 1. These 0 or 1 will get converted to -1 or 1 (0 $\rightarrow$ -1 , 1 $\rightarrow$ 1) so you will have BPSK modulated symbols. (Since you chose 0.5 as the cutoff for deciding 0 or 1, this may result in more -1 symbols. You can chose 0 as the cutoff to get 1 or -1 with equal probability)