100% found this document useful (2 votes)
178 views

Simulation of A CDMA Systems Using Linear Prediction and MUD (Matlab)

This document summarizes a senior graduation thesis presented by Onder Filiz and Yakup Cemal at Bogazici University. The thesis simulates a CDMA system using linear prediction for joint blind equalization and blind multiuser detection in a fading channel. It introduces CDMA systems and the problems of multi-access interference, multipath fading, near-far effect, and inter-symbol interference. The thesis then formulates the problem and proposes using a linear prediction algorithm. Simulation results are presented to analyze the performance of the receiver structure under different mobile channel conditions.

Uploaded by

Raj Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
178 views

Simulation of A CDMA Systems Using Linear Prediction and MUD (Matlab)

This document summarizes a senior graduation thesis presented by Onder Filiz and Yakup Cemal at Bogazici University. The thesis simulates a CDMA system using linear prediction for joint blind equalization and blind multiuser detection in a fading channel. It introduces CDMA systems and the problems of multi-access interference, multipath fading, near-far effect, and inter-symbol interference. The thesis then formulates the problem and proposes using a linear prediction algorithm. Simulation results are presented to analyze the performance of the receiver structure under different mobile channel conditions.

Uploaded by

Raj Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

BOGAZICI UNIVERSITY

SENIOR GRADUATION THESIS









Simulation of a CDMA System Using Linear Prediction
Approach for Joint Blind Equalization and
Blind Multiuser Detection In a Fading Channel













ONDER FILIZ
YAKUP CEMAL






INTRODUCTION
Communication has been a very important tool for humans Recently with the huge market
penetration of 2
nd
generation cellular phone systems, people are getting used to the idea of
communications anywhere & anytime. Although 2
nd
generation mobile systems mainly
support voice traffic, some enhancements have been proposed for data traffic as well. It is
assumed that 3
rd
generation wireless systems will enable higher data rates and new services
will be available such as videoconference or data communications. As the discussions on
whether the producers are pushing this technology and whether the users will be willing to
pay for these systems continue and organization such as the 3G Harmonization group
desperately work to set global standards in 3G, the future of 3G looks a little bit blurred these
days. However we believe that eventually these systems will be deployed and become a major
part of our lives.
It is very probable that 3G systems will depend on code division multiple access (CDMA)
systems. In CDMA systems users are not divided into time slots or frequency bands. All users
transmit on the same frequency band. Each users symbol sequence is multiplied by a periodic
sequence called a chip (spreading, PN) sequence (code). The rate of this chip sequence is
much higher than the symbol sequence. As a result of this, the signal is spread in frequency
domain. The fact that the signal uses an excess bandwidth in frequency domain brings some
advantages to CDMA systems. One advantage is that the system is very robust against
narrowband interference. At the receiver the received signal is again multiplied by the locally
multiplied version of the chip sequence. This multiplication spreads the interference, resulting
in less power in our interference bandwidth.
The paper is organized as follows: first the problem statement and the common notations and
definitions will be given which will be followed by a short introduction on PN sequences. It
is followed by the problem formulation and the linear prediction algorithm. After the
explanation of the channel model that is used the simulation results will be given. Finally a
conclusion part about the project will be presented.
PROBLEM STATEMENT
Besides its many advantages CDMA systems also has some problems that did not exist in
previous systems. One of the problems is the multi access interference (MAI). If the spreading
codes were orthogonal MAI could be eliminated completely. Due to the asynchronicity of
users and the need to support many users, such orthogonality is not possible to maintain even
in theoretical AWGN channels. MAI cancellation has attracted a lot of interest recently and
many solutions are proposed to overcome this problem. The optimum solution to cancel MAI
has been proposed by Verdu [13] but it requires and enormous computational complexity. It
has a bank of matched filters followed by a Viterbi algorithm for maximum likelihood
sequence estimation. Suboptimal receivers typically have less computational complexity and
worse performance.
A common problem that all wireless communication systems suffer is the multipath effect.
Electromagnetic waves scatter and reflect from the object in our surroundings, which causes
different multipaths to exist between the transmitter and the receiver. The signals coming
from these multipaths have different delay, phase and attenuation characteristics. The
combination of these multipaths, cause in undesired effects at the receiver such as frequency
selective fading.
Because the users are spread around the cell each users signal is received with a different
power at the receiver. Therefore a powerful signal will have much interference effect on a
weaker signal. This effect is known as near-far effect. Some receiver structures are robust
against this phenomenon while others performance is severely effected. A solution proposed
to solve this problem is power control. In power control there exists a feedback mechanism,
which adjusts the transmitted power such that at the receiver all users signals are received
with equal power.
Multiple copies of the signal, which arrive with different delays cause, inter symbol
interference (ISI). To compensate the effect of ISI equalizers should be used at the receivers.
Traditional equalizers use training sequences to adjust the tap weights. Training sequences are
symbol sequences, which are known to the receiver. However using training sequences
decrease bandwidth efficiency. In GSM systems 27 training bits are sent for every 114 data
bits [4]. Blind equalization does not require training bits and it is therefore preferred.
In this project the performance of the receiver structure proposed in [1] will be analyzed for
DS-CDMA systems in mobile channel conditions. The main performance metric is the bit
error rate (BER). BER performance under different channel conditions will be simulated and
the applicability of the proposed algorithm to for the 3G systems will be investigated.





Notations and Definitions
The following notations and definitions will be used throughout this paper:
A: matrix
a: vector
(.)
T
: Transpose
(.)
H
: Hermitian
(.)
+
: Pseuodo-inverse
||.|| : Frobenius norm [2]
J : Total number of active users in the cell
j : index for user number
k : time index in terms of chip
l : time index in terms of symbol
b
j
(l): j
th
users symbol sequence
c
j
(k): j
th
users spreading code
s
j
(k): j
th
users spreaded symbol sequence
g
j
(k): j
th
users multipath channel impulse response
R
c
: Chip rate
T
c
: Chip period (1R
c
)
R
s
: Symbol rate
T
s
: Symbol period (1R
s
)
L
c
: Length of chip sequence in terms of chips
PG: Processing gain (T
s
T
c
=R
c
R
s
=L
c
)
n(k): additive white gaussian noise
NF : near-far ratio
SNR : signal-to-noise ratio

PN SEQUENCES
In CDMA systems each bit is multiplied by a pseudo-noise sequence having the length of the
processing gain (chip sequence). A single pulse of the PN sequence is called a chip. The idea
of using a pseudo-random sequence comes from its autocorrelation function that resembles to
the autocorrelation function of the random binary wave. In this project gold sequence are used
as spreading code, which are generated from maximum-length sequences (MLS).
MAXIMUM-LENGTH SEQUENCE (MLS)
MLS is the most widely used PN sequence type, which generates periodic outputs. The
periodicity of an m-state MLS equals 2
m
-1. Therefore, using m-state MLS generator, we can
obtain a spreading code whose processing gain is 2
m
-1. The algorithm for PN sequence
generation is as follows [7]:
1) Assign a random sequence of length m to initialize shift register.
2) Then at each clock-pulse
- Pass the content of the m
th
component of the register as the output
- Binary sequences are shifted through the register.
- The contents of the shift register are logically combined (a combination modulo-2
additions at pre-defined feedback tabs) and returned to the 1
st
component of the
register.
3) Repeat 2
nd
step 2
m
-1 times to obtain 2
m
-1 output bits as the outputs which is the MLS
sequence that will be used in gold sequence generation.
The block diagram of this algorithm is shown below:

Figure 1 - Generation of MLS sequences

GOLD SEQUENCE
To obtain better cross-correlation properties, gold sequences are used as spreading code in
many CDMA applications. After obtaining two MLS with the same length 2
m
-1 (different
feedback tabs is possible), we obtain the gold sequence with the same length by modulo-2
adding each corresponding element [10]. After obtaining a binary sequence composed of
{0,1}, we convert this signal to isomorphic signal that is binary 0 is represented by 1 and
binary 1 is represented by 1 [8]. Figure 2 shows the block this block diagram.

Figure 2 - Generation of Gold Sequences

PROBLEM FORMULATION
Our aim is to find w
j
(k) which is decorrelating for MAI rejection and zero-forcing for ICI
removal. Let s
j
(k) be the spreaded symbol sequence such that each symbol b
j
(l) is multiplied
by the spreading code c
j
(k) such that:
( ) ) ( ) (
c
l
j j j
lL k c l b k s =

(1)
Note that b
j
(l) is at symbol rate R
s
, c
j
(k) and s
j
(k) are at the chip rate R
c
. For further
discussion, it is necessary to note that

<
<
=
0 0
0
) (
k or L k
L k nonzero
k c
C
c
j
(2)
When the channel impulse response g
j
(k) is assumed to be causal and d
j
is the delay of the
channel in terms of chip, then the j
th
component of the received signal becomes by simple
manipulations:
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )

=
=
=
=
=
=

=
l
j c j j j
l
L
i
j c j j j j
l
j j
i
c j j j
i
j j
l
c j j j
i
j j j j
j j j
d lL k h l b k x
i d L k g i c l b k x
i d k g lL i c l b k x
i d k g lL i c l b k x
i d k g k s k x
k g k s k x
c
1
0
) (
*
(3)
Where the response of the channel to the spreading code h
j
(k) channel vector is:
( ) ) ( ) ( l k g l c k h
l
j j j
=

(4)
Define:
1 , , 1 , 0 ) 1 ( ) (
1 , , 1 , 0 ) 1 ( ) (
) (
) (
= + =
= + =
c c j
i
j
c c j
i
j
L i i Lc kL x k x
L i i Lc kL h k h

(5)
Then combining with (12), (13) and (14), we get
( )
( )
( ) ( ) ( ) ( )
( ) 1 , , 1 , 0 ) ( ) (
1 ) (
) 1 ( ) (
) 1 ( ) (
) 1 ( ) (
) (
) (
) (
) (
) (
) (
= =
+ + =
+ =
+ =
+ =
+

c
d i
j
l
j
i
j
j c j
l
j
i
j
j c c j
l
j
i
j
c j
l
j
i
j
c j
i
j
L i l k h l b k x
d i Lc L l k h l b k x
d lL i Lc kL h l b k x
i Lc kL h l b k x
i Lc kL x k x
j

(6)
When we stack up (15) for all possible i values, we obtain the following vector-space
notation:
( )
( )
( )
( )
( ) ( ) ) ( ) ( ) (
) (
) (
) (
) (
) (
) (
) (
) (
) (
1
0
) 1 (
) 1 (
) (
) 1 (
) 1 (
) (
) 1 (
) 1 (
) 0 (
l l k b l k l b k
l k h
l k h
l k h
l b
l k h l b
l k h l b
l k h l b
k x
k x
k x
j
L
l
j j
l
j j
d L
j
d
j
d
j
l
j
d L
j
l
j
d
j
l
j
d
j
l
j
L
j
j
j
h
j c
j
j
j c
j
j
c
h h x

=
+
+
+
+

= =
(
(
(
(
(

=
(
(
(
(
(
(

=
(
(
(
(
(

(7)
Where L
h
is related with the length of h
j
and and delay d
j
.
When we again stack up vectors related with the length of L
w

Then () can be represented in vector notation
(
(
(
(
(

(
(
(
(
(

=
(
(
(
(
(

) 2 (
) 1 (
) (
) 1 ( ) 1 (
0
) 1 (
0 0
) 0 ( 0 0
) 1 ( ) 0 ( 0
) 1 ( ) 1 ( ) 0 (
) (
) (
) (
) ( ) (
) (
) (
) ( ) (
) ( ) ( ) (
w h j
j
j
h
d
j
d
j
h
d
j
d
j
d
j
d
j
h
d
j
d
j
d
j
j
j
j
L L k
k
k
L
L
L
k
k
k
j j
j
j
j j
j j j
b
b
b
h h
h
h
h h
h h h
x
x
x

(8)
The above vector-space representation can be written as:
) ( ) (
) (
j
k k
j
d
j
j
b H X = (9)
where ) (
j
k X is the input signal in multi channel fashion. When all J users are combined the
total signal can be represented as:
| |
(
(
(
(

= = =

= =
) (
) (
) (
) ( ) ( ) (
2
1
) ( ) (
2
) (
1
1 1
) (
j
k
k
k
k k k
J
d
J
d d
J
j
J
j
j
d
j
j j j j
b
b
b
H H H b H X X

(10)

By simple manipulations, x
j
becomes

BASIC IDEA OF THE PROPOSED ALGORITHM
The basic idea behind the linear prediction algorithm will be introduced in this section. For
simplicity is assumed that the system is synchronous and the delay is zero. First the channel
vector h will be decomposed into the multiplication of two matrices C & g. From equation 13
it follows that:
1
) 0 (
10
1
1
1
1 1
) 0 (
1
) 0 (
) 1 (
) 0 (
) 1 ( ) 0 (
) 0 ( g
0
0
h C
g
L g
c
L c c
g
L L
c
g c
=
(
(
(
(

(
(
(

(11)
1
) 0 (
11
1
1
1 1
1 ) 0 (
1
) 0 (
) 1 (
0 ) 1 ( ) 1 (
) 1 (
0 0
) 1 ( g
0
h C
g
L g
L c c
L c
g
L L
c
c
g c
=
(
(
(
(

(
(
(
(




(12)
Because c
j
(k) is defined to be zero outside the interval 0<k<Lc-1, it follows that the matrices
) 1 ( ) 2 (
) 0 (
1
) 0 (
1

h
L h h will be zero. Therefore the simplified version equation 18 becomes:
(
(
(
(
(

(
(
(
(
(

=
(
(
(
(
(

+
) 2 (
) 1 (
) (
) 1 (
0
0
) 0 ( 0 0
) 1 ( ) 0 ( 0
0 0 ) 1 ( ) 0 (
) (
) (
) (
) ( ) (
) (
) (
) ( ) (
) ( ) (
1 ) (
w h j
j
j
L L L L L L L
d
j
d
j
d
j
d
j
d
j
d
j
L L
j
j
j
L L k
k
k
k
k
k
c h c w c w c
j
j
j j
j j
w c
b
b
b
h
h
h h
h h
x
x
x

(13)
The H
1
(0)
matrix then becomes:
1
) 0 (
11
1
1
1
1
) 0 (
11
) 0 (
10
) 0 (
11
) 0 (
10
) (
) (
) ( ) (
) ( ) (
) 0 (
1
) 1 (
0
0
0
) 0 ( 0 0
) 1 ( ) 0 ( 0
0 0 ) 1 ( ) 0 (
G C
g 0
g
0 g
0
0
h
h
h h
h h
H
(
(
(

=
(
(
(

(
(
(
(
(

=
=
(
(
(
(
(

=
C
C C
C C
j
j
j j
j j
d
j
d
j
d
j
d
j
d
j
d
j



(14)
If C
1
-1
H
1
(0)
is considered, it can be written as:
(
(
(

=
(
(
(

*
*
*
*
*
*
1
) 0 (
1
1
1
1
1
1
g 0
g
0 g
G I H C

(15)
denotes the nonzero elements of the matrix. The only nonzero element component in the
L
th
column is g
1.
This derivation is true only for the first user, j=1. For j1 the resultant
matrix becomes:
(
(
(

*
* *
* * *
) 0 ( 1
0
H C
j j
(16)
The only column with exactly with nonzero component is the first column. This difference
between the users provides the basis of the proposed linear prediction algorithm.
LINEAR TRANSFORMATION
From the previous discussion C
1
-1
H
1
(0)
has only L
c
many nonzero entries in any column
except the first one. Our aim is to choose T matrix such that TH
1
will have only L
c

nonzero entries in the (L
1
+1)
th
column. In other words we will annihilate one of h
1
(0)
(0) or
h
1
(0)
(1) from the (L
1
+1)
th
column of H
1
(0)
.

(
(
(

(
(
(
(
(

=
=
(
(
(
(
(

=
1
1
1
) 0 (
11
) 0 (
10
) 0 (
11
) 0 (
10
) (
) ( ) (
) ( ) (
) ( ) (
) 0 (
1
) 1 (
0
0
0
) 0 ( ) 0 ( 0
) 1 ( ) 0 ( 0
0 0 ) 1 ( ) 0 (
g 0
g
0 g
0
0
h
h h
h h
h h
H
C C
C C
j
j j
j j
j j
d
j
d
j
d
j
d
j
d
j
d
j
d
j



(17)
It is proofed in [1] that the following matrix annihilated the h
1
(0)
(1) from the L
1
th
block row
and (L
1
+1)
th
column of H
1
(0)
:
(
(
(
(
(

2
1
L
1
2 1
1 L
I
I
T T
I
T (18)
I
k
is a kL
c
x kL
c
identity matrix. After the transformation the (L
1
+1)
th
column of H
1
(0)
will
change as follows:
) 1 ( 0
0 ) 1 (
) 0 ( ) 0 (
) 0 (
1 2
) 0 (
1
) 0 (
1 1
) 0 (
1
h
h
h h
T
T

(19)
However when T is multiplied with other H
j
no elements will equal to zero, such that
0 ) 0 ( ) 1 (
) (
2
) (
1
+
j j
d
j
d
j
h T h T (20)
According to [1] the transformation matrix T matrix can be calculated such that [T
1
T
2
]
consists of the left singular vectors corresponding to the zero singular values of the matrix
[C
11
(0)H
C
10
(0)H
]
H
. The proof is omitted here but it can be found in [1]. The transformed
matrix gives:
=
(
(
(
(
(

=
) 1 (
0
0
0
) 0 ( ) 0 ( 0
) 1 (
) 1 ( 0 0
0 0 ) 0 ( ) 0 (
) (
) ( ) (
) 0 (
1 2
) (
) 0 (
1 1
) (
) 0 (
1
j
j j
j
j
d
j
d
j
d
j
d
j
d
j
h
h
h
h h
T
h
T h
TH



(21)

LINEAR PREDICTION APPROACH
After the input signal X(k) is transformed into TX(k), linear prediction approach can be
applied. Transformed and received data matrix becomes:
(
(
(

=
(
(
(

=
) (
) (
] [
) (
) (
) (
1
) ( ) 2 (
2
) 1 (
1
1
) (
k b
k b
k b
k b
k
J
dj
j
d d
J
d
j
H H H T TH TX (22)
(
(
(

(
(
(
(
(

(
(
(
(

(
(
(
(

(
(
(
(
(

=
) (
) (
* 0
* *
* *
0 * *
* 0
* *
* *
0 * *
) 1 ( ) 0 (
) 1 ( ) 0 (
) 1 ( ) 0 (
1
) 0 (
1
) 0 (
1
) 0 (
1
) 0 (
1
) 0 (
1
) 0 (
1
k b
k b
h h
h h
h h
J



TH
(dj)
is decomposed as follows:
(
(
(

=
2
0
1
) (
Q
Q
Q
j
d
TH (23)
Q
0
corresponds to the row, 1 below the annihilated element. ( (L
1
+1)
th
column of H
1
(d1)
, the
unannihilated one).
(

2
1
Q
Q
has exactly one zero column, which is the (L
1
+1)
th
column of the
first user block. Striking out this column, we get the full column rank matrix of
(

2
1
Q
Q
.
In the asynchronous case assumption A3 will become:
J L
J L
L
J L
J
L
c
c
w
c

+

2 2 1
1
(24)
This is due to the fact that the zero column is stroked out. The L
c
dimensional two-sided linear
prediction error vector is defined as:,
| | ) ( ) ( k k X T P I P
2 1
= (25)
{ } | | | || |
(
(
(

(
(
(

(
(
(

=
H
2
H
1
H
2
H
0
H
1
2
0
1
2 1
P
I
P
Q Q Q
Q
Q
Q
P I P ) ( ) (
) (
) (
) ( ) (
1
1
k b k b
k b
k b
k k E J
H H
J
H
(26)
After minimizing { } ) ( ) ( k k E
H
over P
1
and P
2
and equating to zero, the following conclusion
can be reached:
| | ] 0 0 ) 0 ( 0 0 [ ] [
) 0 (
1
) ( ) 2 (
2
) 1 (
1
h
dj
j
d d
= H H H T P I P
2 1
(27)
when applied to the input matrix X(k), the result becomes:
| | | |
) 0 ( ) (
) (
) (
] 0 0 ) 0 ( 0 0 [
) (
) (
] [ ) (
) 0 (
1 1 1
1
) 0 (
1
1
) ( ) 2 (
2
) 1 (
1
h L k b
k b
k b
h
k b
k b
k
J
J
dj
j
d d
=
(
(
(

=
(
(
(

=

H H H P I P X T P I P
2 1 2 1
(28)
As a result it can be seen that symbol estimation can be applied after transformation and the
estimation of h
1
(0)
(0). To estimate h
1
(0)
(0), E{(k)
H
(k)} should be analyzed.
{ } ) 0 ( ) 0 ( ) ( ) (
) 0 (
1
) 0 (
1 1
H H
h h A k k E = (29)
A
1
is associated with the power of the received signal and it only acts as a constant. It is stated
in [1] that ) 0 (
) 0 (
1
h equals the singular vector corresponding to the only non-zero singular value
of { } ) ( ) ( k k E
H
. The identified channel becomes:
| | ) 0 (
) 0 (
1
1
) 0 (
10 1
h g

= C (30)
The zero-forcing equalizer and decorrelating detector vector should be:
| | T P I P h w
2 1
= ) 0 ( ) (
) 0 (
1 1
k
H
(31)
when applied to X(k)
) ( ) 0 ( ) ( ) (
1 1
2
) 0 (
1 1
L k b k k
H
= h X w (32)
In other words, other than a scaling factor, the symbol can be estimated as:
) ( ) 0 ( ) ( ) ( ) (

) 0 (
1 1 1 1
k k k L k b
H H
h X w = = (33)
COMPUTATION OF ERROR
The transformed data correlation matrix is defined as [1]:
{ }
(
(
(

= =
33 32 31
23 22 21
13 12 11
) ( ) (
R R R
R R R
R R R
T X TX R
H H
k k E (34)
The optimum solution for the linear prediction problem is:
| | | |
+
(

=
33 31
13 11
23 21 2 1
R R
R R
R R P P (35)
{ } | |
22
32
12
33 31
13 11
23 21
) ( ) ( R
R
R
R R
R R
+
(

=
+
R R k k E
H
(36)

SINGULAR VALUE DECOMPOSITION (SVD)
During the implementation of our system, we have used SVD in some places. SVD is also a
main tool in many blind equalization algorithms [1]. In our engineering project, the theoretical
background of SVD is not very important. However, knowing some definitions about SVD is
necessary to use SVD function of MATLAB is used. We will represent some useful properties
and definitions related to SVD, which is necessary to implement this project using MATLAB.
The more detailed discussion can be found at [13].
According to the definition of SVD, every matrix A can be decomposed such that
T
V = U A (37)
where U and V are unitary matrices and is diagonal matrices are having the same size of A.
If A is composed of real variables than U and V are real orthogonal. This decomposition is
called singular value decomposition which mathematical background comes from eigen value
decomposition. The MATLAB function computes svd such that the notation is
(A) = V] , [U, vd s (38)
The diagonal elements are called singular values of A which are sorted from the bigger one to
the smaller one from the first diagonal elements. Then the columns of U are the left singular
vector of A where the each columns of U is the corresponding left singular vector of the
singular value, which has the same row and column index. Similarly, the columns of V are
called right singular vectors of A.
Addition to the definition related to SVD, some definitions about linear algebra is useful to
implement the algorithms of [1] are also necessary. The definition of full column rank is that a
matrix A has full column rank if all of its columns are linearly independent. Similarly, if all of
its rows are linearly independent, A has full row rank. Then, if its either full column rank or
full row rank, it is said that A has full rank.
PHASE AMBIGUITY
One of the problems that we encountered during our simulations was that half of the time
BER was 0 and during the other half BER was 100. After some literature survey we
discovered that channel estimate and therefore the symbol estimation obtained through a blind
method always has an arbitrary phase ambiguity [9]. As a result of this problem the estimated
channel and the symbol sequence equals exactly the original sequences multiplied by 1. The
solution to this problem is differential encoding. In differential encoding information is
encoded in terms of signal transitions. The differentially encoded signal is decoded by
comparing the polarity of adjacent symbols [10].
MOBILE CHANNEL MODEL
In mobile communication systems, the signals are usually reflected from buildings, hills and,
irregular objects. Therefore, we observe the signals at different angles of arrivals with
different delays. This phenomenon is called multipath propagation. Before going on in fading
channel model in details, we first introduce multipath channel parameters.
CHANNEL PARAMETERS
Time Dispersion Parameters and Coherence Bandwidth
The time dispersive parameters of a channel are related with the excess delay of the channel.
Excess delay is the relative delay of the i
th
multipath component as compared to the first
arriving component. Mean excess delay and rms delay spread are two commonly used time
dispersion parameters. They can be found by using the power delay profile P(t;) of the
multipath channel. If we denote the impulse response of a multipath channel by h(t;) where t
represents time index and represents the channel multipath delay; P(t;) is given by
2
) ; ( ) ; ( t h t P (39)
When we take the time average of above equation, the time-invariant multipath power delay
profile P() is found.
Now the mean excess delay can be found such that
( )
( )

=
k
k
k
k k
P
P


(40)
Then rms delay spread, which is the second central moment of the power delay profile, is
defined by
2
2

= (41)
where
( )
( )

=
k
k
k
k k
P
P

2
2
(42)
Coherence bandwidth B
c
, which is another important multipath parameters, related with time
delay parameters. It is inversely proportional to rms delay spread

. Coherence bandwidth
shows the bandwidth, which the multipath channel can be considered flat. The relax definition
of the coherence bandwidth can be given with the %50 correlation function such as

5
1

c
B (43)
Coherence bandwidth is generally used in determining if a communication system needs
equalization or not. IF the signal bandwidth is greater than coherence bandwidth, this will
generate inter symbol interference and equalization is needed.
In crowded urban cities like New York City,

is on the order of microseconds in outdoor


environments [3]. Therefore, in such an environment, B
c
can found as
kHz B
c
200
10 5
1
6
=



As the chip rate of a 3G CDMA system is on the order of 3.84Mchips/second [4], a 3G
CDMA system always require equalization, as this is much greater than 200kHz.

Coherence Time
Coherence time T
coh
is again an important multipath channel parameter, which shows the time
segment where the channel can be, accepted time-invariant (TI) and also wide-sense
stationary (WSS) [5]. It is inversely proportional with the maximum value of the Doppler
shift. The maximum value of the Doppler shift f
m
can be calculated such that [3]
c
vf v
f
c
m
= =

(44)
where is the wavelength, f
c
is the carrier frequency and c is the speed of light equal to
3x10
8
m/s. For some vehicle speed, maximum Doppler shift is found by taking f
c
equal to
2100MHz according to 3G harmonization group [4] such that
V (km/h) fm (Hz)
4 7,78
10 19,44
30 58,33
50 97,22
70 136,11
100 194,44
Table.
Then, as a popular rule of thumb for modern digital communication, the coherence time is
defined as [3]
m
coh
f
T
423 . 0
(45)
Then for a typical vehicle traveling in a street with a velocity of 60km/s, T
coh
can be found as
ms
c
vf
T
c
coh
626 . 3
10 2100
6 . 3
1
60
10 3 423 . 0 423 . 0
6
8



=
Which corresponds to approximately 14000chips where the channel response can be
represented time-invariant and wide-sense stationary, when chip rate is taken
3.84Mchips/second. The following plot shows the relationship between velocity and
coherence time:
0 10 20 30 40 50 60
10
-3
10
-2
10
-1
10
0
Velocity (v) vs Coherence Time (Tcoh)
v (km/h)
T
c
o
h

(
s
)

Figure..
We can observe that as velocity increase, the coherence time is also increases; the varying
properties of the channel increase. However, the decrease of T
coh
become smaller for larger
velocities. Therefore, at larger velocities, increasing the users velocity do not change the
channel characteristics a lot.
RAYLEIGH FADING CHANNEL MODEL
Lack of direct dominant line-of-sight (LOS) signal at the receiver, the envelope of the
received signal has a Rayleigh distribution with a pdf given by

<
<
|
|
.
|

\
|

=
0 0
0
2
exp
) (
2
2
2
r
r
r r
r p

(46)
where the variance
2
is
| |
2
2
2
r E
= (47)
When we plot this pdf for =1, we obtain the following plot of the distribution
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
r
p
(
r
)
pdf of rayleigh fading distribution for sigma=1

Figure
Also in this condition, the phase of this received signal is uniformly distributed with the
following pdf:

<
=
otherwise 0
2 0
1
) (

p (48)
Clarkes Rayleigh Fading Channel Simulator
Clarkes model[3-6] is used to generate Rayleigh fading coefficients. It is assumed that each
arriving wave has arbitrary phase, angle of arrival and equal average amplitude. With the
Doppler shift f
m
given by (Equation of Doppler shift here), the spectral shape developed by
Gans [3] is
( )
|
|
.
|

\
|

=
m
c
m
E
f
f f
f
f S
z
1
5 . 1

(49)
The graph of this function is as follows while f
c
is equal to 2100MHz and for a vehicle with
60km/h.
The block diagram of the simulator is as follows:
Figure.

The first step is to generate independent complex Gaussian random variables to form
baseband line spectrum for positive frequency components. Negative frequency components
are obtained by conjugating positive frequency components. The Gaussian random variables
are generating by Box-Mller method [7]. In this method, the two complex Gaussian random
variables X and Y can be calculated by the following equations:
( )
2 1
ln 2 ) 2 cos( U U X = (50)
( )
2 1
ln 2 ) 2 sin( U U Y = (51)
where U
1
and U
2
are two independent uniformly distributed between 0 and 1.
As a second step, the line spectrum is multiplied with the Doppler spectrum ( ) f S
z
E
. Next,
IFFT is performed on these signals. At the end in-phase and quadrature components are added
together to form Rayleigh fading coefficients such that we obtain N complex coefficients
whose magnitude is Rayleigh distributed and whose phase is uniformly distributed. N is
related with time t in second such that (in MATLAB notation):
( ) ( ) 1 : 0
1
1 : 0 = = N
R
N T t
c
C
(52)
where T
c
is chip period and R
c
is the chip rate as defined in the notation section of this report.
As R
c
is 3.84Mchips/second in 3G [4], the variation of Rayleigh fading channel can be
observed at large N values. For example, the following plot represents the envelope of the
simulator where the velocity v is 60km/h, f
c
is 2100MHz [4] and N = 620000chips.
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18
-20
-15
-10
-5
0
5
10
Signal Envelope vs Time / v = 60km/h
t(s)
S
i
g
n
a
l

E
n
v
e
l
o
p
e

(
d
B
)

Figure
As the chip rate is very high, the Rayleigh amplitudes are slowly varying in the period of T
coh.

In the previous section, we have calculated that the coherence time for v equal to 60km/h is
equal to 14000 chips. When we simulate the simulator for N = 14000, we obtain the following
figure
0 0.5 1 1.5 2 2.5 3 3.5 4
x 10
-3
-8
-6
-4
-2
0
2
4
6
Signal Envelope vs Time / v = 60km/h
for t < Tcoh
t(s)
S
i
g
n
a
l

E
n
v
e
l
o
p
e


Figure
Therefore, for the time the channel is assumed to be time-invariant, the simulator coefficients
amplitude is slowly faded. For lower speeds, the number of fades are even smaller or zero in
one coherence time period. The following figure represents the envelope of the signal for the
case of v = 5 km/h having N = 620000:
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18
-10
-8
-6
-4
-2
0
2
Signal Envelope vs Time / v = 5km/h
t (s)
S
i
g
n
a
l

E
n
v
e
l
o
p
e

(
d
B
)

Figure.
As seen from the figure, the variations of the signal envelope is much less than v = 60 km/h
case. In the simulations, we pre-compute the coefficients in the parts of N equal to 620000 for
each multipath component of each user and we take the coefficients in the blocks of T
c
chips
in order for each TI channel component starting from the first coefficients.
CHANNEL SIMULATION MODEL
The following figure shows the simulation model in block diagram:






Figure.

In the channel model of [1-11-12], the impulse response of multipath channel fading channel
for each user is described as
( )

=
=
d
L
q
q q
t p t h
1
) ( (53)
where L
d

is the number of multipath, which is a random integer between 1 and 10,
q
is the
complex gain of the q
th
path,
q
is the delay of the q
th
path, which is randomly distributed, and
p(t) is the pulse function, which is raised-cosine pulse with the definition of [10]
|
|
.
|

\
|

=
2 2
4 1
cos ) ( sinc ) (
t
t t p

(54)
In our simulations we have used the combination of the model described above with the
Rayleigh fading coefficients whose generation is discussed in the previous section. According
to our model, we assumed that the channel is TI up to the coherence time T
c
. Therefore, we
filter the input spreaded signal x in the blocks of T
c
. As we have mentioned in the previous
section, we pre-compute Rayleigh coefficients in the blocks of 620000. For each multipath
component of each T
c
block of each users input spreaded differential coded signal; the
following channel algorithm is applied:
We first create the FIR filter h
q
[n] of the order of L
h
(n=0,1,2,,L
h
-1)
( ) ) (
q q
n p n h = (55)
In the second step, we filter the corresponding T
c
chips of the input signal, such that we obtain
) ( * ) ( ) (
) (
n h l s l s
q j
q
j
= (56)
where s
j
(l) is the l
th
T
c

component of the input signal and s
j
(q)
(l) is the raised-cosine shaped l
th

component of the q
th
path. h
q
(n) is the impulse response of q
th
path. Finally, we multiply
s
j
(q)
(l) by T
c
complex Rayleigh distributed coefficients (
j
(q)
(l)) obtained from Clarkes model
discussed above where l represent again l
th
T
c
block of the output of the Rayleigh simulator.
Then the q
th
multipath component of the signal x
j
(q)
(l) becomes
) ( ). ( ) (
) ( ) ( ) (
l l s l x
q
j
q
j
q
j
= (57)
Then, summing all multipath components obtained by applying the same steps, we obtain the
l
th
T
c
component of j
th
users received signal x
j
such that
) ( ) (
1
) (
l x l x
d
L
q
q
j j
=
= (58)
After doing the same steps for all l
th
T
c
component to J user, we obtain the whole l
th
block of
the received signal such that
) ( ) (
1
l x l x
J
j
j
=
= (59)
SIMULATION STEPS
In the simulations, the following steps are followed for each iteration.
1) Pre-compute L
1
, L
2
, and L
w
according to (Equation 43) with the inputs of number of
users and L
c
.
2) Create spreading code for each user. Gold sequences are used this project whose
algorithm is discussed in (gold un section).
3) Create the symbol sequence of each user and apply differential encoding as descried in
(PHASE AMBIUITTY SECTION).
4) Spread the signal of each user by multiplying with the corresponding users chip
sequence according to (EQUATIN 1).
5) Filter the signal with the mobile channel model discussed in (CHANNEL CHAPTER).
6) Sum all signals from different users (CHANNELDA EQUATION) add AWGN.
7) Create the sampled data vector X(k) according to (EQUATION 21).
8) Precompute the transformation matrix according to (EQUATION 38).
9) Estimate the correlation matrix R according to (EQUATION 59).
10) Compute linear prediction matrix (EQUATION 60) and linear prediction error correlation
matrix (EQUATION 61).
11) Estimate h
1
(0)
(0).
12) Compute detector w
1
(k) according to (EQUATION 60).
13) Estimate symbol b(k) according to (EQUATION 57).
14) Compute BER rate by the symbols created in step.3 and estimated in step.13.
SIMULATION RESULTS
For every simulation, 1000 iteration are run to find the corresponding value. Usually, this is a
right value for convergence of the output. However, some irregularities are observed in the
output simulations. Whenever such a situations occurred, a simulation of 1000 iterations is
repeated and the average of two runs is taken.
EFFECT OF SYMBOL LENGTH
The symbol sequence length (window size) in the LP algorithm is defined as the number of
symbols that the receiver buffers and uses to find transformed data correlation matrix
(Corrolation Matrix eq 59). This data correlation matrix is found by time averaging.
Theoretically, as the number of symbols increase, the time average should converge to its
statistical mean provided that the process is ergodic. However using longer window sizes
requires larger buffers and introduces more delay. This delay might result in low performance
in real-time multimedia applications such as interactive communication. Longer window size
also increases computational complexity and receiver cost.
In the first simulation, the effect of window size and the velocity of the mobile user are
analyzed. The window size is taken in the range of 100 to 3000 bits. Since BER changes fast
for low values of window size, the step size is chooses to be smaller for low window sizes.
The three different velocity values that are used in the simulation are 4km/h, 50km/h and
100km/h. The reason to choose these values is that both pedestrian (4km/h), urban are traffic
(50km/h) and highway traffic (100km/h) can be observed from the simulation. This
simulation assumes perfect power control (near-far affect equal to 0dB). The SNR value is
10dB, which is a typical lower bound for reliable communication in digital systems. Gold
sequences of length 31 are used and the number of active users is 10. The following graph
shows the results of this simulation:
0 500 1000 1500 2000 2500 3000
10
-6
10
-5
10
-4
10
-3
10
-2
10
-1
10
0
BER vs Detection Window
Detection Window (bits)
B
E
R
v=4km/h
v=50km/h
v=100km/h

Figure. SNR=10dB, NF=0dB, J=10, L
c
=31
From this graph, it can be seen that BER decreases as the window size increases. This was
expected as explained in the previous paragraph. After a point, the BER asymptotically
converges to a value. This value changes according to the mobile users velocity. As velocity
increases, the coherence time decreases (Doppler spread increases) which leads to a faster
varying channel. As a result, the increase in BER with velocity was expected and this
expectation is justified by our graph. As seen from the graph, for small velocities BER
changes more with respect to changes in velocity. When the users velocity is high, BER rate
is effected less from the changes in velocity. In the case of non-pedestrian cases (50km/h and
100km/h), the BER rate remains approximately constant after the symbol sequence length of
1000. However for the pedestrian case this value is higher. Since large buffers increase
receiver complexity, adds delays which will effect real-time applications negatively and using
larger window sizes does not improve the BER performance significantly; window size of
1000 will be used in the remaining simulations. The graph that shows the processing gain due
to buffering is shown below
0 500 1000 1500 2000 2500 3000
0
2
4
6
8
10
12
14
Normalized Processing Delay vs Number of Symbols
Number of Symbols
N
o
r
m
a
l
i
z
e
d

P
r
o
c
e
s
s
i
n
g

D
e
l
a
y

Figure. Figure. v=50km/h, NF=0dB, SNR=10dB, J=10, L
c
=31
This figure shows how processing delay is increased (approximately linear) as the window
size increase. The y-axis shows the processing delay normalized with respect to the
processing delay of the window size 100 (minimum delay). The x-axis shows the window
size.
EFFECT OF SNR
Signal-to-noise ratio (SNR) is defined as the ratio of signal power to the noise power. In the
simulations noise is modeled as additive white Gaussian noise (AWGN). Low SNR values
increase the probability of misdetection thereby increasing the BER.
In this case, the SNR values are in the range of 0dB to 20 dB. As in the previous case,
different mobility case of users are considered with the same user velocities (4km/h, 50km/h
and 100km/h). The window size is taken to be 1000 and perfect power control for all users is
assumed (NF = 0dB). Again the number of active users is 10 with the processing gain of 31.
The following graph graphs show the results of this simulation:
0 2 4 6 8 10 12 14 16 18 20
10
-4
10
-3
10
-2
10
-1
BER vs SNR
SNR (dB)
B
E
R
v=4km/h
v=50km/h
v=100km/h

Figure. Window size = 1000, NF=0dB, J=10, L
c
=31
As seen from the figure, BER decreases with increasing SNR as we have expected. Also, we
see the effects of increasing user mobility. BER increases with increasing velocity.

EFFECT OF NUMBER OF ACTIVE USERS
Multiaccess interference (MAI) is the main source of interference in CDMA systems. Since
all users transmits in the same frequency band, each users signal acts as interference on the
desired users symbol. Thus MAI is directly proportional to the number of active users.
In this simulation, the effect of MAI on the BER is analyzed. The range of active users is
between 2 and 10. As in the previous cases, three different mobiles velocity cases are
considered (4km/h, 50 km/h, 100 km/h). Perfect power control is assumed (NF=0dB) and
SNR is taken 10dB. The window size is again 1000. The following graph illustrates the results
of the simulation:
2 3 4 5 6 7 8 9 10
10
-4
10
-3
10
-2
BER vs # of Active Users
# of Active Users
B
E
R
v=4km/h
v=50km/h
v=100km/h

Figure. Window size = 1000, NF=0dB, SNR=10dB, L
c
=31
For pedestrian type of users, BER does not change very much with to respect to the number of
active users. However, for higher velocities, BER is more sensitive to the number of active
users.
In this algorithm, the number of active users is limited by the length of chip sequence. As the
number of active users reaches the length of chip sequence, the computational complexity
increases exponentially. The following figure demonstrates this,
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
10
0
10
1
10
2
10
3
Normalized Computational Complexity vs Normalized # of Active Users
Normalized # of Active Users
N
o
r
m
a
l
i
z
e
d

C
o
m
p
u
t
a
t
i
o
n
a
l

C
o
m
p
l
e
x
i
t
y

(
f
l
o
p
s
)

Figure.
This figure shows how computational complexity is increased as the numbers of users reach
the length of the chip sequence. The y-axis shows the number of flops (MATLAB flops)
normalized with respect to the flops of two-user case. The x-axis shows the number of active
users normalized with respect to the length of the chip sequence L
c
. When gold sequences of
length 31 are used, the computational load increases too much when the number active users
above 10. The increase in computational load is due to the increase the equalization tab size
L
w
. As the number of users increase, the denominator of (Equation 43) decreases (goes to
zero when J = L
c
), which causes L
w
to increase exponentially and blow up to infinity at the
limiting case. According to this equation,
J L
J L
L
c
c
w

2 2
(60)
To prevent this, longer PN sequence should be used. However, this also increases the
computational load. For this reason, in our project, we limit the number of active users with
10.


NEAR-FAR EFFECT
Because users are distributed randomly in the cell, each user has a different distance to the
base station. According to the theory of large-scale fading, each users signal is received with
different power [3]. Near-far ratio is thus the ratio of interfering users power to the power of
the desired users power. The interference of a high power user on a relatively low power user
is known as the near-far effect. Since current CDMA systems like IS-95 use power control, all
simulations up to this point assumed perfect power control [8]. Power control is done by
feedback and this increases system complexity. Thus, receivers, which are robust to near-far
effect, are preferred.
In this simulation, the effect of near-far ratio on the BER is analyzed for the range of 0 to
20dB. Worst case is assumed such that all interfering users have the same power level (e.g.
100 time greater for 20dB case). In this simulation, the effect of a wider range of mobility is
analyzed. The velocity is taken as 4km/h, 20km/h, 30km/h, 50km/h and 100km/h. The
window size is taken to be 1000 and SNR is equal to 10dB. The number of active users is
again 10 with L
c
equal to 31. The below graph is the result of the simulation:
0 2 4 6 8 10 12 14 16 18 20
10
-4
10
-3
10
-2
10
-1
10
0
BER vs Near-Far Ratio (NF)
NF (dB)
B
E
R
v = 4 km/h
20 km/h
30 km/h
50 km/h
100km/h

Figure. Window size = 1000, J=10, SNR=10dB, L
c
=31
As can be seen from the figure, the algorithm is robust to near-far effect for velocities less
than 20km/h. For higher velocities, the performance is severely effected by near-far effect,
BER blows up. Especially, after 10 dB near-far ratio at high velocities, the system become
completely useless. Therefore, strict power control algorithms must be used while using this
detector. Since current CDMA systems (IS-95) use power control, this is not a very limiting
restriction on the system.
EFFECT OF USERS VELOCITY
As it is mentioned previously, the velocity of the user effects how fast the channel conditions
change. Here, the effect of velocity of BER is illustrated for a wider range of velocity values
to represent all possible user mobility cases.. In this case, the velocity range is from 0.5km/h
to 150km/h. The window size is taken to be 1000 and SNR is equal to 10dB with NF equal to
0dB. The number of active user is 10 with L
c
equal to 31.The following figure shows the
simulation results:
0 50 100 150
10
-4
10
-3
10
-2
BER vs Velocity
velocity (km/h)
B
E
R

Figure.
As the velocity increases the BER increases. Since velocity is inversely related to coherence
time, as the velocity increases channel changes more rapidly. The figure also demonstrates
that the BER converges to a asymptotical value as the velocity of the user is increased. The
reason for this is that coherence time is inversely related to velocity and as velocity increases
coherence time also converges. This shows that the rate of change of channel parameters do
not change very much after some point.
CONCLUSION
In this engineering project, we have investigated the performance of the proposed algorithm
in [1]. The simulations were carried out under time-varying frequency selective multipath
Rayleigh fading channel conditions. The effect of several parameters is investigated. As a
result, it is seen that the detector is robust to SNR and MAI. Near-far effect can also be to
tolerated provided that the user velocity is below 20 km/h. Typical BER are in the range of
3x10
-4
to 5x10
-3
. Note that these are physical layer BERs. Using error detecting and correcting
codes, and other techniques such as interleaving will decrease BER.
It can be concluded that, this algorithm can be used in applications where small BER rates are
not strictly required. Voice communication might be a typical example. Further research is
required about coding to make a conclusive statement on the applicability of this system for
other kind of data transmission. The main drawback of this algorithms for the applicability in
3G systems is the limitations on the number of users and computational complexity. The
number of user in a cell are limited by the processing gain, to have relatively low
computational complexities, the number of users should be less than half the processing gain.
Since the processing gain of 3G system has not been standardized yet, a strict conclusion
cannot be reached.


REFERENCES
[1] H.H. Fan and X.Li, Linear Prediction Approach for Joint Blind Equalization and Blind
Multiuser Detection in CDMA Systems, IEEE Transactions on Signal Processing, vol.48,
no.11, pp.3134-3145, November 2000.
[2] Q. Zhao and L. Tong, Adaptive Blind Channel Estimation by Least Squares Smoothing,
IEEE Transactions on Signal Processing, vol.47, no.11, pp.3000-3012, November 1999.
[3] T. S. Rappaport, Wireless Communications Principles & Practice, Prentice Hall Inc.,
1996.
[4] Y. Lin and I. Chlamtac, Wireless and Mobile Network Architectures, John Wiley &
Sons Inc. 2001
[5] D. Boss, K. Kammayer and T. Petermann, Is Blind Estimation Feasible in Mobile
Communication Systems? A Study Based on GSM, IEEE Journal In Selected Areas in
Communications, vol.16, No.8, October 1998
[6] Y. Pei, Analysis of Power Estimation Techniques in CDMA Systems, Master Thesis,
Texas A&M University, December 1999.
[7] M.C. Jeruchim, P. Balaban and K. S. Shanmugan, Simulation of Communication
Systems Plenum Press, 1992.
[8] EE 470 mobile communications, Hakan Deli Lecture Notes, , Boazii University ,
Turkey, Spring 2001.
[9] X. Wang and H. Vincent, Blind Equalization and Multiuser Detection in Dispersive
CDMA Channels, IEEE Transactions on Communications, vol.46, no.1, pp.91-103, January
1998.
[10] S. Haykin, Communication Systems, John Wiley & Sons Inc., 1994.
[11] J. G. Proakis, Digital communications, McGraw Hill, 1995.
[12] M. Torlak and G. Xu, Blind Multiuser Channel Estimation in Asynchronous CDMA
Systems, IEEE Transactions on Signal Processing, vol.45, no.1, pp137-147, January 1997.
[13] B. N. Datta, Numerical Linear Algebra and Applications, Brooks/Cole Publishing
Company, 1994.
APPENDIX - MATLAB CODES
function [error_data]=simulation_main(Nd,dB,nf,v,J,Lc)

%Nd : Detection window size
%dB : SNR
%nf : Near-Far ratio in dB
%v : velocity of the user in km/h
%J : number of active users
%Lc : processing gain
%error_data: the output of the simulation gives the number of data with
error in bits


%COMPUTING CONSTANTS
Lh=5; %channel length
L1=ceil((J-1)/(Lc-J)); %upper
L2=ceil(2*J/(Lc-J)); %lower
Lw=L1+L2+1; %detector length
Lc=Lc; % lower, data vector length

P=[1,ones(1,J-1)*10^(nf/10)]; %near-far effect

%CREATING USER'S SPREADING CODES
for k = 1:J
co(k,:)=(goldyako(5,[5 4 3 2],[5 4 2 1]))';
end


%CREATING USER'S BIT SEQUENCES
nu=rand(1,J)*Lc;
tao=floor(nu/2);
dta=nu-tao;
tao(1)=0;
tao=[0 floor(rand(1,J-1)*Lc)];
b=sign(rand(Nd+1,J)-0.5);
b_orig=b;
b=sign(b+1);
b=differo(b',0)'; %appying differential encoding
b=sign(b-0.5);
a=zeros(Lc,2*J-1);
a(:,1)=co(:,1);
for i=2:J,
if tao(i)<=Lc-1,

a(tao(i)+1:Lc,2*i-2)=a(tao(i)+1:Lc,2*i-2)+(1-dta(i))*co(1:Lc-1-tao(i)+1,i);
end
if tao(i)+1<=Lc-1,

a(tao(i)+2:Lc,2*i-2)=a(tao(i)+2:Lc,2*i-2)+dta(i)*co(1:Lc-1-tao(i)-1+1,i);
end

if tao(i)-1>=0,

a(1:tao(i)-1+1,2*i-1)=a(1:tao(i)-1+1,2*i-1)+(1-dta(i))*co(Lc-
tao(i)+1:Lc,i);
end
if tao(i)>=0,

a(1:tao(i)+1,2*i-1)=a(1:tao(i)+1,2*i-1)+dta(i)*co(Lc-tao(i)-1+1:Lc,i);
end
end


%MULTIPATH RAYLEIGH CHANNEL
NMC=10; % MAximum Number of Multipath Components
x1=zeros(1,Lc*Nd);
tauu = rand(NMC,J);
Ld = rand(1,J);
Tc=cohtime(v);
t=0:Lh-1;
for k=1:J,
if k==1, r=a(:,1)*b(1:Nd,1).';
for i=1:Lc, x1(i:Lc:Lc*Nd)=r(i,:); end
kalan = x1;
tempx=[];
while (length(kalan)>Tc)
h=zeros(1,Lh);
for l=1:round(Ld(1,k)*(NMC-1))+1,
h=h+raylrnd(1,1,1)*rscos(t-(tauu(l,k)-0.5)*20,0.2);
end
h=h/norm(h);
temp = filter(h,1,kalan(1,1:Tc));
temp = temp.*fade(v,2100,Tc,5);
tempx = [tempx temp];
kalan = kalan(:,Tc+1:length(kalan));
end
h=zeros(1,Lh);
for l=1:round(Ld(1,k)*(NMC-1))+1,
h=h+raylrnd(1,1,1)*rscos(t-(tauu(l,k)-0.5)*20,0.2);
end
h=h/norm(h);
temp = filter(h,1,kalan);
temp = temp.*fade(v,2100,kalan,5);
x = [tempx temp];
x2=x;
else r=P(k)*(a(:,2*k-2)*b(2:Nd+1,k).'+a(:,2*k-1)*b(1:Nd,k).');
for i=1:Lc, x1(i:Lc:Lc*Nd)=r(i,:); end
kalan = x1;
tempx=[];
while (length(kalan)>Tc)
h=zeros(1,Lh);
for l=1:round(Ld(1,k)*(NMC-1))+1,
h=h+raylrnd(1,1,1)*rscos(t-(tauu(l,k)-0.5)*20,0.2);
end
h=h/norm(h);
temp = filter(h,1,kalan(1,1:Tc));
temp = temp.*fade(v,2100,Tc,5);
tempx = [tempx temp];
kalan = kalan(1,Tc+1:length(kalan));
end
h=zeros(1,Lh);
for l=1:round(Ld(1,k)*(NMC-1))+1,
h=h+raylrnd(1,1,1)*rscos(t-(tauu(l,k)-0.5)*20,0.2);
end
h=h/norm(h);
temp = filter(h,1,kalan);
temp = temp.*fade(v,2100,kalan,5);
x = x+[tempx temp];
end
end

%ADD AWGN NOISE
n=randn(size(x));
n=n/norm(n)*10^(-dB/20)*norm(x2);
x=x+n;





%FIND THE TRANSFORMATION MATRIX T
c1=co(:,1)';
I_L1 = ones(1,(L1-1)*Lc);
I_L2 = ones(1,L2*Lc);
I_1 = ones(1,Lc);
temp = zeros(1,Lc);
temp(1) = c1(1);
C_10 = toeplitz(temp,c1);
temp = zeros(1,Lc);
temp2 = zeros(1,Lc);
temp3 = fliplr(c1);
temp2(2:Lc) = temp3(1:Lc-1);
C_11 = toeplitz(temp2,temp);
C1 = [C_11' C_10']';
[u,s,v] = svd(C1);
u = (u(:,Lc+1:2*Lc))';
temp = u*C1;
T1 = u(:,1:Lc);
T2 = u(:,Lc+1:2*Lc);
T = zeros(Lw*Lc,Lw*Lc);
T(1:(L1-1)*Lc,1:(L1-1)*Lc) = diag(I_L1);
T((L1-1)*Lc+1:L1*Lc,(L1-1)*Lc+1:L1*Lc) = T1;
T((L1-1)*Lc+1:L1*Lc,L1*Lc+1:(L1+1)*Lc) = T2;
T(L1*Lc+1:(L1+1)*Lc,L1*Lc+1:(L1+1)*Lc) = diag(I_1);
T((L1+1)*Lc+1:Lw*Lc,(L1+1)*Lc+1:Lw*Lc) = diag(I_L2);


%THE DETECTION ALGORITHM
X=zeros(Lc*Lw, Nd-Lw);
for i=2:Nd-Lw-1
X(:,i)=x(Lc*(i+Lw):-1:Lc*i+1).';
end
Xc=T*X;
R=Xc*Xc'/(Nd-Lw);
R11 = R(1:L1*Lc,1:L1*Lc);
R12 = R(1:L1*Lc,L1*Lc+1:(L1+1)*Lc);
R13 = R(1:L1*Lc,(L1+1)*Lc+1:Lw*Lc);
R21 = R(L1*Lc+1:(L1+1)*Lc,1:L1*Lc);
R22 = R(L1*Lc+1:(L1+1)*Lc,L1*Lc+1:(L1+1)*Lc);
R23 = R(L1*Lc+1:(L1+1)*Lc,(L1+1)*Lc+1:Lw*Lc);
R31 = R((L1+1)*Lc+1:Lw*Lc,1:L1*Lc);
R32 = R((L1+1)*Lc+1:Lw*Lc,L1*Lc+1:(L1+1)*Lc);
R33 = R((L1+1)*Lc+1:Lw*Lc,(L1+1)*Lc+1:Lw*Lc);
P = [R21 R23]*pinv([R11 R13;R31 R33]);
P1 = P(:,1:L1*Lc);
P2 = P(:,L1*Lc+1:(L1+L2)*Lc);
e = ((-1.*P)*[R12;R32])+R22;
[u,s,v] = svd(e);
h1 = u(:,1);
I_1 = ones(1,Lc);
w1 = h1'*[(-1.*P1) diag(I_1) (-1.*P2)]*T;
bh=sign(w1*X);
%Differential encoding
bh=sign(bh+1);
bh=differo(bh,1);
bh=sign(bh-0.5);
%Calculate BER
error_data=((Nd-6)-length(find(((b_orig(5:(Nd-2),1))'-bh(1,3:(Nd-
4)))==0)));


function sim_window

%simulation to see the effect of detection window size on BER
J = 10;
snr = 10;
NF = 0;
Lc=31;
ber_final=zeros(3,16);
i = 1;
for v = [4 50 100]
n=1;
for Nd=[100 200 300 400 500 600 700 800 900 1000 1250 1500 1750 2000
2500 3000]

total_error = 0;
data = 0;
for k = 1:1000
[v,Nd,k]
[error_data]=simulation_main(Nd,snr,NF,v,J,Lc);
total_error = total_error+error_data;
end
data = k*(Nd-6);
ber_final(i,n) = 100*(total_error/data);
n=n+1;
save ber_window
end
i = i+1;
end
ber_window


function sim_snr

%simulation to see the effect of SNR on BER
J = 10;
NF = 0;
Lc=31;
Nd = 1000;


ber_final=zeros(3,5);
i = 1;
for v = [4 50 100]
n=1;
for snr = [0 5 10 15 20]
total_error = 0;
data = 0;
for k = 1:1000
[v,snr,k]
[error_data]=simulation_main(Nd,snr,NF,v,J,LC);
total_error = total_error+error_data;
end
data = k*(Nd-6);
ber_final(i,n) = 100*(total_error/data);
n=n+1;
save ber_snr
end
i = i+1;
end
save ber_snr


function sim_user

%simulation to see the effect of # of active users on BER
snr = 10;
NF = 0;
Lc=31;
Nd = 1000;
ber_final=zeros(1,5);
i = 1;
for v = [4 50 100]
n=1;
for J = [2 4 6 8 10]
total_error = 0;
data = 0;
for k = 1:1000
[v,J,k]
[error_data]=simulation_main(Nd,snr,NF,v,J,Lc);
total_error = total_error+error_data;
end
data = k*(Nd-6);
ber_final(i,n) = 100*(total_error/data);
n=n+1;
save ber_user
end
i = i+1;
end
save ber_user


function sim_nf

%simulation to see the effect of NF on BER
J = 10;
snr = 10;
NF = 0;
Lc=31;
Nd = 1000;
ber_final=zeros(5,5);
i = 1;
for v = v = [4 20 30 50 100]
n=1;
for NF=[0 5 10 15 20]

total_error = 0;
data = 0;
for k = 1:1000
[v,NF,k]
[error_data]=simulation_main(Nd,snr,NF,v,J,LC);
total_error = total_error+error_data;
end
data = k*(Nd-6);
ber_final(i,n) = 100*(total_error/data);
n=n+1;
save ber_nf
end
i = i+1;
end
save ober_nf


function sim_velocity

%simulation to see the effect of user's velocity on BER
J = 10;
snr = 10;
NF = 0;
Lc=31;
Nd = 1000;
ber_final=zeros(1,10);
n=1;
for v = [0.5 2 5 10 25 50 75 100 125 150]
total_error = 0;
data = 0;
for k = 1:1000
[v,k]
[error_data]=simulation_main(Nd,snr,NF,v,J,Lc);
total_error = total_error+error_data;
end
data = k*(Nd-6);
ber_final(1,n) = 100*(total_error/data);
n=n+1;
save ber_velocity
end
save onder_velocity


function sim1


%simulation to see the effect of # of active users on computational
complexity
K = 10;
snr = 10;
NF = 0;
Lc=31;
Nd=1000;
v = 4;
flops_user=zeros(1,13);
n=1;
for J=[2 11 16 17 21 22 23 24 25 26 27 28 29]
[K]
[error_data]=simulation_main(Nd,snr,NF,v,J,Lc);
flops_user(1,n) = flops;
n=n+1;
save flops
end
save flops


function sim_delay

%simulation to see the effect of window size on processing delay
snr = 10;
NF = 0;
Lc=31;
v = 50;
J=10;
delayo=zeros(1,18);
i = 1;
n=1;
for Nd = [100 200 300 400 500 600 700 800 900 1000 1250 1500 1750 2000
2250 2500 2750 3000]
zaman = cputime;
[error_data]= simulation_main (Nd,snr,NF,v,J,Lc);
delayo(1,n)=cputime-zaman;
Nd
n=n+1;
save delay
end
save delay


function A = fade(v,fc,N,N0)

%Creating rayleigh coefficients according to Clarke's model
%v : velocity of the mobile in km/h
%fc : carrier frequency in MHz/1000
%N: number of coefficients to be computed
%N0: standard variation

Rb = 3.84e6;
c = 3e8;
v = v*(1000/3600);
fd = v/(c/(fc*1e6));
T = 1/Rb;
t = T*(0:N-1);
deltaf = 1/N/T;
n = floor(fd/deltaf);
f = deltaf*(0:n);
S_f = sqrt(1.5./(pi*sqrt(fd^2-f.^2)));
S_f = S_f/sqrt(mean(S_f.^2));
rand('state',sum(100*clock));
[z0, z1] = box_muller(n+1);
g_i = zeros(1,N);
g_i(1:n+1) = S_f*sqrt(N0/2).*(z0)/sqrt(2);
g_i(N-n+1:N) = conj(g_i(n+1:-1:2));
g_q = zeros(1,N);
g_q(1:n+1) = S_f*sqrt(N0/2).*(z1)/sqrt(2);
g_q(N-n+1:N) = conj(g_i(n+1:-1:2));
A_i = real(ifft(g_i))/sqrt(2*(n+1))*N;
A_q = real(ifft(g_q))/sqrt(2*(n+1))*N;
A = A_i + j*A_q;


function [z0, z1] = box_muller(N)

%BOX_MULLER creates two orthogonal gaussian distributed random numbers of
length N, mean 0, std 1
%This function uses Box-Miller approxiamation
%N : lenhth of the vectors z0 and z1
%z0 : first vector with cos term
%z1 : second orthogonal vector with sin term

rand('state',sum(100*clock));
U1 = rand(1,N);
U2 = rand(1,N);

z0 = ((-2*log(U1)).^0.5) .* cos(2*pi.*U2);
z1 = ((-2*log(U1)).^0.5) .* sin(2*pi.*U2);


function Tc=cohtime(v)

%Computes coherence time
%v : velocity of the user in km/h
%Tc : coherence time in chips

fc=2100;
Rc = 3.84e6;
c = 3e8;
v = v*(1000/3600);
fd = v/(c/(fc*1e6));
Tc = round((0.423/fd)*Rc);


function r=rscos(t,beta)

%Raised cosine function
%t :the input vector
%beta: roloff factor
%r: output vector

r=sinc(t).*cos(pi*beta*t)./(1-4*beta^2*t.^2);


function z = differo(b,state)

%DIFFERO does differential encoding and decoding
%b : input binary vector
%z : output nrz vector
%state : 0 for encoding
% 1 for decoding

[row,col] = size(b);
z=zeros(row,col);
z(:,1)=b(:,1);
if state == 0 %encoding
for i = 2:col
z(:,i) = xor(b(:,i),z(:,i-1));
end
else
if state == 1 %decoding
for i = 2:col
z(:,i) = xor(b(:,i),b(:,i-1));
end
end
end


function [p] = mls(m, tabs);
% [p] = mls(length, tabs)
% returns the maximum-length sequence (m-sequence)
% m : the number of the flip-flop
% tabs: is the row-vector shoving the place of tabs
% according to table9.1 at HAYKIN
% p : output vector size of 2^m-1

p = zeros(1,(2^m)-1);
rand('state',sum(100*clock));

for g = 1:m
a(g) = randint(1);
end
sizo = size(find(a == 0));
while sizo(1,2) == m
for g = 1:m
a(g) = randint(1);
end
sizo = size(find(a == 0));
end


[srow,scol] = size(tabs);

for h = 1:(2^m)-1

c = a(tabs(1));
for g = 2:scol
c = mod((c+a(tabs(g))),2);
end

p(h) = a(m);

temp = a;
for g = 1:m-1
a(g+1) = temp(g);
end
a(1) = c;

end

p = isonrz(p);


function [p] = gold(m, tabs1, tabs2)
% [p] = gold(m, tabs1, tabs2)
% returns the gold sequence (m-sequence)
% m : the number of the flip-flop
% tabs1: is the row-vector shoving the place of tabs
% according to table9.1 at HAYKIN
% tabs2: is the row-vector shoving the place of tabs
% according to table9.1 at HAYKIN
% p : output vector size of 2^m-1

p1 = mls( m, tabs1);
p2 = mls( m, tabs2);
p1 = (p1 == -1);
p2 = (p2 == -1);
p = mod(p1+p2,2);
p = isonrz(p);


function z = isonrz(b)

%ISONRZ convertz a binary signal to isomorphic non-return to zero form
%if b = 0, nrz = +1
%if b = 1, nrz = -1
%z = isonrz(b)
%b : input binary vector
%z : output nrz vector

temp = (b == 0);
z = sign(temp - 0.5);

You might also like