ds-cdma simulation

Upload: gowtham-sivakumar

Post on 25-Feb-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 DS-CDMA simulation

    1/23

    U N I V E R S I T Y O F I L L I N O I S

    C H I C A G O

    A D V A N C E D D I G I T A L

    C O M M U N I C A T I O N

    P r o j e c t R e p o r t :

    D S - C D M A

    G O W T H A M S I V A K U M A R

    U I N : 6 7 4 4 2 2 9 7 9

  • 7/25/2019 DS-CDMA simulation

    2/23

    CDMAIntroduction:

    Fig.Different channel access methods

    Code Division Multiple Access (CDMA) is a multiple access technique where different users

    share the same physical medium that is the same frequency band at the same time. The main

    ingredient of CDMA is the spread spectrum technique which uses high rate signature pulses to

    enhance the signal bandwidth far beyond what is necessary for a given data rate. The users of thesystem are identified at the base station by their unique spreading code. The signal that is

    transmitted by any user consists of the users data that modulates its spreading code, which in turnmodulates a carrier. An example of a modulation scheme is quadrature phase shift keying (QPSK).

    CDMA employs multiplexing, i.e, allowing several transmitters to send information

    simultaneously in a single communication channel. This is achieved by using spread spectrum

    technology and a special coding scheme where each transmitter is assigned acode to allow multiple

    users to be multiplexed over the physical channel.

    In contrast, TDMA which divides access by time while FDMA divides access by frequency.

    CDMA is a form of spread spectrum signalling, since the code modulated signal has higher

    bandwidth than the data being transmitted.

    The performance of CDMA is based on XOR-logic when considering that it is transmitting {0,1}.

    Each user in CDMA system uses a different code or group of codes to modulate their signal ( one

    code if data and pilot are transmitted in the same frequency or 2 if it is done differently). We can use

    one code for data channel and another for the pilot channel. A key point for performance is the

    choice of codes to modulate the signal from the CDMA system. Two of the best known CDMA coding

    techniques are Hadamard-Walsh and Gold. The best performance is obtained when there is a good

    seperation between the signals of the desired user and signals from other users. This is called as

    Multiple Access Interference (MAI).

    The seperation of signals is performed by correlating the received signal with the local source

    code of the desired user. If the signal matches the desired user code, then the correlation function

    will be high and the system can extract the signal. If desired by the user, the code can have nothingin common with the correlation signal and thus having a correlation value close to 0. This is known

    as auto-correlation and is used to reject multipath interference.

  • 7/25/2019 DS-CDMA simulation

    3/23

    The performance of CDMA is based on XOR-logic when considering that it is transmitting {0,1}.

    Each user in CDMA system uses a different code or group of codes to modulate their signal ( one

    code if data and pilot are transmitted in the same frequency or 2 if it is done differently). We can use

    one code for data channel and another for the pilot channel. A key point for performance is the

    choice of codes to modulate the signal from the CDMA system. The best performance is obtained

    when there is a good separation between the signals of the desired user and signals from other

    users. This is called as Multiple Access Interference (MAI).

    Correlation of the received signals with the local source code of the desired user results in the

    separation of the signals. The correlation function will be high and the system can extract the signal

    if the signal matches the desired user code. If desired by the user, the code can have nothing in

    common with the correlation signal and thus having a correlation value close to 0. This is known as

    auto-correlation and is used to reject multipath interference. In the DS-CDMA system, the

    narrowband message signal is multiplied by a large bandwidth signal, which is called the

    spreading of a signal. The spreading signal is generated by convolving a GOLD sequence code with

    a chip waveform whose duration is much smaller than the symbol duration. All users in the system

    use the same carrier frequency and may transmit simultaneously. The receiver performs a

    correlation operation to detect the message addressed to a given user and the signals from other

    users appear as noise due to de-correlation.Direct-sequence code-division multiple access (DS-CDMA) is currently the subject of much

    research as it is a promising multiple access capability for third and fourth generations mobile

    communication systems. The synchronous DS-CDMA system is presented for eliminating the effects

    of multiple access interference (MAI) which limits the capacity and degrades the BER performance

    of the system. MAI refers to the interference between different direct sequences users. With

    increasing the number of users, the MAI grows to be significant and the DS-CDMA system will be

    interference limited. The spreading sequences in a DS-CDMA system need to have good cross-

    correlation characteristics as well as good autocorrelation characteristics. The goal is to reduce the

    fading effect by supplying the receiver with several replicas of the same information signal

    transmitted over independently fading paths.

    Categories:In general, CDMA belongs to two basic categories:

    Synchronous CDMA

    Asynchronous CDMA

    SCDMA exploits mathematical properties of orthogonality of vectors representing the data-

    streams (say, binary streams 1 0 0 0 represents vector [1 0 0 0]. These vectors can be multiplied by

    scalar product, the sum of products of their components. If their scalar product is 0, the 2 vectors are

    said to be orthogonal to each other.

    SCDMA uses a code orthogonal to other codes to modulate their signal. To set an example, wecan use 4 orthogonal digital signals. Orthogonal codes have 0 cross-correlation, meaning they do

    not interfere with each other.

    rab= rba= a.b = 0

    a.(a+b) = a.a + a.b = ||a||2 + 0

    a.(-a+b) = -a.a + a.b = -||a||2 + 0

    b.(a+b) = b.a + b.b = ||b||2 + 0

    In the example, the orthogonal Walsh sequences describes a way in which two users can be

    multiplexed in a synchronous system, a technique known as code division multiplexing. An N x NWalsh matrix can be used to multiplex N users. When multiplexing is necessary all the users are

    coordinated so that each transmitter transmits with a delay of the channel to reach the reciever at

  • 7/25/2019 DS-CDMA simulation

    4/23

    exactly the same time. Thus, the technique is used in links to mobile base, where all transmissions

    originates from the same transmitter and can be coordinated.

    ACDMA links are used when mobile to base communications cannot be coordinated with

    proper precision, mainly due to mobility of terminals. Thus, this has a big implication on the design

    of the system which needs to be orthogonal at all times. Since, this is mathematically impossible to

    design, a pseudo-random code(PN) is used. A PN code is a binary sequence that appears random

    but can be reproduced in a deterministic fashion. PN codes are used to encode and decode the

    signal from asynchronous CDMA users in the same way as orthogonal codes. These PN sequences

    are statistically correlated and the sum of a large number of PN sequences result in MAI which is

    approximated by gaussian noise process if all users have the same power. In other words, unlike

    SCDMA, the signal from other users appear as noise to signal of interest and interfere slightly with

    the desired signal in proportion to the number of users. Since each users generate MAI, controlling

    signal strength is a key issue in CDMA transmitter.

    Advantages:

    1.Efficient use of a fixed bandwidth.The use of DS-CDMA can effectively enhance overall bandwidth efficiency compared with

    traditional multiple access schemes such as FDMA (Frequency Division Multiple Access) and TDMA

    (Time Division Multiple Access). Spectrum is extremely expensive; it has to be purchased from

    various governmental licensing authorities at auction and sometimes those auctions have involved

    billions of US dollars

    2. Flexible allocation of resourcesCDMA can offer a key advantage over flexible allocation of resources, for example PN codes can be

    assigned to each user. In the case of TDMA and FDMA have a number of simultaneous orthogonalcodes fixed slots and fixed frequency bands. This fixed number of time slots or frequency bands are

    underutilized especially in cases of bursts such as when data is packed. In contrast CDMA adapts to

    the number of users because you can add another user and the overall impact will be a decrease on

    SIR decreases, while if there are fewer users SIR increases.

    3.Anti-jamming capability of CDMABecause bandwidth is limited, it is usually common to try minimizing bandwidth. However, the use

    of spread spectrum techniques aims to use more bandwidth while reducing power spectral density.

    One of the initial reasons for doing this was military applications in communications systems. These

    systems were designed using spread spectrum for resistance to interference. The code makes

    CDMA spread spectrum signals appear random, so, these have some properties similar to noise. A

    receiver cannot demodulate this transmission without knowing pseudorandom sequence used to

    encode data.

    4.Resistant to interferenceBoth synchronous and asynchronous CDMA are resistant to interference. So if the interference is

    constant over the spectral width, the effective noise will be the bandwidth of the chip code over the

    noise bandwidth. Furthermore, the CDMA is very effective against narrowband interference sincenoises outside the bandwidth associated with the code chip are not affecting the signal. Another key

    point is that the CDMA is resistant to multipath interference and the delayed versions of the codes

    will have little correlation with the original pseudorandom code, and therefore will appear as

  • 7/25/2019 DS-CDMA simulation

    5/23

    another user, which is ignored in the receiver being used a RAKE receiver. In other words, if

    multiple channel chip cause the least delay, the multipath signals arrive at the receiver so that travel

    time by at least one chip of the predicted signal.

    Applications:

    DS-CDMA modulation has been used for many commercial communication systems (almost all 3Gmobile cellular systems use DS-CDMA as their prime multiple access air-link architecture) and

    measurement instruments. It is reasonable to expect that DS modulation will continue to be a

    familiar form of spreading modulation scheme in the years to come due to its unique and desirable

    features. Characteristic of DS spreading modulation is just exactly that modulation of a carrier by a

    code sequence. The use of DS-CDMA can effectively enhance overall bandwidth efficiency

    compared with traditional multiple access schemes such as FDMA (Frequency Division Multiple

    Access) and TDMA (Time Division Multiple Access). Spectrum is extremely expensive; it has to be

    purchased from various governmental licensing authorities at auction and sometimes those auctions

    have involved billions of US dollars (or equivalent monetary value in other currencies). It represents

    a considerable investment by a service carrier. Therefore, the bandwidth efficiency of a

    communication technology will be a primary concern for any network operator. The right selectionof a suitable multiple access scheme to provide multi-user services is of ultimate importance.

    DSCDMA-based mobile cellular carries more calls than TDMA-based technologies. Generally

    speaking, CDMA will carry between 2 and 3 times as many calls simultaneously as TDMA in the

    same amount of bandwidth. The another major advantage of CDMA is its capability for dynamic

    allocation of bandwidth. To understand this, it is important to realize that in this context in CDMA,

    bandwidth refers to the ability of any user to get data from one end to the other. It does not refer to

    the amount of spectrum used by the user because in CDMA every terminal uses the entire spectrum

    of its carrier whenever it is transmitting or receiving. On the other hand, TDMA works by taking a

    channel with a fixed bandwidth and dividing it into several time slots. Any given mobile terminal is

    then given the ability to use one or more of the slots on an ongoing basis if it is in a call.

    Direct Sequence CDMA:

    CDMA is a Direct Sequence Spread Spectrum system. The CDMA system works directly on 64

    kbit/sec digital signals. These signals can be digitized voice, ISDN channels, modem data, etc.

    Signal transmission consists of the following steps:

    1) A pseudo-random code is generated, different for each channel and each successive connection.

    2) The Information data modulates the pseudo-random code (the Information data is spread).3) The resulting signal modulates a carrier.

    4) The modulated carrier is amplified and broadcast.

    Signal reception consists of the following steps:

    1) The carrier is received and amplified.

    2) The received signal is mixed with a local carrier to recover the spread digital signal.

    3) A pseudo-random code is generated, matching the anticipated signal.

    4) The receiver acquires the received code and phase locks its own code to it.

    5) The received signal is correlated with the generated code, extracting the Information data.

    Code division multiple-access techniques allow many users to simultaneously access a given

    frequency allocation. User separation at the receiver is possible because each user spreads the

    modulated waveform over a wide bandwidth using unique spreading codes. There are two basictypes of CDMA. Direct-sequence CDMA (DS-CDMA) spreads the signal directly by multiplying the

    data waveform with a user-unique high bandwidth pseudo-noise binary sequence. The resulting

    signal is then mixed up to a carrier frequency and transmitted. The receiver mixes down to

  • 7/25/2019 DS-CDMA simulation

    6/23

    baseband and then re-multiplies with the binary { 1} pseudo-noise sequence. This effectively

    (assuming perfect synchronization) removes the pseudo-noise signal and what remains (of the

    desired signal) is just the transmitted data waveform. After removing the pseudo-noise signal, a

    filter with bandwidth proportional to the data rate is applied to the signal. Because other users do

    not use completely orthogonal spreading codes, there is residual multiple-access interference

    present at the filter output.

    In Direct Sequence spread spectrum transmission, the user data signal is multiplied by a code

    sequence. Mostly, binary sequences are used. The duration of an element in the code is called the

    "chip time". The ratio between the user symbol time and the chip time is called the spread factor.

    The transmit signal occupies a bandwidth that equals the spread factor times the bandwidth of the

    user data. In the receiver, the received signal is again multiplied by the same (synchronized) code.

    This operation removes the code, so we recover the transmitted user data.

    A CDMA receiver can retrieve the wanted signal by multiplying the receive signal with the same

    code as the one used during transmission. So

    Where c1 is the code sequence used by user 1, Tc is the chip duration, td is a common time offset,

    shared between transmitter and receiver and N is the length of the code sequence. Note that the

    receive code must be perfectly time aligned with the transmit code.

    The DS-CDMA system:In Code Division Multiple Access (CDMA) systems all users transmit in the same bandwidth

    simultaneously. Communication systems following this concept are "spread spectrum systems''. In

    this transmission technique, the frequency spectrum of a data-signal is spread using a code

    uncorrelated with that signal. As a result the bandwidth occupancy is much higher than required.

    The codes used for spreading have low cross-correlation values and are unique to every user. This

    is the reason that a receiver which has knowledge about the code of the intended transmitter iscapable of selecting the desired signal. Direct sequence signals are generated by their modulating

    a carrier with a code sequence; In a DS-CDMA communication system the incoming information

    signal is digitized if it is not in a digital format, and modulo-2 added to a higher speed code

  • 7/25/2019 DS-CDMA simulation

    7/23

    sequence. The combined information and code then are used to modulate on RF carrier using bpsk

    modulation technique. Since high speed code sequence dominates the modulating function, it

    determines the RF signal bandwidth and gives rise to the spread spectrum signal.

    Modulation and Demodulation

    Modulation:In digital modulation, an analog carrier signal is modulated by a discrete signal. Digital modulation

    methods can be considered as digital-to-analog conversion, and the corresponding demodulation

    or detection as analog-to-digital conversion. The changes in the carrier signal are chosen from a

    finite number of M alternative symbols (the modulation alphabet).

    If the alphabet consists of M = 2nalternative symbols, each symbol represents a message consisting

    of N bits. If the baud rate is fs symbols/second, then the data rate is N fs bit/second. In the case of

    PSK, ASK or QAM, where the carrier frequency of the modulated signal is constant, the modulation

    alphabet is often conveniently represented on a constellation diagram, showing the amplitude of the

    I signal at the x-axis, and the amplitude of the Q signal at the y-axis, for each symbol.

    Fig: QPSK Modulator

    Phase Shift Keying (PSK):This scheme is based on controlling the phase of the symbols generated. There are two types of

    deployment with the differential phase or the phase itself. In PSK symbols are chosen in a uniform

    angular distribution spread over a circle. This provides maximum phase separation and gives the

    best immunity to corruption of the signal. Each symbol is associated with a given energy can be

    fixed. Two typical cases are using two-phase BPSK and QPSK uses four phases

    Fig: Constellation for QPSK

  • 7/25/2019 DS-CDMA simulation

    8/23

    Demodulation:Demodulation is the act of extracting the original information-bearing signal from a modulated

    carrier wave. A demodulator is an electronic circuit that is used to recover the information content

    from the modulated carrier wave. A QPSK signal is generated by two BPSK signals. QPSK uses four

    points on the diagram, equispaced around a circle. With four phases, QPSK can encode two bits per

    symbol shown in the diagram with gray coding to minimize the BER. Then the symbol is changed to

    next symbol then the phase of the carrier is changed by 45 . To distinguish the two signals, we usetwo orthogonal carrier signals. One is given by cos(2fct) and the other is given by sin(2fct). Achannel in which cos(2fct) is used as a carrier signal is generally called an in-phase channel, or Ichand a channel in which sin(2fct) is used as a carrier signal is generally called a quadrature-phasechannel, or Qch. Therefore, dI(t) and dq(t) are the data in Ichand Qch, respectively. Modulation

    schemes that use Ichand Qchare called quadrature modulation schemes. The first basis function is

    used as the in-phase component of the signal and the second as the quadrature component of the

    signal.

    The mathematical analysis:

    Sn

    (t)=(2 s/T)cos(2

    fct+(2n-1)

    /4)for n=1,2,3,4,

    This yields the four phases /4,3/4,5/4 and 7/4 as needed. This results in a two-dimensionalsignal space with unit basis functions. The in-phase and quadrature components of the signal are

    given by,

    1(t)=(2/Ts)cos(2fct)

    2(t)=(2/Ts)sin(2fct)

    The binary data stream is split into the in separately modulated onto two orthogonal basis functions.

    In this implementation, two sinusoids are used. Afterwards, the two signals are superimposed, and

    the resulting signal is the QPSK signal. Note the use of polar non-return-to-zero encoding. Theseencoders can be placed before for binary data source, but have been placed after to illustrate the

    conceptual difference between digital and analog signals involved with digital modulation. In the

    receiver structure for QPSK replaced with correlators. Each detection device uses a reference

    threshold value to determine whether a 1 or 0 is detected.

    Fig: QPSK Demodulator

  • 7/25/2019 DS-CDMA simulation

    9/23

    Communication Channel:Rayleigh Fading Channel :Rayleigh fading is a statistical model for the effect of a propagation environment on a radio signal,

    such as that used by wireless devices. The magnitude of a signal that has passed through such a

    transmission medium will vary randomly according to a Rayleigh distribution the radial component

    of the sum of two uncorrelated Gaussian random variables. Rayleigh fading is viewed as a

    reasonable model for tropospheric and ionospheric signal propagation as well as the effect ofheavily built-up urban environments on radio signals. When there is no dominant propagation along

    a line of sight between the transmitter and receiver, Rayleigh fading is the most applicable.

    Rayleigh fading is a reasonable model when there are many objects in the environment that scatter

    the radio signal before it arrives at the receiver, if there is sufficiently much scatter, the channel

    impulse response will be well modelled as a Gaussian process irrespective of the distribution of the

    individual components. If there is no dominant component to the scatter, then such a process will

    have zero mean and phase evenly distributed between 0 and 2 radians. The envelope of thechannel response will therefore be Rayleigh distributed.

    AWGN channel :Additive White Gaussian Noise channel model as the name indicate Gaussian noise get directly

    added with the signal and information signal get converted into the noise in this model scattering

    and fading of the information is not considered. Additive white Gaussian noise (AWGN) is a channel

    model in which the only impairment to communication is a linear addition of wide band or white

    noise with a constant spectral density (expressed as watts per hertz of bandwidth) and a Gaussian

    distribution of amplitude.

    The model does not account for fading frequency selectivity, interference, nonlinearity or

    dispersion. However, it produces simple and tractable mathematical models which are useful for

    gaining insight into the underlying behavior of a system before these other phenomena are

    considered. Wideband Gaussian noise comes from many natural sources, such as the thermal

    vibrations of atoms in conductors (referred to as thermal noise or Johnson-Nyquist noise), shot

    noise, black body radiation from the earth and other warm objects, and from celestial sources such

    as the Sun.

    The AWGN channel is a good model for many satellite and deep space communication links. It is not

    a good model for most terrestrial links because of multipath, terrain blocking, interference, etc.

    However, for terrestrial path modeling, AWGN is commonly used to simulate background noise of

    the channel under study, in addition to multipath, terrain blocking, interference, ground clutter and

    self interference that modern radio systems encounter in terrestrial operation.

    Coding Formulation:Pseudo-Random Sequences

    A pseudorandom ( PN) sequence is a code sequence of 1s and 0s whose autocorrelation hasproperties similar to those of white noise. Some of the popular PN sequences are Maximal length

    shift register sequences (m-sequences), gold sequences etc. Here we discuss about Gold

    Sequence.

  • 7/25/2019 DS-CDMA simulation

    10/23

    Fig: PN sequence generator

    Gold Sequences

    A Gold code, also known as gold sequence, is a type of binary sequence, used in telecommunication (CDMA) and

    satellite navigation (GPS). Gold codes are named after Robert Gold. Gold codes have bounded small cross-

    correlations within a set, which is useful when multiple devices are broadcasting in the same frequency range. A

    set of Gold code sequences consists of 2n

    -1sequences each one with a period of 2n

    -1. A set of Gold codes can begenerated with the following steps. Pick two maximum length sequences of the same length 2n1 such that their

    absolute cross-correlation is less than or equal to 2(n+2)/2 ,where n is the size of the LFSR used to generate the

    maximum length sequence. The set of the 2n-1 exclusive-ors of the two sequences in their various phases (i.e.

    translated into all relative positions) is a set of Gold codes. The highest absolute cross-correlation in this set of

    codes is 2(n+2)/2+1 for even n and 2(n+1)/2+1 for odd n. The exclusive or of two Gold codes from the same set is

    another Gold code in some phase. Within a set of Gold codes about half of the codes are balanced the number of

    ones and zeroes differs by only one.

    Gold sequences have been proposed by Gold in 1967 and 1968. These are constructed by EXOR-ing two m-

    sequences of the same length with each other. Thus, for a Gold sequence of length m = 2 1-1, one uses two LFSR,

    each of length 21-1. If the LSFRs are chosen appropriately, Gold sequences have better cross-correlation properties

    than maximum length LSFR sequences. The Gold Sequence Generator block uses two PN Sequence Generatorblocks to generate the preferred pair of sequences, and then XORs these sequences to produce the output sequence.

    Fig: Gold sequence generator

    Gold (and Kasami) showed that for certain well-chosen m-sequences, the cross correlation only

    takes on three possible values, namely -1, -t or t-2. Two such sequences are called preferred

    sequences. Here t depends solely (only) on the length of the LFSR used. In fact, for a LFSR with l

    memory element.

    if l is odd, t = 2(l+1)/2 + 1, and

    if l is even, t = 2(l+2)/2 + 1

    Here t is the cross correlation.

  • 7/25/2019 DS-CDMA simulation

    11/23

    The randomly generated data in system can be transmitted with the help of proposed transmitter

    model. At first, the data generator generates the data randomly, that generated data is mapping

    circuit. Mapping circuit which is consisting of QPSK modulator converts this serially random data

    into two parallel data streams even and odd samples. This individually by using Gold sequence

    codes. The spread data is given to the over sampler circuit which converts unipolar data into

    bipolar one, then this oversampled data is convolved using with help of filter coefficients of T filter.

    Then these two individual data streams summed up and passed through Band pass filter (BPF) which

    is then transmitted to channel.

    TRANSMITTER

    The system consists of three well defined parts: transmitter, channel and receiver. Following there is going to

    be analyzed in detail all elements of the transmitter, from a description supported by the help of a diagram of

    the elements to a detailed analysis of each of elements. The first step is to generate a series of bits with a bit

    generator which simulates the information transmitted by the user.

    []{0,1}

    These series of bits are passed through an encoder that adds some redundancy to protect against inter-

    symbolic interference and channel noise.

    c[]=([])

    Then the encoded bits are passed through a modulator BPSK, QPSK or 16-QAM to obtain a sequence of

    symbols. Following it is supposed that a BPSK modulation is used.

    c[]=(c[])

    These symbols are repeated and multiplied by the chip associated with each user.

    At the same time this process is done, a parallel process is done to obtain the pilot symbols using different

    chip sequence.

    These two widened sequences are added.

    Once the symbols to transmit have been proceeded Nc zeros are added between the symbols, having the

    following expression:

    _Here are convolution is carried by a pulse in order to change the chip pulse shape.

  • 7/25/2019 DS-CDMA simulation

    12/23

    Where the pulse has a form (SRRC)

    The frequency signal is upped in order to use the assigned broadband while protecting the signal in front of

    low frequency noise.

    The following steps are in case that an analog system should be implemented. Then, it would be need to

    convert the digital signal to analog as detailed in Figure 9: "Standard structure for D/A conversion".

    Fig: DS-CDMA Transmitter

    RECEIVER:

    The next step is the reception at the receiver. A reciprocal process to the transmitter is perfume in

    order to recover the transmitted signals for each user. The received signal shifts the signal followed

    by a low pass filter to remove noise outside the band. The baseband signal is filtered by the

    matched filter receiver, powered by a synchronizer that provides the ideal moment to recover the

    signal. The last step is to recover the signal consists of a decimator to symbol frequency, followed

    by an estimate of the channel, passed through a detector and demodulator.

    The first step is to pass the received signal to baseband, where n[] is a complex signal.

  • 7/25/2019 DS-CDMA simulation

    13/23

    A signal is then filtered to eliminate interference and noise that are outside the signal band, hence

    minimizing noise.

    Thus, the received signal is the sum of all users plus noise band associated with each user.

    Where each user component breaks down the symbols that have been passed that have zeros

    between the displaced pulses.

    The signal is convolved with the reflected pulse in order to recover, thus obtaining.

    A key step is obtaining a good synchronization to correlate with a signal pattern. Then, a down-

    sampler is done obtaining the coefficients chip with its associated value:

    So, the values associated with each user are pilot sequence and information () by a factor

    il marked by the channel, plus an associated noise.

    This expression can be represented by a formulation as follows:

  • 7/25/2019 DS-CDMA simulation

    14/23

  • 7/25/2019 DS-CDMA simulation

    15/23

    OUTPUT

    M Sequence with RayLeigh Fading

  • 7/25/2019 DS-CDMA simulation

    16/23

    M Sequence without Rayleigh Fading

  • 7/25/2019 DS-CDMA simulation

    17/23

  • 7/25/2019 DS-CDMA simulation

    18/23

    Gold Spreading Code with Rayleigh Fading :

  • 7/25/2019 DS-CDMA simulation

    19/23

    Gold Spreading Code without Rayleigh Fading:

  • 7/25/2019 DS-CDMA simulation

    20/23

    Base Code :

    %**************************** Parameters*****************************

    sr = input('Input Symbol rate: '); %symbol rateml = input('No. of modulation levels: '); %number of modulation levelsbr = sr * ml; %bit ratend = input('Input no. of symbols: '); %number of symbol

    ebn0 = input('Enter Eb/No value: '); %Eb/No

    %********************** Spreading code **********************

    user = input('number of users: ');seq = input('Choose Spreading code - 1.:M-sequence 2:Gold ');stage = 3; %number of stagesregval1 = [1 1 1]; %initial value of register for 1stregval2 = [1 1 1]; %initial value of register for 2nd

  • 7/25/2019 DS-CDMA simulation

    21/23

    %******************** Generation of the spreading code*************

    switchseqcase1 %M-sequence

    code = mseq(stage,ptap1,regval1,user);case2 %Gold sequence

    m1 = mseq(stage,ptap1,regval2);m2 = mseq(stage,ptap2,regval2);

    code = goldseq(m1,m2,user);endcode = code * 2 - 1;clen = length(code);

    %************************** Fading cases**************************

    rfade = input('Rayleigh fading 0:no 1:yes');itau = [0,8]; %delay timedlvl1 = [0.0,40.0]; %attenuation leveln0 = [6,7]; %number of waves to generate fadingth1 = [0.0,0.0]; %initial Phase of delayed waveitnd1 = [3001,4004]; %set fading counternow1 = 2; %number of directwave + delayed wavetstp = 1 / sr / IPOINT / clen; %time resolutionfd = 160; %doppler frequency [Hz]flat = 1; %flat Rayleigh environmentitndel = nd * IPOINT * clen * 30; %number of fading counter to skip

    %**************************** Mathematical formulation**************

    nloop = input('Enter no. of iterations'); %simulation number of times

    forno=1:10,ebn0=no;

    noe = 0;nod = 0;

    forii=1:nloop

    %****************************** Transmitter********************************data = rand(user,nd*ml) > 0.5;

    [ich, qch] = qpskmod(data,user,nd,ml); %QPSK modulation[ich1,qch1] = spread(ich,qch,code); %spreading[ich2,qch2] = compoversamp2(ich1,qch1,IPOINT); %over sampling[ich3,qch3] = compconv2(ich2,qch2,xh); %filter

    ifuser == 1 %transmissionich4 = ich3;qch4 = qch3;

    elseich4 = sum(ich3);qch4 = sum(qch3);

    end

    %***************************** Fading channel******************************

    ifrfade == 0

    ich5 = ich4;qch5 = qch4;

    else[ich5,qch5] = sefade(ich4,qch4,itau,dlvl1,th1,n0,itnd1, ...%fading channel

    now1,length(ich4),tstp,fd,flat);

  • 7/25/2019 DS-CDMA simulation

    22/23

    itnd1 = itnd1 + itndel;end

    %******************************** Receiver*********************************

    spow = sum(rot90(ich3.^2 + qch3.^2)) / nd; %attenuation Calculationattn = sqrt(0.5 * spow * sr / br * 10^(-ebn0/10));

    [ich6,qch6] = comb2(ich5,qch5,attn); %Add White Gaussian Noise (AWGN)[ich7,qch7] = compconv2(ich6,qch6,xh2); %filter

    sampl = irfn * IPOINT + 1;ich8 = ich7(:,sampl:IPOINT:IPOINT*nd*clen+sampl-1);qch8 = qch7(:,sampl:IPOINT:IPOINT*nd*clen+sampl-1);

    [ich9 qch9] = despread(ich8,qch8,code); %despreading

    demodata = qpskdemod(ich9,qch9,user,nd,ml); %QPSK demodulation

    %************************** Bit Error Rate (BER)***************************

    noe2 = sum(sum(abs(data-demodata)));nod2 = user * nd * ml;noe = noe + noe2;nod = nod + nod2;ber = noe / nod;beri(no)=ber;

    end

    %bitratefprintf('bitrate is %d',br);

    %transmissionfigure(2),plot(ich4),grid;xlabel('Time');ylabel('Amplitude');title('Transmission In-phase component');

    figure(3),plot(qch4),grid;xlabel('Time');ylabel('Amplitude');title('Transmission Quadrature component');

    %received signalfigure(4),plot(ich7),grid;xlabel('Time');ylabel('Amplitude');title('Received In-phase component');

    figure(5),plot(qch7),grid;xlabel('Time');ylabel('Amplitude');title('Received Quadrature component');

    %Data i/p & o/pfigure(7),plot(data),grid;xlabel('Time');ylabel('Amplitude');title('Data transmitted');figure(8),plot(demodata),grid;xlabel('Time');ylabel('Amplitude');title('Data received');

    figure(9);semilogy(beri,'*');hold on

    fori=1:10,tmp=10^(i/10);tmp=sqrt(tmp);ber(i)=0.5*erfc(tmp);

    end

  • 7/25/2019 DS-CDMA simulation

    23/23

    semilogy(ber),grid;xlabel('Eb/No[dB]');ylabel('BER');title('BER vs SNR for DS-CDMA');