FWSC UNIT-5 SYNCHRONIZATION OF DIRECT SEQUENCE SPREAD SPECTRUM SIGNALS.pdf
1. UNIVERSITY OF NAIROBI
TITLE:
SYNCHRONIZATION OF DIRECT SEQUENCE SPREAD
SPECTRUM SIGNALS
Project Index: 086
Project Report By:
ONAYA OYOO JOSEPH
F17/2050/2004
Supervisor:
DR. V. K ODUOL
Examiner:
DR G.S.O ODHIAMBO.
A project presented in partial fulfillment of the requirement for the
award of the degree of
BACHELOR OF SCIENCE
In
ELECTRICAL & ELECTRONIC ENGINEERING
Submission Date 20th
June 2008
3. iii
ACKNOWLEDGEMENT
Throughout this project period I have leaned a lot in this area of telecommunications and
have appreciated the spirit of consultation from classmates and friends who have offered me
assistance and support.
My special appreciation goes to my project supervisor Dr. V .K Oduol for his support and
guidance throughout this period.
Great thanks, goes to my family members who have supported and encourage me throughout
my time in campus.
Special appreciation goes to my friends Julian, Ibrahim, and Moses for their encouragement
and support as I worked on this project. A special thanks goes to my girlfriend Arnoda for her
love and encouragement throughout this project. I recognize my classmates for their
encouragement and criticism on various areas as I worked on this project.
Finally I give thanks to the Almighty God for the strength and wisdom to remain focused
throughout my life and in the completion of this project.
4. iv
ABSTRACT
This write up starts by giving a brief introduction to spread spectrum communication systems
in general. It describes how in spread spectrum systems, the signal to be transmitted is spread
over a large bandwidth by use of a pseudo noise code generated by a P.N code generator at
the transmitter. At the receiver, the signal is despread using a synchronized replica of the
pseudo noise code. The signal is acquired at the receiver, using coarse acquisition and
tracking.
The second chapter goes on to describe direct sequence spread spectrum signals in detail
giving a brief description on pseudonoise sequences their properties and types.
The third chapter emphasizes code synchronization where acquisition of spreading sequences
using matched filter and serial search acquisition is described. It goes further to describe
tracking of the direct sequence spread spectrum signals using delay locked loop and Tau-
Dither loop.
The design of an acquisition system has been implemented using a matlab code given in the
appendix and a multiuser environment has been implemented to show how spread spectrum
signals can reject uncorrelated signals. Analysis of the results is carried out and conclusion
has been drawn. MATLAB results are shown in the various graphs.
5. v
TABLE OF CONTENTS
1 Introduction………………………………………………………………………………….1
2 Direct Sequence Spread Spectrum Signals………………………………………………….2
2.1 Pseudonoise sequences…………………………………………………………………8
2.2 Randomness properties………………………………………………………………...8
2.3 Types of PN sequences………………………………………………………………...9
3 Code synchronization………………………………………………………………………13
3.1 Acquisition of spreading sequences………………………………………………......13
3.2 Matched filter acquisition……………………………………………………………..15
3.3 Serial search acquisition………………………………………………………………17
3.4 Code tracking………………………………………………………………………....20
4 Design of code acquisition and tracking……………………………………………….......28
4.1 Design………………………………………………………………………………....28
4.2 Results………………………………………………………………………………...33
4.3 Analysis……………………………………………………………………………….37
4.4Future work……………………………………………………………………………37
4.5 Conclusion……………………………………………………………………………
6. vi
LIST OF FIGURES
1.1 Model of spread spectrum digital communication system………………………………...2
2.1 Examples of (a) data modulation and (b) spreading waveform…………………………...4
2.2 Functional block diagram of direct-sequence system with PSK or DPSK
(a)transmitter and (b) receiver………………………………………………………………6
2.3 Spectra of desired signal and interference: (a) wideband-filter output and
(b) demodulator input………………………………………………………………………7
2.4 Autocorrelation of maximal sequence and random binary sequence…………………..….9
2.5 General feedback shift register with m stages……………………………………………10
2.6 (a) Three-stage linear feedback shift register and (b) contents after successive shifts…..11
3.1 Digital matched filter……………………………………………………………………..15
3.2 Configuration of a serial-search acquisition system enabled by a matched filter………..16
3.3: Serial-search acquisition system…………………………………………………………………….17
3.4 Flow graph of multiple-dwell system with consecutive-count strategy………………….19
3.5 Flow graph of multiple-dwell system with up-down strategy……………………………19
3.6 Trajectories of search positions: (a) uniform search and (b) broken-center Z search……20
3.7 Delay-locked loop………………………………………………………………………..21
3.8 Discriminator characteristic of delay-locked loop for = 1 2
⁄ …………………………24
3.9Tau-dither loop……………………………………………………………………………26
4.1 Generic acquisition block diagram……………………………………………………….28
4.2 Delay locked loop for tracking of direct sequence signals……………………………….29
7. 1
CHAPTER 1
INTRODUCTION
A spread spectrum modulation scheme is any digital modulation technique that utilizes a
transmission bandwidth much greater than the modulating signal bandwidth, independently
of the bandwidth of the modulating signal.
There are several reasons why it might be desirable to employ a spread spectrum modulation
scheme. Among these are to provide resistance to unintentional interference and multipath
transmissions, to provide resistance to intentional interference (also known as jamming) [1],
to provide a signal with sufficiently low spectral level so that it is masked by the background
noise (i.e., to provide low probability of detection), and to provide a means for measuring
range between transmitter and receiver.
Spread spectrum systems were historically applied to military applications and still are. Much
of the literature on military applications of spread spectrum communications is classified. A
notable application of spread spectrum to civilian uses was to cellular radio in the 1990s with
the publication of interim standard IS-95 by the US Telecommunications Industry
Association (TIA) [2]. Another more recent application of spread spectrum to civilian uses is
to wireless local area networks (LANs), with standard IEEE 802.11 published under the
auspices of the Institute of Electrical and Electronics Engineers (IEEE) [3]. The original
legacy standard, released in July 1997, includes spread spectrum modem specifications for
operation at data rates of 1 and 2 Mbps, and the 802.11b standard, released in Oct. 1999, has
a maximum raw data rate of 11 Mbps with both operating in the 2.4 GHz band. Specifications
802.11a and 802.11g, released in Oct. 1999 and June 2003, respectively, use another
modulation scheme known as orthogonal frequency division multiplexing, with the former
operating in the 5 GHz band and the latter operating in the 2.4 GHz band.
Spread spectrum communication can be utilized using the following techniques;
Direct sequence spread spectrum (DS-SS)
A random or pseudo random code is used to spread the baseband signal. This will cause fast
phase transitions in the carrier frequency that contains the data.
Frequency hopping spread spectrum (FH-SS)
8. 2
A random or a pseudo random code is used to shift the carrier frequency in a random manner.
This ends up modulating different portions of the data signal with different carrier
frequencies.
Hybrid system (DS/FH)
This is a combination of the two; DS and FH techniques. Where one data bit is divided over
frequency hop channels, and one complete PN code of length N is multiplied with the data
signal.
Figure 1.1 Model of spread spectrum digital communication system
Modulator
Pseudorandom pattern
generator
Channel Demodulator Channel
Decoder
Pseudorandom pattern
generator
Pseudoran
dom
pattern
9. 3
CHAPTER 2
DIRECT SEQUENCE SPREAD SPECTRUM SIGNALS
A spread-spectrum signal is a signal that has an extra modulation that expands the signal
bandwidth beyond what is required by the underlying data modulation. Spread-spectrum
communication systems are useful for suppressing interference, making interception difficult,
accommodating fading and multipath channels, and providing a multiple-access capability.
The
most practical and dominant methods of spread-spectrum communications are direct-
sequence modulation and frequency hopping of digital communications.
At first it might seem that a spread-spectrum signal is counterproductive insofar as the
receive filter will require an increased bandwidth and, hence, will pass more noise power to
the demodulator. However, when any signal and white Gaussian noise are applied to a filter
matched to the signal, the sampled filter output has a signal-to-noise ratio (SNR) that is
inversely proportional to the noise-power spectral density [1]. The remarkable aspect of this
result is that the filter bandwidth and, hence, the output noise power are irrelevant. Thus, we
observe that there is no fundamental barrier to the use of spread-spectrum communications.
A direct-sequence signal is a spread-spectrum signal generated by the direct mixing of the
data with a spreading waveform before the final carrier modulation. Ideally, a direct-sequence
signal with binary phase-shift keying (BPSK) or differential PSK (DPSK) data modulation
can be represented by
= cos 2 + (2.1)
where A is the signal amplitude, ( ) is the data modulation, ( )is the spreading waveform,
is the carrier frequency, and is the phase at = 0. The data modulation is a sequence of
nonoverlapping rectangular pulses of duration each of which has an amplitude = + 1 if
the associated data symbol is a 1 and = − 1 if it is a 0 (alternatively, the mapping could be
1 → − 1 And 0 → + 1) Equation (2-1) implies that = 2 + +
which explicitly exhibits the phase-shift keying by the data modulation.
10. 4
Figure 2.1: Examples of (a) data modulation and (b) spreading waveform.
The spreading wave form has the form
= ∑ − (2.2)
Where each equals +1 or –1 and represents one chip of the spreading sequence, the chip
waveform (t) is ideally confined to the interval 0, to prevent interchip interference in the
receiver. A rectangular chip waveform has ( ) = ( , ) where
, =
1, 0 ≤ ≤
0, ℎ
(2.3)
Figure 2.1 above depicts an example of ( ) and p(t) for a rectangular chip waveform.
Message privacy is provided by a direct-sequence system if a transmitted message cannot be
recovered without knowledge of the spreading sequence. To ensure message privacy, which
is assumed henceforth, the data-symbol transitions must coincide with the chip transitions.
Since the transitions coincide, the processing gain = ∕ is an integer equal to the
(a)
(b)
( )
( )
1
-1
1
-1
11. 5
number of chips in a symbol interval. If W is the bandwidth of ( ) and B is the bandwidth
of the spreading due to p(t) ensures that s(t) has a bandwidth W >> B.
Figure 2.2 is a functional or conceptual block diagram of the basic operation of a direct-
sequence
system with PSK. To provide message privacy, data symbols and chips, which are
represented by digital sequences of 0’s and 1’s, are synchronized by the same clock and then
modulo-2 added in the transmitter. The adder output is converted according to 0 → 1and1 →
+ 1 before the chip and carrier modulations. Assuming that chip and symbol synchronization
has been established, the received signal passes through the wideband filter and is multiplied
by a synchronized local replica of . If ( ) is rectangular, then ( ) = ± 1 and ( ) = 1
Therefore, the multiplication yields the despread signal
= = cos 2 + (2.4)
at the input of the PSK demodulator. Since the despread signal is a PSK signal, a standard
coherent demodulator extracts the data symbols. Figure 2.3(a) is a qualitative depiction of the
relative spectra of the desired signal and narrowband interference at the output of the
wideband filter. Multiplication of the received signal by the spreading waveform, which is
called despreading, produces the spectra of Figure 2.3(b) at the demodulator input. The signal
bandwidth is reduced to B, while the interference energy is spread over a bandwidth
exceeding W. Since the filtering action of the demodulator then removes most of the
interference spectrum that does not overlap the signal spectrum, most of the original
interference energy is eliminated.
12. 6
Figure 2.2: Functional block diagram of direct-sequence system with PSK or DPSK: (a)
transmitter and (b) receiver.
An approximate measure of the interference rejection capability is given by the ratio W/B.
Transmitted signal
Data symbols
Wideband
Synchronization system
Spreading
waveform
Chip
Waveform
Wideband
filter
Oscillator
Spreading
sequence generator
PSK
Carrier
Symbol
(a)
(b)
Data symbols
13. 7
Figure 2.3: Spectra of desired signal and interference: (a) wideband-filter output
and (b) demodulator input.
Whatever the precise definition of a bandwidth, W and B are proportional to 1⁄ and 1⁄ ,
respectively, with the same proportionality constant, therefore,
= = (2.5)
which links the processing gain with the interference rejection illustrated in figure 2.3. Since
its spectrum is unchanged by the despreading, white Gaussian noise is not suppressed by a
direct-sequence system. In practical systems, the wideband filter in the transmitter is used to
limit
the out-of-band radiation. This filter and the propagation channel disperse the chip waveform
so that it is no longer confined to 0, . To avoid interchip interference in the receiver, the
filter might be designed to generate a pulse that satisfies the Nyquist criterion for no
intersymbol interference [5]. A convenient representation of a direct-sequence signal when
the chip waveform may extend beyond 0, is
− cos 2 + (2.6)
Interference
Signal
Signal
Interference
Frequency Frequency
Spectral density
Spectral density
(a) (b)
14. 8
Where [ ] denotes the integer part of when the chip waveform is assumed to be confined
to [0, ] then (2-6) can be expressed by (2-1) and (2-2).
2.1 Pseudonoise Sequences
The spread-spectrum approach called transmitted reference (TR) can utilize a truly random
code signal for spreading and despreading, since the code signal and the data modulated
signal are simultaneously transmitted over different regions of the spectrum. The stored
reference (SR) approach cannot use a truly random code signal since the code needs to be
stored or generated at the receiver. For SR system a pseudonoise or pseudorandom code
signal must be used [5]
The difference between a random signal and a pseudorandom signal is that a random signal
cannot be predicted; its future variations can only be described in a statistical sense.
However, a pseudorandom signal is not random at all; it is a deterministic, periodic signal
that is known to both transmitter and receiver. Its been given the name “pseudonoise” or
“pseudorandom” because even though the signal is deterministic, it appears to have the
statistical properties of sampled white noise. It appears to unauthorized listener, to be a truly
random signal.
2.2 Randomness Properties
There are three basic properties that can be applied to any periodic sequence as a test for the
appearance of randomness. The properties, called balance, run, and correlation, are described
for binary signals as follows:
· Balance Property:
Good balance require that in each period of the sequence, the number of binary one differs
from the number of binary zeros by at most one digit.[5]
· Run Property:
A run is defined as a sequence of single type of binary digit(s) the appearance of the alternate
digit in a sequence starts a new run. The length of the run is the number of digits in the run.
Among the runs of ones and zeros in each period, it is desirable that about one-half the runs
of each type are of length 1, about one-fourth are of length 2, one-eighth are of length 3 and
so on.[5]
· Correlation Property:
15. 9
If a period of the sequence is compared term by term with any cyclic shift of itself, it is best if
the number of agreements differs from the number of disagreements by not more than one
count. [5].
2.3 Types of PN sequence
Maximal Length Sequences
Maximal length shift register sequence or m-sequences are so called due their property that
all possible shift register states except the all-zero state occur in a single, K length, cycle of
generated sequence [6]. Therefore for a shift register with n elements, the longest or
maximum (m) length sequence which can be generated is = 2 − 1 .
Due to the occurrence of all shift register states (except the all-zero state) each m-sequence
will consist of 2 ones and (2 − 1) zeros.
The correlation properties of the m-sequence family are interesting due to their flat periodic
autocorrelation side-lobes; figure 2.4 provides a good approximation to an impulsive
autocorrelation function.
Figure 2.4 Autocorrelation of maximal sequence and random binary sequence.
A shift-register sequence is a periodic binary sequence generated by combining the outputs of
feedback shift register. A feedback shift register, which is diagrammed in figure 2.5, consists
of consecutive two-state memory or storage and feedback logic. Binary sequences drawn
from the alphabet {0, 1} are shifted through the shift register in response to clock pulses. The
contents of the stages, which are identical to their outputs, are logically combined to produce
the input to the first stage. The initial contents of the stages and the feedback logic determine
the successive contents of the stages. If the feedback logic consists entirely of modulo-2
Random binary
1
1
Maximal
16. 10
adders (exclusive-OR gates), a feedback shift register and its generated sequence are called
linear.
Figure 2.5: General feedback shift register with m stages.
Figure 2.5 (a) illustrates a linear feedback shift register with three stages and an output
sequence extracted from the final stage. The input to the first stage is the modulo-2 sum of
the contents of the second and third stages. After each clock pulse, the contents of the first
two stages are shifted to the right, and the input to the first stage becomes its content. If the
initial contents of the shift register are 0 0 1, the subsequent contents after successive shift are
listed in figure 2.6 (b). since the shift register returns to its initial state after 7 shifts, the
periodic output sequence extracted from the final stage has a period of 7 bits.
If a linear feedback register reached the zero state with all its contents equal to 0 at some
time, it would always remain in the zero state, and the output sequence would subsequently
be all 0’s. Since a linear -stage feedback shift register has exactly 2 − 1 nonzero states,
the period of its output sequence cannot exceed2 − 1. A sequence of period 2 − 1
generated by a linear feedback shift register is called a maximal or maximal-length sequence.
(a)
1 2 3
Clock
Output
Feedback Logic
1 2 3 m
Clock
17. 11
Shift Contents
Initial Stage 1 Stage 2 Stage 3
1 0 0 1
2 1 0 0
3 0 1 0
4 1 1 0
5 1 1 1
6 0 1 1
7 0 0 1
(b)
Figure 2.6: (a) Three-stage linear feedback shift register and (b) contents after successive
shifts.
A pseudonoise or pseudorandom sequence is a periodic binary sequence with a nearly even
balance of 0’s and 1’s and an autocorrelation that roughly resembles, over one period, the
autocorrelation of a random binary sequence [1]
Pseudonoise sequences, which include the maximal sequences, provide practical spreading
sequences because their autocorrelations facilitate code synchronization in the receiver. Other
sequences have peaks that hinder synchronization.
Gold and Kasami codes
Selected pairs of m-sequences exhibit a three-valued periodic cross-correlation function, with
a reduced upper bound on the correlation levels as compared with the rest of the m-sequence
set. This m-sequence family subset is referred to as the preferred pair and one such unique
subset exists for each sequence length. For the preferred pair of m-sequences of order n, the
periodic cross-correlation and an autocorrelation sidelobe levels are restricted to the values
given by – ,− 1, − 2 where:
=
2 + 1,
2 + 1,
(2.7)
The enhanced correlation properties of the preferred pair can be passed on to the other
sequences derived from the original pair. By a process of modulo-2 addition of the preferred
pair the resulting derivative sequence shares the same features and can be grouped with the
preferred pair as a member of the newly created family members at each successive shift.
18. 12
Gold codes are widely used in spread spectrum systems such as the international Navstar
global positioning system (GPS), which uses 1023 chip gold codes for the civilian clear
access (C/A) part of the positioning service [3]
Walsh sequences
Walsh sequences have the attractive property that all codes in a set are precisely orthogonal.
A series of codes , for = 0,1,2, … . . , are orthogonal with weight K over the
interval 0 ≤ ≤ , when:
=
, =
0, ≠
(2.8)
Where n and m have integer values and K is a non-negative constant which does not depend
on the indices m and n but only on the code length K. This means that, in a fully synchronized
communication system where each user is uniquely identified by a different Walsh sequence
from a set, the different users will not interfere with each other at the proper correlation
constant, when using the same channel.
Walsh sequence systems are limited to code lengths of = 2 where n is an integer. When
Walsh sequences are used in communication systems the code length K enables K orthogonal
codes to be obtained. This means that communication system can serve many users per cell as
the length of the Walsh sequence.
19. 13
CHAPTER 3
CODE SYNCHRONISATION
A spread-spectrum receiver must generate a spreading sequence or frequency hopping pattern
that is synchronized with the received sequence or pattern; that is the corresponding chips or
dwell intervals must precisely or nearly coincide.
Any misalignment causes the signal amplitude at the demodulator output to fall in accordance
with the autocorrelation or partial autocorrelation function.
Although the use of precision clocks in both the transmitter and the receiver limit the timing
uncertainty in the receiver, clock drifts, range uncertainty, and the Doppler shift may cause
synchronization problems. Code synchronization, which is either sequence or pattern
synchronization, might be obtained from separately transmitted pilot or timing signals. It may
be aided or enabled by feedback signals from the receiver to the transmitter. However, to
reduce the
cost in power and overhead, most spread-spectrum receivers can acquire code
synchronization from the received signal.
Code acquisition is the operation by which the phase of the receiver-generated sequence is
brought to within a fraction of a chip of the phase of the received sequence [7]. After this
condition is detected and verified, the tracking system is activated. Code tracking is the
operation by which synchronization errors are further reduced or at least maintained within
certain bounds. Both the acquisition and tracking devices regulate the clock rate. Changes in
the clock rate adjust the phase or timing offset of the local sequence generated by the receiver
relative to the phase or timing offset of the received sequence.
3.1 Acquisition of spreading sequences
Acquisition provides coarse synchronization by limiting the choices of the estimated values
to a finite number of quantized candidates. Since the presence of the data modulation
impedes code synchronization, the transmitter is assumed to facilitate the synchronization by
transmitting the spreading sequence without any data modulation. In nearly all applications,
non-coherent code synchronization must precede carrier synchronization because the signal
energy is spread over a wide spectral band. Prior to despreading, which requires code
synchronization the signal-to-noise ratio (SNR) is unlikely to be sufficiently high for
successful carrier tracking by a phase-locked loop. The received signal is
20. 14
= + (3.1)
Where s t is the desired signal and n(t) is the additive white Gaussian noise for a direct-
sequence system with PSK modulation, the desired signal is:
= 2 − cos 2 + 2 + (3.2)
Where S is the average power, ( )is the spreading waveform, is the carrier frequency,
is the random carrier phase, and and are the unknown code phase and frequency offset,
respectively, that must be estimated. The frequency offset may be due to a Doppler shift or to
a drift or instability in the transmitter oscillator.
One method of acquisition is to use a parallel array of processors, each matched to candidate
quantized values of the timing and frequency offsets [6]. The largest processor output then
indicates which candidates are selected as the estimates. An alternative method of acquisition,
which is much less complex, but significantly increases the time needed to make a decision,
is to serially search over the candidate offsets. Since the frequency offset is usually negligible
or requires only a few candidate values, I will analyze the code synchronization in which only
the timing offset is estimated. Search methods rather than parallel processing are examined.
It must be noted that both the acquisition and tracking devices regulate the clock rate and so
changes in the clock rate adjust the phase or the timing offset of the local sequence generated
by the receiver relative to the phase or the timing offset of the received sequence.
In a benign environment, sequential estimation methods provide rapid acquisition [7].
Successive received chips are demodulated and then loaded into the receiver’s code generator
to establish its initial state. The tracking system then ensures that the code generator
maintains synchronization. However, because chip demodulation is required, the usual
despreading mechanism cannot be used to suppress interference during acquisition. Since an
acquisition failure completely disables a communication system, an acquisition system must
be capable of rejecting the anticipated level of interference. To meet this requirement,
matched-filter acquisition and serial-search acquisition are the most effective techniques in
general.
3.1.1 Matched-Filter Acquisition.
Matched-filter acquisition provides potentially rapid acquisition when short programmable
sequences give adequate security. The matched filter in an acquisition system is matched to
21. 15
one period of the spreading waveform, which is usually transmitted without modulation
during acquisition. The sequence length or integration time of the matched filter is limited by
frequency offsets and chip-rate errors. The output envelope, which ideally comprises
triangular autocorrelation spikes, is compared with one or more thresholds, one of which is
close to the peak value of the spikes. If the data-symbol boundaries coincide with the
beginning and end of a spreading sequence, the occurrence of a threshold crossing provides
timing information used for both symbol synchronization and acquisition. A major
application of matched-filter acquisition is for burst communications, which are short and
infrequent communications that do not require a long spreading sequence.
A digital matched filter that generates ( , 0) for noncoherent acquisition of a binary
spreading waveform is illustrated in Figure 3.1.
Figure 3.1: Digital matched filter
The digital matched filter offers great flexibility, but is limited in the bandwidth it can
accommodate. The received spreading waveform is decomposed into in-phase and quadrature
baseband components, each of which is applied to a separate branch. The outputs of each
digitizer are applied to a transversal filter. Tapped outputs of each transversal filter are
multiplied by stored weights and summed. The two sums are squared and added together to
produce the final matched-filter output. A one-bit digitizer makes hard decisions on the
received chips by observing the polarities of the sample values. Each transversal filter is a
shift register, and the reference weights are sequence chips stored in shift-register stages. The
transversal filter contains G successive received spreading-sequence chips and a correlator
Oscillator
Filter
digitizer
Transversal
filter
Square
∑
Reference
Weights
Filter,digitize
r
Transversal
filter
Squarer
π/2
Output signal
Input signal
22. 16
that computes the number of received and stored chips that match. The correlator outputs are
applied to the squarers. Matched-filter acquisition for continuous communications is useful
when serial-search acquisition with a long sequence fails or takes too long. The transmission
of the short sequence may be concealed by embedding it within the long sequence. The short
sequence may be a subsequence of the long sequence that is presumed to be ahead of the
received sequence and is stored in the programmable matched filter.
Figure 3.2 depicts the configuration of a matched filter for short-sequence acquisition and a
serial-search system for long-sequence acquisition. The control signal provides the short
sequence that is stored or recirculated in the matched filter.
Figure 3.2: Configuration of a serial-search acquisition system enabled by a matched filter.
The control signal activates the matched filter when it is needed and deactivates it otherwise.
The short sequence is detected when the envelope of the matched-filter output crosses a
threshold. The threshold-detector output starts a long-sequence generator in the serial-search
system at a predetermined initial state. The long sequence is used for verifying the acquisition
and for despreading the received direct-sequence signal. To expedite the process several
matched filters in parallel may be used.
3.1.2 Serial-Search Acquisition
Serial-search acquisition consists of a search, usually in discrete steps, among candidate code
phases of a local sequence until it is determined that the local sequence is nearly
Matched Filter Envelope
Detector
Threshold
Detector
Serial-search
acquisition system
Input
To tracking system
and demodulator
23. 17
synchronized with the received spreading sequence. Conceptually, the timing uncertainty
covers a region that is quantized into a finite number of cells, which are search positions of
relative code phases or timing alignments. The cells are serially tested until it is determined
that a particular cell corresponds to the alignment of the two sequences to within a fraction of
a chip.
Input
To tracking system and demodulator
From tracking system
Figure 3.3: Serial-search acquisition system.
Figure 3.3 depicts the principal components of a serial-search acquisition system. The
received
direct-sequence signal and a local spreading sequence are applied to a noncoherent correlator.
If the received and local spreading sequences are not aligned, the sampled correlator output is
low. Therefore, the threshold is not exceeded, the cell under test is rejected, and the phase of
the local sequence is retarded or advanced, possibly by generating an extra clock pulse or by
blocking one. A new cell is then tested. If the sequences are nearly aligned, the sampled
correlator output is high, the threshold is exceeded, the search is stopped, and the two
sequences run in parallel at some fixed phase offset. Subsequent tests verify that the correct
cell has been identified. If a cell fails the verification tests, the search is resumed. If a cell
passes, the two sequences are assumed to be coarsely synchronized, demodulation begins,
and the tracking system is activated. The threshold-detector output continues to be monitored
so that any subsequent loss of synchronization activates the serial search.
Non-coherent
correlator
Threshold
Detector
Spreading
sequence
Voltage
controlled
Search Control
24. 18
There may be several cells that potentially provide a valid acquisition. However, if none of
these cells corresponds to perfect synchronization, the detected energy is reduced below its
potential peak value. The step size is the separation between cells. If the step size is one-half
of a chip, then one of the cells corresponds to an alignment within one-fourth of a chip. On
the average, the
misalignment of this cell is one-eighth of a chip, which may cause a negligible degradation.
As the step size decreases, both the average detected energy during acquisition and the
number of cells to be searched increase.
The dwell time is the amount of time required for testing a cell and is approximately equal to
the length of the integration interval in the non-coherent correlator. An acquisition system is
called a single-dwell system if a single test determines whether a cell is accepted as the
correct one. If verification testing occurs before acceptance, the system is called a multiple-
dwell system. The dwell times either are fixed or are variable but bounded by some
maximum value. The dwell time for the initial test of a cell is usually designed to be much
shorter than the dwell times for the verification tests. This approach expedites the acquisition
by quickly eliminating the bulk of the incorrect cells.
In any serial-search system, the dwell time allotted to a test is limited by the Doppler shift,
which causes the received and local chip rates to differ. As a result, an initial close alignment
of the two sequences may disappear by the end of the test.
A multiple-dwell system may use a consecutive-count strategy, in which a failed test causes a
cell to be immediately rejected, or an up-down strategy, in which a failed test causes a
repetition of a previous test. Figures 3.4 and 3.5 depict the flow graphs of the consecutive-
count and up-down strategies, respectively, that require D tests to be passed before
acquisition is declared. If the threshold is not exceeded during test 1, the cell fails the test,
and the next cell is tested. If it is exceeded, the cell passes the test, the search is stopped, and
the system enters the verification mode.
25. 19
Figure 3.4: Flow graph of multiple-dwell system with consecutive-count strategy.
The same cell is tested again, but the dwell time and the threshold may be changed. Once all
the verification tests have been passed, the code tracking is activated, and the system enters
the lock mode. In the lock mode, the lock detector continually verifies that code
synchronization is maintained. If the lock detector decides that synchronization has been lost,
reacquisition begins in the search mode.
Figure 3.5: Flow graph of multiple-dwell system with up-down strategy.
The order in which the cells are tested is determined by the general search strategy. Figure
3.6(a) depicts a uniform search over the cells of the timing uncertainty. The broken lines
Test 1
Reject
Test 2 Test D
Lock Mode
Pass
Verification Mode
Pass
Pass
Fail
Fail
Fail
Start
Test 1
Reject
Test 2 Test D
Lock Mode
Pass
Pass
Fail
Verification Mode
Fail
Fail
Start
26. 20
represent the discontinuous transitions of the search from the one part of the timing
uncertainty to another. The broken-center Z search, illustrated in Figure 3.6(b), is appropriate
when a priori information makes part of the timing uncertainty more likely to contain the
correct cell than the rest of the region. A priori information may be derived from the
detection of a short preamble.
Figure 3.6: Trajectories of search positions: (a) uniform search and (b) broken-center Z
search.
If the sequences are synchronized with the time of day, then the receiver’s estimate of the
transmitter range combined with the time of day provide the a priori information.
3.2 Code Tracking
Coherent code-tracking loops operate at baseband following the coherent removal of the
carrier of the received signal. An impediment to their use is that the input SNR is usually too
low for carrier synchronization prior to code synchronization and the subsequent despreading
of the received signal. Furthermore, coherent loops cannot easily accommodate the effects of
data modulation. Non-coherent loops operate directly on the received signals and are
unaffected by the data modulation.
Uncertainty
Uncertainty
Cell
Time Time
Cell
1 2 . . . . . . . . . . . . . . .
1 2 . . . . . . . . . . . . . . .
27. 21
Figure 3.7: Delay-locked loop.
To motivate the design of the non-coherent loop, one may adapt the statistic in appendix B. If
the maximum-likelihood estimate is assumed to be within the interior of its timing
uncertainty region and ( , ) is a differentiable function of , then the estimate ̂ that
maximizes ( , ) may be found by setting
,
= 0
= ̂ (3.3)
A major problem with this approach is that ( , ) given by statistics [1] is not
differentiable if the chip waveform is rectangular. This problem is circumvented by using a
difference equation as an approximation of the derivative. Thus, for a positive , we set
( , )
≈
+ , − ( − , )
2
(3.4)
This equation implies that the solution of (3-3) may be approximately obtained by a device
that finds the ̂ such that
̂ + , − ̂ − , = 0 (3.5)
Bandpass Square
Spreading
Sequence
Voltage
controlled
Loop filter
Bandpass
filter
Square
Law
∑
Reference/Precise
Advanced
Delayed
Error
Received
28. 22
To derive an alternative to this equation, we assume that no noise is present, = 0 and that
the correct timing offset of the received signal is = 0 doing necessary substitution and
using trigonometry, we obtain
̂, 0 =
2
− ̂ (3.6)
If ( ) is modeled as the spreading waveform for a random binary sequence and the interval
[0,T] includes many chips, then the integral is reasonably approximated by its expected value,
which is proportional to the autocorrelation
= ⋀ (3.7)
where the triangular function is defined by
⋀ =
1 − | |, | | ≤ 1
0, | | > 1
(3.8)
Substituting this result into (3-5), we find that the maximum-likelihood estimate is
approximately obtained by a device that finds the ̂ such that
̂ + − ̂ − = 0 (3.9)
The non-coherent delay-locked loop [9], which is diagrammed in Figure 3.7, implements an
approximate computation of the difference on the left-hand side of (3.9) and then continually
adjusts so that this difference remains near zero. The estimate is used to produce the
synchronized local spreading sequence that is used for despreading the received direct-
sequence signal. The code generator produces three sequences, one of which is the reference
sequence used for acquisition and demodulation. The other two sequences are advanced and
delayed, respectively, relative to the reference sequence. The product is usually equal to the
acquisition step size, usually but other values are plausible. The advanced and delayed
sequences are multiplied by the received direct-sequence signal in separate branches. For the
received direct-sequence signal (3.2), the signal portion of the upperbranch mixer output is
= + − cos 2 + 3.10
Where = √2 and is the delay of the reference sequence relative to the received
sequence. Although is a function of time because of the loop dynamics, the time
dependence is suppressed for notational convenience. Since each bandpass filter has a
bandwidth on the order of 1⁄ where is the duration of each symbol, is not significantly
29. 23
distorted by the filtering. Nearly all spectral components except the slowly varying expected
value of ( + − ) are blocked by the upper-branch bandpass filter. Since this
expected value is the autocorrelation of the spreading sequence, the filter output is
≈ − cos 2 + (3.11)
Any double-frequency component produced by the square-law device is ultimately
suppressed by the loop filter and is therefore ignored. Since = 1, the data modulation is
removed and the upper branch output is
≈
2
− (3.12)
Similarly, the output of the lower branch is
≈
2
− − (3.13)
The difference between the output of the two branches is the error signal:
≈
2
− − − − (3.14 )
Since is an even function, the error signal is proportional to the left-handside of (3.9).
When necessary substitutions are made [1] we find the following equation.
≈
2
, (3.14 )
Where ( , ) is the discriminator characteristic or S-curve of the tracking loop
For 0 ≤ ≤ 1 2
⁄ ,
, =
4 1 − , 0 ≤ ≤
4 1 − , ≤ ≤ 1 −
1 + − − − 2 , 1 − ≤ ≤ 1 +
0, 1 + ≤
(3.15)
For 1 2
⁄ ≤ ≤ 1,
, =
4 1 − , 0 ≤ ≤ 1 −
1 + − − + 2 , 1 − ≤ ≤ (3.16)
1 + − − − 2 , ≤ ≤ 1 +
0 1 + ≤
In both cases, − , = − ,
30. 24
Figure 3.8 illustrates the discriminator characteristic for = 1 2
⁄ .The filtered error signal is
applied to the voltage-controlled clock. Changes in the clock frequency cause the reference
sequence to converge toward alignment with the received spreading sequence. When
0 < < 1 + , the reference sequence is delayed relative to the received sequence. As
shown in Figure 3.8, ( , ) is positive, so the clock rate is increased, and ( ) decreases.
The figure indicates that ( ) → 0 as ( ) → 0 similarly, when ( ) < 0, we find that
→ 0 as ( ) → 0.
Thus, the delay-locked loop tracks the received code timing once the acquisition system has
finished the coarse alignment. The discriminator characteristic of code-tracking loops differs
from that of phase-locked loops in that it is nonzero only within a finite range of .
Figure 3.8: Discriminator characteristic of delay-locked loop for = 1 2
⁄
Outside that range, code tracking cannot be sustained, the synchronization system loses lock,
and a reacquisition search is initiated by the lock detector. Tracking resumes once the
acquisition system reduces to within the range for which the discriminator characteristic is
nonzero.
When short spreading sequences are used in a synchronous direct-sequence network, the
reduced randomness in the multiple-access interference may cause increased tracking jitter or
even an offset in the discriminator characteristic [10]. For orthogonal sequences, the
interference is zero when synchronization exists, but becomes large when there is a code-
phase error in the local spreading sequence. In the presence of a tracking error, the delay-
locked- loop arm with the larger offset relative to the correct code phase receives relatively
S (ε,d)
1
-1
1.5
-1.5 0.5
-0.5
ε
31. 25
more noise power than the other arm. This disparity reduces the slope of the discriminator
characteristic and, hence, degrades the tracking performance. Moreover, because of the non-
symmetric character of the cross-correlations among the spreading sequences, the
discriminator characteristic may be biased in one direction, which will cause a tracking
offset. The non-coherent tau-dither loop, which is depicted in Figure 4.17, is a lower
complexity alternative to the non-coherent delay-locked loop. The dither generator produces
the dither signal a square wave that alternates between +1 and –1. This signal controls a
switch that alternately passes an advanced or delayed version of the spreading sequence. In
the absence of noise, the output of the switch can be represented by
=
1 +
2
+ − +
1 −
2
− − 3.17
where the two factors within brackets are orthogonal functions of time and alternate between
+1 and 0. Only one of the factors is nonzero at any instant. The received direct-sequence
signal is multiplied by s t , filtered, and then applied to a square-law device. If the bandpass
filter has a sufficiently narrow bandwidth, then a derivation similar to that of (3-12) indicates
that the device output is
≈ − + − − (3.18)
Figure 3.9: Tau-dither loop.
Spreading
sequence
Switch
Bandpass
filter
Square-law
device
Dither
Generator
Loop Filter
Voltage
Controlled
Delayed
Advanced
Input
Reference
32. 26
Since 1 + = 1 + and 1 − = − 1 + , the input to the loop
filter is
≈
2
1 +
2
− −
2
1 −
2
− − (3.19)
which is a rectangular wave if the time variation of is ignored. Since the loop filter has a
narrow bandwidth relative to that of , its output is approximately the direct-current
component of , which is the average value of . Averaging the two terms of (3-19),
we obtain the filter output:
≈
4
− − − (3.20)
The substitution of (4-99) yields the input clock signal input:
≈
4
, (3.21)
where the discriminator characteristic is given by (3-15) to (3-16). Thus, the tau-dither loop
can track the code timing in a manner similar to that of the delay-locked loop. A detailed
analysis indicates that the tau-dither loop provides less accurate code tracking [6]. However,
the tau-dither loop requires less hardware than the delay-locked loop and avoids the need to
balance the
gains and delays in the two branches of the delay-locked loop.
In the presence of frequency-selective fading, the discriminator characteristics of tracking
loops are severely distorted. Much better performance is potentially available from a non-
coherent tracking loop with diversity and multipath-interference cancellation [11], but a large
increase in implementation complexity is required.
33. 27
CHAPTER 4
DESIGN OF CODE ACQUSITION AND TRACKING MECHANISM
4.1 Design
In the design of an acquisition mechanism, the following was put into consideration. Long
PN codes this ensures a good bit error rate performance and increases the data throughput
Large processing gain this reduces narrow band interference The following are some of the
design assumptions that were made during the design of this mechanism The additive white
Gaussian noise was band limited this ensured that it was possible to eliminate the noise from
the system. The filter used was ideal with a linear phase.
Figure 4.1 Generic acquisition block diagram
The proposed acquisition process was as shown in figure 4.1. The received signal was
multiplied by a locally generated code and after processing N chips, where N was the length
of the code, despreading took place. The value obtained from the despreader was the
compared to a threshold to establish weather or not lock had been established. A non coherent
loop is one in which the carrier frequency is not known exactly (due to Doppler effects, for
example), nor is the phase. In most instances, since the carrier frequency and phase are not
known exactly a priori, a non-coherent code loop is used to track the received PN sequence.
BPF
Reference
Spreading
Energy
Detector
Decision
Device
Control
Logic
Received
Hypothesized phase
34. 28
In this design full-time early late tracking loop, often referred to as a delay-locked loop
(DLL), is implemented
Figure 4.2 Delay locked loop for tracking of direct sequence signals
Received Signal
To generate the received signal to be used in my design a random data generator was used
and the probability of generating ones and zeros was equal. The next stage was to encode the
random signal using a differential encoder
Differential Encoder
The polarity of data is presented in the phase change between the consecutive bits. The
differential decoder can correctly recover the original data as long as the phase difference
between successive symbols is maintained after the transmission. The absolute phase of each
symbol is not required for correct decoding
BPSK Modulator
The BPSK was a fully digital modulator which translates the spread signal into a digitized
inter-mediate frequency (IF) modulated signal by multiplying it with a digitized sine or
cosine wave from a numerically controlled oscillator (NCO).
Bandpass Square
Spreading
Sequence
Voltage
controlled
Loop filter
Bandpass
filter
Square
Law
∑
Advanced
Signal +
+
Delayed − +
Error
Received
Reference/Precise
+
35. 29
After modulation, additive white Gaussian noise (AWGN) was added to the signal which
formed the input to the matched filter.
Matched filter
A matched filter is chosen for the despreading as it has a short acquisition time compared to
the active correlator.
Threshold detector
The threshold detector was used to determine weather the PN sequence was synchronized or
not this was determined by the autocorrelation function. The threshold value was set to an
average value of 6 to ensure that peaks whose heights have been reduced by Gaussian noise is
taken care of.
I have also simulated an environment where three users are present to further show how
spread spectrum communication is applied in a multiuser environment.
Values are initially assigned to the shift register these values are later used to generate the
three chipping sequences cseq1, cseq2 and cseq3 the program are as shown in appendix.
Generation of narrowband data signal
To generate user’s data we generate 10,000 polar data of 1’s and -1’s which are equi-probable
and my sampling rate equals to the chip rate with rectangular pulse shaping, each 1 will be
represented by 31 1’s and each -1 will be represented by 31 -1’s this is plotted in matlab
using the command psd function which shows only the positive part of the plot.
Spreading the narrowband Signal
Now the data sequence that has been generated is now spread by multiplying it with the first
chipping sequence. The psd function is used to display the graph which this time is a
wideband signal as it is spread by the chipping sequence.
This actually first makes the row to column rule satisfied for matrix multiplication that is first
used to spread the signal by spreading the original 10,000 user bits by first multiplying x-
numbered (31 used primarily) values of 1. This is actually the same matrix only repeating it x
times. This later reshaped to only one row of all the values that I got from initial
multiplication. Later this is multiplied and ready chipping sequence cseq and finally spread
according to the x length of PN-sequence. RESHAPE(X,M,N) function returns the M-by-N
matrix whose elements are taken column wise from X, an error will results if X does not
contain M*N elements. RESHAPE(X,…., [],….) calculates the length of the dimensions
represented by [], such that the product of the dimensions equals
PROD(SIZE(X)).PROD(SIZE(X)) must be evenly divisible by the product of the known
dimensions, only one occurrence of [] can be used. The essence behind the interference
36. 30
rejection capability of a spread spectrum system is that the useful signal (data) gets multiplied
twice by the PN sequence, but the interference gets multiplied only once. Multiplication of
the received signal with the PN sequence of the receiver gives a selective de-spread of the
data signal with smaller bandwidth and high power density the interference signal is
uncorrelated with the PN sequence and is spread. Wideband noise can be due to multiple
spread spectrum users, multiple access mechanism and Gaussian Noise.
Wideband Interference
The other wideband signals are also generated using the other chipping sequences I used this
as the wideband interference to the first data sequence. At the receiver end the chip sequence
of user 1 will retrieve the original data and ignore the other two wideband signals as the chip
sequence doesn’t correlate with them.
Despreading Process
At the receiver the opposite of spreading was done here I tried to show that if the transmitted
data is multiplied with the same chipping of user 1 data then we get back to the original
signal sent. Reshaping is first done to the chipping sequence and it is multiplied by the
received signal then we turn the x0000 bit long received user into a 10000 bit long user data
size becomes same as the original data. The chipping sequences are being multiplied with
each other resulting into an autocorrelation value of 1and thus wideband signal become
narrow band. The interference signal due the other two wideband signals remain spread as it
is uncorrelated with user 1 PN sequence. All these are implemented in a MATLAB
environment using a code which is attached to this document.
37. 31
4.2 Results
0 5 10 15 20
-0.5
0
0.5
1
1.5
Amplitude
original data signal
0 5 10 15 20
-2
-1
0
1
2
Amplitude
Spread Spectrum Signal
0 5 10 15 20
-2
-1
0
1
2
Amplitude
BPSK modulated signal
0 20 40 60 80
-5
0
5
Amplitude
BPSK modulated signal with noise
0 20 40 60 80
-10
0
10
Time
Amplitude
Matched filter output signal
0 20 40 60 80
-10
0
10
Time
Amplitude
power detector output signal
38. 32
Results
0 20 40 60 80
-20
0
20
Frequency
Amplitude
output signal at threshold detector
0 5 10 15 20
-0.5
0
0.5
1
1.5
Amplitude
output signal at differential demodulator
0 5 10 15 20
-0.5
0
0.5
1
1.5
Time
Amplitude
Original data signal
0 5 10 15 20
-0.5
0
0.5
1
1.5
Time
Amplitude output signal at differential demodulator
39. 33
Results
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Narrow band signal for user2
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Narrow band signal for user3
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Narrow band signal for user 1
0 0.2 0.4 0.6 0.8 1
-20
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
Wide band signal for user 1 the spread signal
0 0.2 0.4 0.6 0.8 1
-20
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
Wide band signal for user 2 the spread signal
0 0.2 0.4 0.6 0.8 1
-20
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
Wide band signal for user 3 the spread signal
40. 34
Results
0 0.2 0.4 0.6 0.8 1
-20
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
The wideband inteference with the users desired data
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Narrow band signal for user 1 after despreading
0 0.2 0.4 0.6 0.8 1
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
interference remain wideband after despreading
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Uncorrelated data 2 signal with user 1 PN sequence
0 0.2 0.4 0.6 0.8 1
-20
-10
0
10
Frequency
Power
Spectrum
Magnitude
(dB)
Uncorrelated data 3 signal with user 1 PN sequence
0 0.2 0.4 0.6 0.8 1
-40
-20
0
20
Frequency
Power
Spectrum
Magnitude
(dB)
Narrow band signal for user 2 after despreading
41. 35
4.3 Analysis of Results
The acquisition results achieved through Matlab simulation showed how coarse
synchronization can be achieved using the designed circuit. The matched filter output was the
complete correlation function, with peaks depicting that the PN code in the received signal
and that in the receiver were in synchronism which enabled timing information to be acquired
for initial synchronization
The length of the code used in the design was 11 and since the matched filter was advanced at
a half chip rate, the peaks occur periodically at twice the length of the PN code observation
can be made from the matched filter output that the first correct detection occurs at twice the
length of the code.
It was observed that the acquisition time is dependent on the length of the PN sequence used
as longer PN sequences gave longer time to achieve initial synchronization.
In a multiuser environment the receiver will only correctly correlate the chipping sequence
that is similar to its own; this will ensure that only the desired signal is received. It is clear
from the graphs that the detection scheme for DSSS systems at the receiver end is based on
the mechanism of separating narrowband signals from a wideband pool. Therefore the more
the difference in bandwidth between our data and the spread signal, the easier it is to detect.
An initial seed of greater length gives us a longer usable chipping sequence. Every bit of the
user is multiplied with the entire chipping sequence; as a result, we get spread signal of
higher bandwidth if the chipping sequence is longer. Thus, for a longer seed, the difference in
bandwidth between the narrowband and wideband is greater, making detection easier and
more accurate.
4.4 Future Work
I recommend that a similar project should be undertaken with emphasis on how various types
of PN sequences can be used to achieve direct sequence spread spectrum communication and
their response in the presence of noise. I want to suggest that a further study may be done in
detail which PN codes best suit a multiuser environment
42. 36
4.5 Conclusion
This report has demonstrated the principles of direct sequence spread spectrum signals it has
shown how acquisition is achieved and how PN sequences are unique and will only correlate
with the ones that are matched to them. A thorough discussion has been given on acquisition
and tracking and the various methods used to achieve the same have been expounded on. A
multiuser environment has been simulated and the results show how various codes will only
synchronize with the ones that match.
It can also be shown that the noise or interference signal will remain wide band after
multiplication by the PN sequence at the receiver. Showing how interference is rejected in
spread spectrum communication.
43. 37
RFERENCES.
[1] Don Torrieri Principles of spread spectrum communication systems Springer 2005
[2] S.Haykin communication systems John Wiley and sons, third edition 1994
[3] R.L Peterson, R.E Ziemer and D.E Borth, introduction to spread spectrum
communications, Prentice hall Inc, 1995.
[4] J.G. Proakis, Digital Communications, New York: Mc Graw Hill, 1995
[5] Bernard Sklar Digital Communication Fundamentals and Applications Prentice Hall
[6] R. B. Ward and K. P. Y. Yiu, “Acquisition of Pseudonoise Signals by Recursion-Aided
Sequential Estimation,” IEEE Trans. Commun., vol. 25, pp. 784–794, August 1977.
[7] W. R. Braun, “PN Acquisition and Tracking Performance in DS/CDMA Systems with
Symbol-Length Spreading Sequence,” IEEE Trans. Commun., vol. 45, pp. 1595–1601,
December 1997.
[8] R. A. Dillard and G.M. Dillard, Detectability of Spread Spectrum Signals, Norwood, MA:
Artech House, 1989.
[9] TIA/EIA Interim Standard-95, “Mobile Station—Base Station Compatibility Standard
for Dual-Mode Wideband Spread Spectrum Cellular System,” July 1993.
[10] J. Geier, Wireless LANs, 2nd edition, Indianapolis, IN: Sams Publishing, 2001.
44. 38
APPENDIX A
%this program first generates the spread signal;
%the noise is added to the spread spectrum signal;
%the signal then forms the input to the matched filter and acquisition is carried out.
clear;%clear the memory space.
Iter_No=2; %repeat the simulation
data_No=1000;
for EBNO_ITER=1:1,
EbNo_dB=8;
EbNo=10^(EbNo_dB/10);
barker_11=[1 1 1 0 0 0 1 0 0 1 0];%PN code
SampleNoPerChip=2;%2 samples per chip
chip=barker_11*2-1;%PN code in polar format
chip_rate=length(chip);%PN code length
t=(0:1:200);
Noi_var=SampleNoPerChip/2*chip_rate/EbNo;%calculate channel noise variance
for Iter=1:2, %begin simulation
%ORIGINAL DATA GENERATOR
rand('seed',sum(100*clock));%set the seed of uniform generator to different value each time
data_in=rand(1,data_No+2)>.5;%1 and 0 are generated with the same probabilty 0.5
figure(1);
subplot(321);
plot(t(1:20),data_in(1:20));
axis([0,20,-0.5,1.5]);
ylabel('Amplitude');
title ('original data signal');
grid on;
%INPUT PROCESSOR (INPSR)
inpsr_out=data_in;
%DIFFERENTIAL ENCODER(DENCO)
N=length(inpsr_out);%the first axis is xor with 1
denco=zeros(1,N);
denco(1)=xor(inpsr_out(1),1);%'xor' operation
for i=2:N,
denco(i)=xor(inpsr_out(i),denco(i-1));
end
denco_out=[1 denco];%the 1 is also transmitted
denco_out=2*denco_out-1;%change to polar format
clear denco inpsr_out;
%PN SPREAD CODER
N=length(denco_out);
pncod_out=zeros(1,N*chip_rate);
for i=1:N,
pncod_out(chip_rate*(i-1)+1:chip_rate*i)=denco_out(i)*chip;
end
subplot(322);
plot(t(1:20),pncod_out(1:20));
axis([0,20,-2,2]);
ylabel('Amplitude');
title('Spread Spectrum Signal');
45. 39
grid on;
clear denco-out;
%BPSK MODULATOR with samplimg process (BPSPL)
%The signal is generated in complex format
N=fix(length(pncod_out)*SampleNoPerChip);
bpspl_out=exp(j*(pncod_out(fix((0:N-1)/SampleNoPerChip)+1)<0)*pi);
subplot(323);
plot(t(1:20),bpspl_out(1:20));
axis([0,20,-2,2]);
ylabel('Amplitude');
title('BPSK modulated signal');
grid on;
clear pncod_out;
%CHANNEL NOISE ADDER, AGC (CNAAA)
%The noise also is in complex form
%variance calculated from Eb/No
N=length(bpspl_out);
cnaaa_out=bpspl_out+(randn(1,N))+j*sqrt(Noi_var);
subplot(324);
plot(t(1:80),cnaaa_out(1:80));
ylabel('Amplitude');
title('BPSK modulated signal with noise');
grid on;
%MATCHED FILTER(MAFLT)
match_in=cnaaa_out;
BitNo_Matchin=3;
Quanlevel_Matchin=2^BitNo_Matchin;
match_in=round(match_in*Quanlevel_Matchin)/Quanlevel_Matchin;
BitNo_Matchout=10;
Quanlevel_Matchout=2^BitNo_Matchout;
tap=fliplr(chip);%reverse the chip
N=length(match_in);
fep_out=zeros(1,N);%preallocate the memory space
fep_out(1)=match_in(1);
fep_out(2:N)=(match_in(2:N)+match_in(1:(N-1)))/2;
match=zeros(1,N);
for i=1:N,
k=fix((i-1)/2)+1;
if k>chip_rate
k=chip_rate;
end
match(i)=sum(tap(1:k).*fep_out(i:-2:(i-2*k+2)));
end
match_out=fix(match*Quanlevel_Matchout)/Quanlevel_Matchout;
subplot(325);
plot(t(1:80),match_out(1:80));
axis([0,80,-15,15]);
xlabel('Time');
ylabel('Amplitude');
title('Matched filter output signal');
46. 40
grid on;
clear match match_in fep_out cnaa_out dncov_out bpsl_out;
%POWER DETECTOR
BitNo_Viewport=8;
Quanlevel_VP=2^BitNo_Viewport;
BitNo_Magnitude=10;
Quanlevel_Magnitude=2^BitNo_Magnitude;
VP_CTRL=0;
maflt_8=fix(match_out/2^VP_CTRL)*Quanlevel_VP/Quanlevel_VP;
powde=real(match_out);
powde_10=fix(powde*Quanlevel_Magnitude)/Quanlevel_Magnitude;
subplot(326);
plot(t(1:80),powde_10(1:80));
axis([0,80,-15,15]);
xlabel('Time');
ylabel('Amplitude');
title('power detector output signal');
grid on;
clear match_out;
%THRESHOLD DETECTOR
THRESHOLD=5;%define the threshold
N=round(length(powde_10)/2/chip_rate)-2;
thrshd_out=zeros(1,N);%preallocate the memory space
flywheel=zeros(1,N);
flywheel(1)=22;%first one is correctly detected
Ha_win=1;
for i=2:N,
flywheel(i)=flywheel(i-1)+2*chip_rate;
A=powde_10((flywheel(i)-Ha_win):(flywheel(i)+Ha_win));
max_A=max(A);
B=find(A==max_A);
if max_A>=THRESHOLD,
flywheel(i)=flywheel(i)+B(1)-2;
end
end
thrshd_out=maflt_8(flywheel);
figure(2);
subplot(321);
plot(t(1:80),thrshd_out(1:80));
ylabel('Amplitude');
title('output signal at threshold detector');
grid on;
clear powde_10 maflt_8;
%DIFFERENTIAL DEMODULATOR (DDEMO)
N=length(thrshd_out);
test=zeros(1,N-1);%preallocate memory space
test=thrshd_out(1:N-1).*conj(thrshd_out(2:N));%calculate the dot product for decision cicuirt
data_out=test<0;%differential decoder's decision
end
end
47. 41
subplot(322);
plot(t(1:20),data_out(1:20));
axis([0,20,-0.5,1.5]);
ylabel('Amplitude');
title('output signal at differential demodulator');
grid on;
%COMPARISON BETWEEN INPUT AND OUTPUT SIGNALS.
subplot(323);
plot(t(1:20),data_in(1:20));
axis([0,20,-0.5,1.5]);
xlabel('Time');
ylabel('Amplitude');
title('Original data signal');
grid on;
subplot(324);
plot(t(1:20),data_out(1:20));
axis([0,20,-0.5,1.5]);
xlabel('Time');
ylabel('Amplitude');
title('output signal at differential demodulator');
grid on;
%PN SEQUENCE GENERATOR FOR USER 1
sreg=[1,0,1,0,1];
for i=1:31
n=sreg(1)+sreg(4);
if mod(n,2)==1
s=1;
else
s=0;
end
if sreg(1)==1
cseq1(i)=1;
else
cseq1(i)=-1;
end
for k=1:4
sreg(k)=sreg(k+1);
end
sreg(5)=s;
end
%PN SEQUENCE GENEROTOR FOR USER 2
for i=1:31
n=sreg(1)+sreg(2)+sreg(3)+sreg(4);
if mod(n,2)==1
s=1;
else
s=0;
end
if sreg(1)==1
48. 42
cseq2(i)=1;
else
cseq2(i)=-1;
end
for k=1:4
sreg(k)=sreg(k+1);
end
sreg(5)=s;
end
%PN SEQUENCE GENERATOR FOR USER 3
for i=1:31
n=sreg(1)+sreg(2)+sreg(4)+sreg(5);
if mod(n,2)==1
s=1;
else
s=0;
end
if sreg(1)==1
cseq3(i)=1;
else
cseq3(i)=-1;
end
for k=1:4
sreg(k)=sreg(k+1);
end
sreg(5)=s;
end
%CODE FOR GENERATING USER 2 DATA
for i=1:10000
ot=randint;
if ot==0
data2(i)=-1;
else
data2(i)=1;
end
end
for i=1:31
c(i)=1;
end
arr=data2'*c;
arr=arr';
arr2=reshape(arr,1,[]);
figure(1);
subplot(322);
psd(arr2);
title('Narrow band signal for user2');
%CODE FOR GENERATING USER 3 DATA
for i=1:10000
ot=randint;
if ot==0
49. 43
data3(i)=-1;
else
data3(i)=1;
end
end
for i=1:3
c(i)=1;
end
arr=data3'*c;
arr=arr';
arr3=reshape(arr,1,[]);
subplot(323);
psd(arr3);
title('Narrow band signal for user3');
%CODE FOR GENERATING USER 1 DATA
for i=1:10000
ot=randint;
if ot==0
data1(i)=-1;
else
data1(i)=1;
end
end
for i=1:31
c(i)=1;
end
arr=data1'*c;
arr=arr';
arr1=reshape(arr,1,[]);
subplot(321);
psd(arr1);
title('Narrow band signal for user 1');
%SPREADING USER 1 NARROWBAND DATA
j=1;
for i=1:310000
arr1(i)=arr1(i)*cseq1(j);
j=j+1;
if (j==32)
j=1;
end
end
subplot(324);
psd(arr1);
title('Wide band signal for user 1 the spread signal');
%SPREADING OF USER 2 NARROWBAND DATA
j=1;
for i=1:310000
arr2(i)=arr2(i)*cseq2(j);
j=j+1;
50. 44
if (j==32)
j=1;
end
end
subplot(325);
psd(arr2);
title('Wide band signal for user 2 the spread signal');
%SPREADING OF USER 3 NARROWBAND DATA
j=1;
for i=1:310000
arr3(i)=arr3(i)*cseq3(j);
j=j+1;
if (j==32)
j=1;
end
end
subplot(326);
psd(arr3);
title('Wide band signal for user 3 the spread signal');
%INTERFERENCE CODE
arr=arr2 + arr3;
figure(2);
subplot(321);
psd(arr1);
hold on;
[p,f]=psd(arr);
plot(f,10*log10(p),'g');
title('The wideband inteference with the users desired data');
%DESPREAD SIGNAL WITH USER 1 DATA
for i=1:10000
d(i)=1;
end
b=d'*cseq1;
b=b';
cs=reshape(b,1,[]);
ar1=arr1.*cs;
subplot(322);
psd(ar1);
title('Narrow band signal for user 1 after despreading');
%DESPREAD OF INTERFERENCE AT THE RECEIVER
ar=arr.*cs;
subplot(323);
psd(ar);
title('interference remain wideband after despreading');
grid on;
ar2=arr2.*cs;
subplot(324);
psd(ar2);
title('Uncorrelated data 2 signal with user 1 PN sequence')
51. 45
ar3=arr3.*cs;
subplot(325);
psd(ar3);
title('Uncorrelated data 3 signal with user 1 PN sequence');
%DESPREAD OF USER 2 DATA
for i=1:10000
d(i)=1;
end
b=d'*cseq2;
b=b';
cs=reshape(b,1,[]);
ar2=arr2.*cs;
subplot(326);
psd(ar2);
title('Narrow band signal for user 2 after despreading');
r