# Lecture 29: CDMA Codes: Properties of PN Sequences

Hello welcome to another module in this massive
open online course on the principles of MIMI, CDMA, OFDM wireless communication systems.
So, in the previous lecture we were looking at CDMA and how to generate the code sequences
for CDMA which stands for code division for multiple access and we have said that the
CDMA code sequences are generated as PN sequences. So, for CDMA when we look at CDMA the code
sequence of CDMA is generated as a PN sequence which stands for a Pseudo Noise. The sequence
it looks like a random series of 1Õs and plus 1Õs and minus 1Õs, this is generated
as a PN sequence or a Pseudo Noise sequence. PN sequence means a Pseudo Noise sequence
and this is generated using an LFSR structure which stands for a linear feedback shift register
structure. So, the PN sequences these are generated using
the LFSR. Which is also known as the linear feedback shift register structure. We had seen an example
of an LFSR structure for d equal to 4 registers, we said that this is a maximal length linear
feedback shift register and goes through all the possible states except the all 0 states
therefore, it goes through 2 to the power of d minus 1 or 2 to the power of 4 minus
1 that is 16 minus 1 or 15 states. And the PN sequence that is generated by this
LFSR that is given as, we had also derived that in the last lecture the PN sequence from
d equal to 4 linear feedback shift register that is given as well 1 1 1 1 0 0 0 1 0 0
1 1 0 1 0. So, this is the PN sequence that is generated by the LFSR and the length of
this PN sequence is equal to 15. So, this is the PN sequence that is generated by the
linear feedback shift register and the length of this PN sequence that is equal to 15, we
have 15 symbols in this PN sequence. Now, therefore, now what we are going to do
we have to convert this into a sequence of minus 1Õs and plus 1Õs. So, what we are going to do we are going to
digitally modulate this PN sequence by mapping by modulating, we are going to use BPSK modulation,
we are going to map the one information symbol 1 goes to a minus 1 this is the standard modulation.
And information symbol 0 goes to plus 1. So, we are going to map 1 the information symbol
1 to a minus 1 to a voltage level this is the typical convention. The information symbol
1 is mapped to the voltage level minus 1, the information symbol 0 is map to the voltage
level plus 1 therefore, now my PN sequence becomes. So, my earlier PN sequence let me
write that or let me write it over here, let me write that again my PN sequence information
sequence is 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0. Now, after modulation this becomes remember
1 is mapped to a minus 1, so this becomes minus 1, minus 1, minus 1, minus 1, 1, 1,
1, minus 1, 1, 1, minus 1, minus 1, 1, minus 1, minus 1. So, after modulation this PN sequence
becomes this is the PN sequence after modulation and this
sequence is given as minus 1, minus 1, minus 1, minus 1, 1, 1, 1, minus 1, 1, 1, minus
1, minus 1, 1, minus 1, minus 1 and the sequence is again of length 15 which remains unchanged.
So, this the modulated PN sequence. So, this is the PN sequence, this is the Pseudo Noise
sequence which looks like a random sequence or noise like sequence of plus 1Õs and minus
1Õs which is used as a code in the CDMA system. The code by which the user symbol is multiplied.
Now, to understand properties of CDMA better let us examine the properties of this PN sequence.
So, let us start examining the properties. Let us examine the properties of this PN sequence.
Now, let me write this PN sequence this PN sequence is minus 1, minus 1, minus 1, minus
1, 1, 1, 1, minus 1, 1, 1, minus 1, minus 1, 1, minus 1, 1., this is the sequence as
we all ready seen this is the sequence of length 15.
Now, let us calculate the number of plus 1Õs and minus 1Õs in this sequence, so we have.
So, if we want to calculate the number of plus minus 1Õs, 1st we have 4 minus 1Õs
here, 1 minus 1 here, 2 minus 1Õs here, 1 minus 1 here. So, number of minus 1Õs is
4 plus or 5 plus 2 7 plus 1 8. So, the total number of minus 1Õs in the system is equal to 8.
Now, let us calculate the number of plus 1 symbol in this CDMA in this PN sequence. I
want to calculate what is the total number of plus 1Õs, so total number of plus 1Õs
says we have 3 plus 1Õs over here, 2 plus 1Õs over here, another 1 over here. So, this
3 plus to 5 plus on 6 plus 1, 7, so total number of plus 1 is equal to 7. Now, if you
see we observe something very interesting the total number of plus 1 out of these 15
symbols, there is 15 plus 1Õs and minus 1Õs we have number of minus 1Õs is equal to 8
and number of plus 1Õs is equal to 7 therefore, what we have is a roughly the number of plus
1Õs and number of minus 1Õs is equal. In fact, the precise relation is that the
number of minus 1Õs is exactly 1 more than the number of plus 1Õs. So, what we observe is that the number of
minus 1Õs is equal to basically 1 plus the
number of plus 1Õs the number of minus 1 is 8, which is 1 plus the number of plus 1Õs
that is 1 plus 7. So, what you can see also is that the number
of minus 1Õs and number of plus 1Õs are approximately equal, that is out of a length
of 15 total length of 15 we have 8 minus 1Õs and 7 plus 1Õs. So, what we observe is that
the number of minus 1Õs and number of plus 1Õs is roughly equal and this is known as
the balance property. This property is known as the balance property. So, what we have
is number of minus 1Õs is approximately equal to
number of plus 1Õs and this is known as the balance property. That is approximately if
I take a length n PN sequence, approximately half of the symbols in the PN sequence are
minus 1 and approximately half of the symbols in the PN sequence are plus 1. So, approximately
half and half are plus 1 and minus 1 each this is known as the balance property. And
more precisely speaking the number of minus 1 symbol is exactly 1 more than the number
of plus 1 symbol in the PN sequence. This is known as the balance property of the PN
sequence. So, this is property number 1, let us now
look at property another interesting property let us now look at property number 2. For
this PN sequence and for this let us look at the runs what we call as the run, what
is the run? A run in a PN sequence is a string of a run in a PN sequence is a run is the
string of continuous values. So, let us look again at our PN sequence our
PN sequence what is our PN sequence? Our PN sequence is well minus 1, minus 1, minus 1,
minus 1, 1, 1, 1, minus 1, 1, 1, minus 1, minus 1, 1, minus 1, 1. So, this is my length
15 PN sequence. Now, let us look at the runs, that is then
a strings continuous strings of continuous values I have 1 string of 4 minus 1Õs here,
so this is my 1st run of length equal to 4; I have another string of length 3 1Õs, so
this is of n is equal to 3; I have another string of length 1. So, I have n is equal
to 1 I have another string of 1Õs of length is equal to 2, I have another string of minus
1Õs of length is equal to 2 then the rest of the string I have 3 strings of 1 minus
1 1 each of these is of length L is equal to 1. So, I have the 1st string which is of
4 minus 1Õs. So, the length is equal to 4, I have the 2nd string of length equal to 3
that is 3 1Õs, 3 consecutive plus 1 symbols, I have 1 string of length is equal to 1 which
is a minus 1, 1 string of a length equal to 2 of plus 1 symbols 1 string of length equal
to 2 of minus 1 symbols again 3 strings of length 1 each 1 minus 1 and 1.
So, the total number of strings, if you look at the total number of runs or strings, total
number of runs that is the number of strings is equal to 1 2 plus 1 2 3 4 5 6 7 8. So,
the total number of runs in this PN sequence that is total number of strings of continuous
values in this PN sequence is equal to 8. Now, out of these total number of runs, I
have 4 runs are of length 1, out of these total number of runs 8, I have 4 runs of length
1. So, the length of the run is basically the length of the string is the length of
the run and we have 4 strings of length 1 which means we have 4 runs of length 1 and
the total number of runs is 8 and now look at this 4 is basically half of 8. So, basically
which means that half of the 8 runs are of length, 1.
Now, let us look at the number of runs of length 2, we have 2 runs of length 2 which
means one-fourth of 8 , 8 is the total number of runs one-fourth of 8 is 2. So, one-fourth of 8 which is basically one-fourth
of total runs are of length 2. So, what we are observing is half of the runs are of length
1, one-fourth of the runs are of length 2 and interestingly if you look at this you
will further realize that you have 1 run of length 3. So, I have 1 run of length 3, which
is one-eighth of the total number of runs. So, one-eighth of 8 is 1.
So, one-eighth of the total runs are of length 3. So, what we
are observing is something very interesting, we are observing that half of the runs are
of length 1, one-fourth of the runs are of length 2, one-eighth of the runs are of length
3 and, if you have a longer PN sequence we will have one-sixteenth of the runs of length
4, one more 32 of the runs of length 5. In general 1 over 2 to the power of n of the
total runs, of the total numbers of fraction 1 over 2 to the power of n of the total number
of runs is of length n. So, what we are observing is the 2nd interesting
property, this is the run length property out of total number of runs. 1 over 2 to the
power of n of total runs are of length n. So, what we are observing
is and this is known as the run length property of the CDMA sequences which says
that 1 by 2 to the power of n fraction of runs are of length n, which means half that
is 1 by 2 to the power of 1 or half of the total runs are of length 1, one-fourth of
the runs are of length 2, one-eighth of the runs are of length 3 and so on, this is 1
as the run length property of the PN CDMA, PN sequence. This is known as the run length
property and this another important property of a CDMA sequence, which basically is a fundamental
property it must to obey if it indeed has to look at like a noise like sequence of plus
and minus 1, that is the randomly generated sequence of plus 1Õs and minus 1Õs.
Now we want to look at another property that is property number 3 that is a 3rd property.
So, I want to look at another property, property number 3 of this PN sequence and this is the
most important property, this is known as the auto correlation property of the PN sequence. And auto correlation of the property and sequence
is defined as 1 over N summation over n c n c of n minus d where, this quantity d is
the shift, this d is equal to shift, this quantity n is equal
to the length of the PN sequence. The capital N is equal to length of
and this is the auto correlation, this is the definition of the auto correlation which
is basically 1 over N summation of c n multiplied by c n minus d.
So, what are we doing? We are taking each chip c n we are multiplying by the chip corresponding
to the shifted PN sequence. What is c n minus d? C n minus d is basically shifting the PN
sequence by the quantity d and therefore, we are shifting the PN sequence by this amount
d, we are doing in element wise multiplication of these PN sequence and the shifted PN sequence
by d, we are summing this element wise product and then we are dividing by capital N, which
is the length of the PN sequence this is defined as the this is known as the auto correlation
of the PN sequence, this is the auto correlation of the PN sequence.
Now, let us see what happens? Now, realize also that each c n, each element c n is either
equals to plus or minus 1, each c n is either equal to plus or minus 1. Now, let us see
what happens to this out of the behavior of this auto correlation function of this PN
sequences is a function of the shift d. Now, if d is equal to 0, if d is equal to
0 then my auto correlation is 1 over N summation n c n c n minus d, but d is equal to 0, so
auto correlation becomes 1 over N summation over n c n into d equal to 0. So, this is
simply c n into c n, but c n into c n is c n square which is summation over n c square
of N, but c n is plus or minus 1 which means c square of n is 1. So, this is simply 1 over
N summation over n of 1. So, I will write the reasons since c n equals plus or minus
1 c square n is equal to 1 summation 1 over N times 1, which is equal to 1 over N summation
1, N times is equal to N, so this is equal to 1. So, if d is equal to 0 the auto correlation
of this PN sequence is equal to 1. So, if d is equal to 0 that is the auto correlation
of the self correlation of this PN sequence is equal to 1. Now, let us examine what happens
if d is not equal to 0 for instance let us take a simple example. Let us consider d is equal to 2, let us see
what happens when d is equal to 2, let us circularly shift this PN sequence by 2 symbols
and let us see what the value of the auto correlation is going to be.
So, I am going to write this sequence. So, I have c of n which is 1, 1, 1, 1, minus 1,
minus 1, minus 1 or by PN sequence is basically c n is basically minus 1, minus 1, minus 1,
minus 1, 1, 1, 1, minus 1, 1, 1, minus 1, minus 1, 1, minus 1, 1.. Now, I am going to
circularly shift this by 2. So, I am taking this PN sequence and I am circularly shifting
this PN sequence by 2 symbols. So, I am considering a shift of d is equal to 2 therefore, this
will become minus 1, minus 1, minus 1, minus 1, 1, 1, 1, minus 1, 1, 1, minus 1, minus
1, 1, minus 1 and this last symbols will be will come to the front because this is a circular
shift. So, this is this, so I have the sequence I have the circularly shifted sequence.
Now, I have to take the element wise multiplication and I have to take the sum which is going
to be minus 1 into minus 1 is plus 1 plus minus 1 into 1 is minus 1. So, minus 1 and
calculating this way plus 1 plus 1 minus 1 minus 1 plus 1 minus 1 plus 1 minus 1 minus
1 minus 1 minus 1 plus 1 plus 1. And now, if you take the sum of all these things you
will see I have 1 minus 1 is 0 plus 2 minus 2 is 0 1 minus 1 is 0 1 minus 1 is 0 minus
3 plus 2 at this sum is minus 1 the element wise sum is minus 1 and now, dividing by N
therefore, the auto correlation now, I am taking the element wise sum and now I have
to divide by N. So, therefore, the final auto correlation will be equal to minus 1 by N,
which in this case N is equal to 15. So, this is minus 1 by 15. and what we are observing
is something very interesting, we are observing that if the auto correlation, if d shift is
equal to 0 then the auto correlation is equal to 1 for any shift other than 0 the auto correlation
decreases drastically it is minus 1 divided by N. So, the auto correlation property can be summarized
as follows the auto correlation property of the PN sequence.
If d equal to 0 auto correlation is equal to, if d is not equal to 0 autocorrelation
is equal to minus 1 by n. So, for any shift non-zero, for is 0 shift the auto correlation
is 1 for a non-zero shift auto correlation is minus 1 over N. We had seen an example
of this by considering a shift of d is equal to 2. Therefore, what you can see something
very interesting as soon as the shift moves away from 0 the auto correlation decreases
drastically, it becomes minus 1 over N which means as N increases. Remember N is the length
of the spreading sequence of the PN sequence, if N is large then 1 over N is small which
means 1 over N becomes progressively is approximately equal to 0 for larger, which means the auto
correlation of this PN sequence for any shift other than the 0 shift is approximately equal
to 0 for a PN sequence which a large length N which is a very desirable property as we
are going to see shortly or in subsequent modules.
So, what happens is this N, this approximately equal to 0 for large N or the PN sequence
decreases as 1 over N with large N. Therefore I can plot this auto correlation,
The auto correlation function of the PN sequence it looks like this that is at 0 this is equal
to 1, but away from 0 what happens is this auto correlation it was sharply and this is
equal to minus 1 by N. So, the moment I have any other shift other than the 0 shift,
this auto correlation fall sharply. So, this is the auto correlation property of the PN
sequence this is the plot of the auto correlation. This is the plot of the auto correlation of
the PN sequence. So, for a 0 shift the auto correlation, so
this auto correlation equal to 1 for a 0 shift and for any non-zero shift, for any shift
other than 0, it falls to 1 by N which is approximately equal to 0 for
a large N. So, the auto correlation property of the PN sequence relates that the correlation
is equal to 1 or the self correlation is equal to 1 for the 0 shift, but for any non-zero
shift the auto correlation is minus 1 over N which is approximately equal to 0 for large
N and these are the salient properties of the PN sequences which are used in a CDMA
system. One is the balance property, two is the run length property and third the most
important property is the auto correlation property, which we are going to see is will
help us in extracting the multipath components in the wireless channel in a CDMA system and
that gives raise the multipath diversity and this is a very important property of the PN
sequences in a CDMA system. So, this module which deals with the properties
of the PN sequences we will stop here and continue with other aspects of the CDMA systems
in subsequent modules. Thank you very much.

## 9 thoughts on “Lecture 29: CDMA Codes: Properties of PN Sequences”

1. Zia Khan says:

@ 6:42 Last symbol of Modulated Sequence should be 1 as you are mapping 0 –> 1

2. Ravi Kumar says:

Watch at 1.25x

3. chioma unachukwu says:

Run properties at 13:06

4. chioma unachukwu says:

auto correlation at 21:47

5. Hehe Da says:

skip to 7:05

6. Dr B Siva Kumar reddy says:

u are ultimate sir

7. kozhin faiaq says:

good job

8. vin peter says:

lot of errors here. For balance property the no. of 1s is always more than the 0s therefor if we have 4 shift reg. then the total sequence would be 2*m – 1 which would be 15. therefor the no. of 1s would be 8 and no. of zeros(or -1s) would be 7. only look for videos if you have doubt or your whole concept would be ruined.

9. priyesh malviya says:

Why 1logic is coded by -1V instead of +1V.