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

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

Embed Size (px)

DESCRIPTION

mud detection

Citation preview

Page 1: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

Page 2: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

INTRODUCTION

Communication has been a very important tool for humans Recently with the huge market

penetration of 2nd generation cellular phone systems, people are getting used to the idea of

communications “anywhere” & “anytime”. Although 2nd generation mobile systems mainly

support voice traffic, some enhancements have been proposed for data traffic as well. It is

assumed that 3rd 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 user’s 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

Page 3: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 user’s 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 other’s 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 user’s 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.

Page 4: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

bj(l): jth user’s symbol sequence

cj(k): jth user’s spreading code

sj(k): jth user’s spreaded symbol sequence

gj(k): jth user’s multipath channel impulse response

Rc : Chip rate

Tc : Chip period (1÷Rc)

Rs : Symbol rate

Ts : Symbol period (1÷Rs)

Lc : Length of chip sequence in terms of chips

PG: Processing gain (Ts÷Tc=Rc÷Rs=Lc)

n(k): additive white gaussian noise

NF : near-far ratio

SNR : signal-to-noise ratio

Page 5: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 2m-1. Therefore, using m-state MLS generator, we can

obtain a spreading code whose processing gain is 2m-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 mth 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 1st component of the

register.

3) Repeat 2nd step 2m-1 times to obtain 2m-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

Page 6: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 2m-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 wj(k) which is decorrelating for MAI rejection and zero-forcing for ICI

removal. Let sj(k) be the spreaded symbol sequence such that each symbol bj(l) is multiplied

by the spreading code cj(k) such that:

( ) )()( cl

jjj lLkclbks −=∑ (1)

Note that bj(l) is at symbol rate Rs, cj(k) and sj(k) are at the chip rate Rc. For further

discussion, it is necessary to note that

<≥<≤

=00

0)(

korLkLknonzero

kcC

cj (2)

When the channel impulse response gj(k) is assumed to be causal and dj is the delay of the

channel in terms of chip, then the jth component of the received signal becomes by simple

manipulations:

Page 7: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

( ) ( ) ( )( ) ( ) ( )( ) ( ) ( ) ( )( ) ( ) ( ) ( )

( ) ( ) ( )( ) ( ) ( )∑

∑ ∑

∑ ∑

∑∑

−−=

−−−=

−−−=

−−−=

−−=

=

=

ljcjjj

l

L

ijcjjjj

ljj

icjjj

ijj

lcjjj

ijjjj

jjj

dlLkhlbkx

idLkgiclbkx

idkglLiclbkx

idkglLiclbkx

idkgkskx

kgkskx

c 1

0)(

*

(3)

Where the response of the channel to the spreading code hj(k) “channel vector” is:

( ) )()( lkglckhl

jjj −= ∑ (4)

Define:

1,,1,0)1()(

1,,1,0)1()()(

)(

−=−−+=

−=−−+=

ccji

j

ccji

j

LiiLckLxkx

LiiLckLhkh

Κ

Κ (5)

Then combining with (12), (13) and (14), we get

( )

( )

( ) ( ) ( )( )

( ) 1,,1,0)()(

1)(

)1()(

)1()(

)1()(

)()(

)(

)(

)(

)(

−=−=

−+−+−=

−−−−+=

−−+=

−−+=

+∑

cdi

jl

ji

j

jcjl

ji

j

jccjl

ji

j

cjl

ji

j

cji

j

Lilkhlbkx

diLcLlkhlbkx

dlLiLckLhlbkx

iLckLhlbkx

iLckLxkx

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(

llkblklbk

lkh

lkhlkh

lb

lkhlb

lkhlb

lkhlb

kx

kxkx

j

L

ljj

ljj

dLj

dj

dj

lj

dLj

lj

dj

lj

dj

lj

Lj

j

j

h

jc

j

j

jc

j

j

c

hhx ∑∑

∑∑

=

+−

+

+−

+

−=−=

−−

=

=

ΜΜΜ (7)

Where Lh is related with the length of hj and and delay dj.

Page 8: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

When we again stack up vectors related with the length of Lw

Then () can be represented in vector notation

+−−

−−

=

)2(

)1()(

)1()1(0

)1(00

)0(00

)1()0(0)1()1()0(

)(

)()(

)()(

)(

)(

)()(

)()()(

whj

j

j

hdj

dj

hdj

dj

dj

dj

hdj

dj

dj

j

j

j

LLk

kk

L

LL

k

kk

jj

j

j

jj

jjj

b

bb

hh

h

h

hhhhh

x

xx

ΜΛΟ

ΜΛ

ΛΟΟΟΜΛ

Λ

Μ (8)

The above vector-space representation can be written as:

)()( )(j kk j

dj

j bHX = (9)

where )(j kX 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

kk

kkk

J

dJ

ddJ

j

J

jj

dj

jjjj

b

bb

HHHbHXXΜ

Λ (10)

By simple manipulations, xj 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

11)0(

1

)0(

)1(

)0(

)1()0()0( g

0

0h C

g

Lg

c

Lccg

LLc

gc

=

−=

ΜΜΟ

Λ (11)

1)0(

11

1

1

11

1)0(1

)0(

)1(

0)1()1(

)1(00

)1( g

0

h C

g

Lg

Lcc

Lc g

LL

c

c

gc

=

−=

ΜΛ

ΜΟΟΜΜΟ

ΛΛ

(12)

Page 9: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

)1()2( )0(1

)0(1 −hLhh Λ will be zero. Therefore the simplified version equation 18 becomes:

+−−

=

−+××)2(

)1()(

)1(

00

)0(00

)1()0(000)1()0(

)(

)()(

)()(

)()(

)()(

)()(

1)( whj

j

j

LLLLLLL

dj

dj

dj

dj

dj

dj

LLj

j

j

LLk

kk

k

kk

chcwcwc

jj

jj

jj

wcb

bb

hh

hhhh

x

xx

Μ

ΛΟΟΟΜΛ

Μ

(13)

The H1(0) matrix then becomes:

1)0(

11

1

1

1

1

)0(11

)0(10

)0(11

)0(10

)()(

)()(

)()(

)0(1

)1(000

)0(00

)1()0(000)1()0(

GC

g0g

0g0

0

hh

hhhh

H

=

=

=

=

C

CC

CC

jj

jj

jj

dj

dj

dj

dj

dj

dj

ΜΜΜ

ΟΟΟΟ

ΛΟΟΟΜΛ

(14)

If C1-1 H1

(0) is considered, it can be written as:

=

=−

***

***

1)0(

11

1

1

1

1

g0g

0gGIHC

ΜΜΜ

(15)

denotes the nonzero elements of the matrix. The only nonzero element component in the

Lth column is g1. This derivation is true only for the first user, j=1. For j≠1 the resultant

matrix becomes:

=−

******

)0(1

0HC jj (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

Page 10: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

From the previous discussion C1-1 H1

(0) has only Lc many nonzero entries in any column

except the first one. Our aim is to choose T matrix such that TH1 will have only Lc

nonzero entries in the (L1+1)th column. In other words we will annihilate one of h1(0)(0) or

h1(0)(1) from the (L1+1)th column of H1

(0).

=

=

=

1

1

1

)0(11

)0(10

)0(11

)0(10

)()()(

)()(

)()(

)0(1

)1(000

)0()0(0

)1()0(000)1()0(

g0g

0g0

0

hhh

hhhh

H

CC

CC

jjj

jj

jj

dj

dj

dj

dj

dj

dj

dj

ΟΟΟΟ

ΛΟΟΟΜΛ

(17)

It is proofed in [1] that the following matrix annihilated the h1(0)(1) from the L1

th block row

and (L1+1)th column of H1(0):

=

2

1

L

1

21

1L

IITT

I

T (18)

Ik is a kLcx kLc identity matrix. After the transformation the (L1+1)th column of H1(0) will

change as follows:

)1(0

0)1(

)0()0(

)0(12

)0(1

)0(11

)0(1

h

h

hh

T

T

(19)

However when T is multiplied with other Hj no elements will equal to zero, such that

0)0()1( )(2

)(1 ≠+ jj d

jd

j hThT (20)

According to [1] the transformation matrix T matrix can be calculated such that [T1 T2]

consists of the left singular vectors corresponding to the zero singular values of the matrix

[C11(0)H C10

(0)H]H. The proof is omitted here but it can be found in [1]. The transformed

matrix gives:

Page 11: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

=

=

)1(000

)0()0(0)1(

)1(0000)0()0(

)()()(

)0(12

)(

)0(11

)(

)0(1

jjj

j

j

dj

dj

dj

dj

dj

h

h

hhhT

hTh

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)(

kb

kb

kb

kbk

J

djj

dd

J

d j ΜΛΜ HHHTTHTX (22)

=)(

)(

*0**

**0**

*0**

**0**

)1()0(

)1()0()1()0(

1

)0(1

)0(1

)0(1

)0(1

)0(1

)0(1

kb

kb

hh

hhhh

J

ΜΛΟΟ

TH(dj) is decomposed as follows:

=

2

0

1)(

QQQ

jdTH (23)

Q0 corresponds to the row, 1 below the annihilated element. ( (L1+1)th column of H1(d1), the

unannihilated one).

2

1

QQ

has exactly one zero column, which is the (L1+1)th column of the

first user block. Striking out this column, we get the full column rank matrix of

2

1

QQ

.

In the asynchronous case assumption A3 will become:

JLJLL

JLJL

c

cw

c −−+

≥−−

≥221

1 (24)

This is due to the fact that the zero column is stroked out. The Lc dimensional two-sided linear

prediction error vector is defined as:,

[ ] )()( kk XTPIP 21 −−=ε (25)

Page 12: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

{ } [ ] [ ][ ]

−−=

H2

H1

H2

H0

H1

2

0

1

21

PIP

QQQQQQ

PIP )()()(

)()()( 1

1

kbkbkb

kbkkE J

HH

J

H ΛΜεε (26)

After minimizing { })()( kkE Hεε over P1 and P2 and equating to zero, the following conclusion

can be reached:

[ ] ]00)0(00[][ )0(1

)()2(2

)1(1 ΛΛΛΛ hdj

jdd =−− HHHTPIP 21 (27)

when applied to the input matrix X(k), the result becomes:

[ ] [ ]

)0()(

)(

)(]00)0(00[

)(

)(][)(

)0(111

1)0(

1

1)()2(

2)1(

1

hLkb

kb

kbh

kb

kbk

J

J

djj

dd

−=

=

−−=−−

ΜΛΛΛ

ΜΛ HHHPIPXTPIP 2121

(28)

As a result it can be seen that symbol estimation can be applied after transformation and the

estimation of h1(0)(0). To estimate h1

(0)(0), E{ε(k)εH(k)} should be analyzed.

{ } )0()0()()( )0(1

)0(11

HH hhAkkE =εε (29)

A1 is associated with the power of the received signal and it only acts as a constant. It is stated

in [1] that )0()0(1h equals the singular vector corresponding to the only non-zero singular value

of { })()( kkE Hεε . The identified channel becomes:

[ ] )0()0(1

1)0(101 hg −

= C (30)

The zero-forcing equalizer and decorrelating detector vector should be:

[ ]TPIPhw 21 −−= )0()( )0(11 kH (31)

when applied to X(k)

)()0()()( 11

2)0(11 LkbkkH −= hXw (32)

In other words, other than a scaling factor, the symbol can be estimated as:

)()0()()()(ˆ )0(1111 kkkLkb HH εhXw ==− (33)

COMPUTATION OF ERROR

Page 13: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

The transformed data correlation matrix is defined as [1]:

{ }

==

333231

232221

131211

)()(RRRRRRRRR

TXTXR HH kkE (34)

The optimum solution for the linear prediction problem is:

[ ] [ ]+

=−−

3331

1311232121 RR

RRRRPP (35)

{ } [ ] 2232

12

3331

13112321)()( R

RR

RRRR

+

−=

+

RRkkE 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

TVΣ= UA (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, vdsΣ (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.

Page 14: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 it’s 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 ith 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);();( ττ thtP ∝ (39)

When we take the time average of above equation, the time-invariant multipath power delay

profile P(τ) is found.

Page 15: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

Now the mean excess delay τ can be found such that

( )

( )∑∑

=

kk

kkk

P

P

τ

τττ (40)

Then rms delay spread, which is the second central moment of the power delay profile, is

defined by

22 ττστ −= (41)

where

( )

( )∑∑

=

kk

kkk

P

P

τ

τττ

2

2 (42)

Coherence bandwidth Bc, 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

τσ51

≈cB (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, Bc can found as

kHzBc 2001051

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 Tcoh 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

Page 16: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

stationary (WSS) [5]. It is inversely proportional with the maximum value of the Doppler

shift. The maximum value of the Doppler shift fm can be calculated such that [3]

cvfvf c

m ==λ

(44)

where λ is the wavelength, fc is the carrier frequency and c is the speed of light equal to

3x108m/s. For some vehicle speed, maximum Doppler shift is found by taking fc 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]

mcoh f

T 423.0≈ (45)

Then for a typical vehicle traveling in a street with a velocity of 60km/s, Tcoh can be found as

ms

cvf

Tc

coh 626.3102100

6.3160

103423.0423.06

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:

Page 17: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

0 10 20 30 40 50 6010-3

10-2

10-1

100Velocity (v) vs Coherence Time (Tcoh)

v (km/h)

Tcoh

(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 Tcoh become smaller for larger

velocities. Therefore, at larger velocities, increasing the user’s 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

<

∞<≤

−=

00

02

exp)( 2

2

2

r

rrrrp σσ (46)

where the variance σ2 is

[ ]2

22 rE=σ (47)

When we plot this pdf for σ=1, we obtain the following plot of the distribution

Page 18: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50

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:

<≤=

otherwise0

201)( θ

θθp (48)

Clarke’s Rayleigh Fading Channel Simulator

Clarke’s 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 fm given by (Equation of Doppler shift here), the spectral shape developed by

Gans [3] is

( )

−−

=

m

cm

E

ffff

fSz

1

5.1

π

(49)

The graph of this function is as follows while fc is equal to 2100MHz and for a vehicle with

60km/h.

The block diagram of the simulator is as follows:

Page 19: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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-Müller method [7]. In this method, the two complex Gaussian random

variables X and Y can be calculated by the following equations:

( )21 ln2)2cos( UUX −= π (50)

( )21 ln2)2sin( UUY −= π (51)

where U1 and U2 are two independent uniformly distributed between 0 and 1.

As a second step, the line spectrum is multiplied with the Doppler spectrum ( )fSzE . 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):

Page 20: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

( ) ( )1:011:0 −×=−×= NR

NTtc

C (52)

where Tc is chip period and Rc is the chip rate as defined in the notation section of this report.

As Rc 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, fc 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

10Signal Envelope vs Time / v = 60km/h

t(s)

Sig

nal E

nvel

ope

(dB

)

Figure

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

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

Page 21: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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/hfor t < Tcoh

t(s)

Sig

nal E

nvel

ope

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:

Page 22: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

2Signal Envelope vs Time / v = 5km/h

t (s)

Sig

nal E

nvel

ope

(dB

)

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 Tc 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.

Page 23: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

In the channel model of [1-11-12], the impulse response of multipath channel fading channel

for each user is described as

( )∑=

−=dL

qqq tpth

1)( τα (53)

where Ld is the number of multipath, which is a random integer between 1 and 10, αq is the

complex gain of the qth path, τq is the delay of the qth path, which is randomly distributed, and

p(t) is the pulse function, which is raised-cosine pulse with the definition of [10]

×= 2241cos)(sinc)(

tttp

βπβ (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 Tc. Therefore, we

filter the input spreaded signal x in the blocks of Tc. As we have mentioned in the previous

section, we pre-compute Rayleigh coefficients in the blocks of 620000. For each multipath

component of each Tc block of each user’s input spreaded differential coded signal; the

following channel algorithm is applied:

We first create the FIR filter hq[n] of the order of Lh (n=0,1,2,…,Lh-1)

( ) )( qq npnh τ−= (55)

In the second step, we filter the corresponding Tc chips of the input signal, such that we obtain

)(*)()()( nhlsls qjq

j = (56)

where sj(l) is the lth Tc component of the input signal and sj

(q)(l) is the raised-cosine shaped lth

component of the qth path. hq(n) is the impulse response of qth path. Finally, we multiply

sj(q)(l) by Tc complex Rayleigh distributed coefficients (αj

(q)(l)) obtained from Clarke’s model

discussed above where l represent again lth Tc block of the output of the Rayleigh simulator.

Then the qth multipath component of the signal xj(q)(l) becomes

)().()( )()()( llslx qj

qj

qj α×= (57)

Then, summing all multipath components obtained by applying the same steps, we obtain the

lth Tc component of jth user’s received signal xj such that

Page 24: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

)()(1

)( lxlxdL

q

qjj ∑

=

= (58)

After doing the same steps for all lth Tc component to J user, we obtain the whole lth block of

the received signal such that

)()(1

lxlxJ

jj∑

=

= (59)

SIMULATION STEPS

In the simulations, the following steps are followed for each iteration. 1) Pre-compute L1, L2, and Lw according to (Equation 43) with the inputs of number of

users and Lc.

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 user’s 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 h1(0)(0).

12) Compute detector w1(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.

Page 25: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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:

Page 26: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

0 500 1000 1500 2000 2500 300010-6

10-5

10-4

10-3

10-2

10-1

100BER vs Detection Window

Detection Window (bits)

BE

R

v=4km/h

v=50km/h

v=100km/h

Figure. SNR=10dB, NF=0dB, J=10, Lc=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 user’s 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 user’s 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

Page 27: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

0 500 1000 1500 2000 2500 30000

2

4

6

8

10

12

14Normalized Processing Delay vs Number of Symbols

Number of Symbols

Nor

mal

ized

Pro

cess

ing

Del

ay

Figure. Figure. v=50km/h, NF=0dB, SNR=10dB, J=10, Lc=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:

Page 28: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

0 2 4 6 8 10 12 14 16 18 2010-4

10-3

10-2

10-1BER vs SNR

SNR (dB)

BE

R

v=4km/h

v=50km/h

v=100km/h

Figure. Window size = 1000, NF=0dB, J=10, Lc=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 user’s signal acts as interference on the

desired user’s 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 mobile’s 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:

Page 29: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

2 3 4 5 6 7 8 9 1010-4

10-3

10-2BER vs # of Active Users

# of Active Users

BE

R

v=4km/h

v=50km/h

v=100km/h

Figure. Window size = 1000, NF=0dB, SNR=10dB, Lc=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

Page 30: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 1100

101

102

103Normalized Computational Complexity vs Normalized # of Active Users

Normalized # of Active Users

Nor

mal

ized

Com

puta

tiona

l Com

plex

ity (f

lops

)

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 Lc. 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

Lw. As the number of users increase, the denominator of (Equation 43) decreases (goes to

zero when J = Lc), which causes Lw to increase exponentially and blow up to infinity at the

limiting case. According to this equation,

JLJLL

c

cw −

−+≥

22 (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.

Page 31: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 user’s 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 Lc equal to 31. The below graph is the result of the simulation:

0 2 4 6 8 10 12 14 16 18 2010-4

10-3

10-2

10-1

100BER vs Near-Far Ratio (NF)

NF (dB)

BE

R

v = 4 km/h 20 km/h 30 km/h 50 km/h 100km/h

Figure. Window size = 1000, J=10, SNR=10dB, Lc=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,

Page 32: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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 USER’S 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 Lc equal to 31.The following figure shows the

simulation results:

0 50 100 15010-4

10-3

10-2BER vs Velocity

velocity (km/h)

BE

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.

Page 33: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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.

Page 34: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

[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, , Boğaziçi 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.

Page 35: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

Page 36: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

Page 37: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

%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);

Page 38: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

%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;

Page 39: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

Page 40: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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

Page 41: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

%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

Page 42: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

%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);

Page 43: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

% [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);

Page 44: Simulation of a CDMA Systems Using Linear Prediction and MUD(Matlab)

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);