-1
$\begingroup$

x=2 *(rand(N) >= 0.5) - 1

Can someone please explain how the above expression corresponds to BPSK signal please?

$\endgroup$
  • $\begingroup$ Do you know what rand(N) generates? $\endgroup$ – BlackMath Aug 2 '19 at 7:15
  • $\begingroup$ Rule: General programming questions are off-topic here, but can be asked on Stack Overflow. There's nothing signal processing-wise in this question. $\endgroup$ – Marcus Müller Aug 5 '19 at 9:06
1
$\begingroup$

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)

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.