• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
My Undergraduate Thesis
 

My Undergraduate Thesis

on

  • 1,209 views

My undergraduate thesis titled "BER comparison of walsh-hadamard code and gold code in DS-CDMA communication"

My undergraduate thesis titled "BER comparison of walsh-hadamard code and gold code in DS-CDMA communication"

Statistics

Views

Total Views
1,209
Views on SlideShare
1,208
Embed Views
1

Actions

Likes
1
Downloads
52
Comments
0

1 Embed 1

http://www.docshut.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    My Undergraduate Thesis My Undergraduate Thesis Document Transcript

    • BER PERFORMANCE COMPARISON OF WALSH-HADAMARD CODE AND GOLD CODE IN DS-CDMA COMMUNICATION.SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR AN AWARD OF BACHELOR OF SCIENCE (BSc) DEGREE IN ELECTRONIC & ELECTRICAL ENGINEERING BOJESOMO ALABI SAKIRUDEEN EEG/2006/048 JANUARY 2012 i
    • CERTIFICATIONI hereby certify that the content of this report is a representation of the work done by BOJESOMOAlabi Sakirudeen in partial fulfillment of the requirements for the degree of Bachelor of Scienceunder my supervision in the Department of Electronic and Electrical Engineering of the ObafemiAwolowo University, Ile-Ife.________________________ _______________________ Mr. A. A. Fisusi DATE SUPERVISOR ii
    • DEDICATIONThis concise report is dedicated to ALLAH (Subuhana Watahala) for HIS infinite mercyand my parents for their support towards the realization of the program. iii
    • ACKNOWLEDGEMENTI set out to learn and my thirst for knowledge was quenched by the help of people ofsubstance whose effort cannot be fully appreciated by the words of mouth.It gives meimmense pleasure to express my deep sense of gratitude to my supervisor Mr AbimbolaFisusi for his invaluable guidance, motivation, constant inspiration and above all his everco-operating attitude enabled me in bringing up this thesis in the present elegant form.I am extremely thankful to Prof. O. Osasona, Head, Department of Electronic &Electrical Engineering and all members of Electronic & Electrical EngineeringDepartment for providing all kinds of possible help and advice during the course of thiswork.It is a great pleasure for me to acknowledge and express my gratitude to my parent fortheir understanding, untainted support and endless encouragement during my study.I am greatly thankful to all the staff members of the department and all my well wishers,classmates and friends for their inspiration and help.My special thank also goes to my project partner, Popoola Ebenezer ;who through hiscontribution made this research a reality.Lastly I sincerely thank all those who have directly or indirectly helped me with the workreported herein. iv
    • Table of ContentTitle page iCertification iiDedication iiiAknowledgement ivTable of Content vList of Acronym viList of Figure viiList of Table viiiList of Plate ixAbstract xChapter 1 INTRODUCTION 11.1 Background 11.2 Objectives of Study 21.3 Scope of Study 2Chapter 2 LITERATURE REVIEW 32.1 Spread Spectrum 32.2 Direct Sequence Spread Spectrum 82.3 Spreading Codes 102.3.1 Pseudonoise Sequence 122.3.1.1 Properties of M-sequences 132.3.2 Gold Sequences (Codes) 142.3.3 Walsh codes 162.4 Channel Impairment 182.5 Bit Error Rate(BER) Performance 19Chapter 3 METHODOLOGY 223.1 Message Generation 22 Spreading Sequence Generation and3.2 Spreading 223.2.1 Gold Sequence Generation 223.2.1.1 M-Sequences 223.2.2 Walsh Code Generation 273.3 Modulation and Channel Modeling 293.4 Receiver Modeling 293.5 Correlation Properties 31Chapter 4 RESULTS 324.1 Correlation Analysis 324.2 BER Performance Analysis 324.3 Challenges Encountered 42Chapter 5 CONCLUSION 43 v
    • Reference 45Appendix Matlab Codes used in the report 48 vi
    • List of AcronymsBER Bit Error RateBPSK Binary Phase Shift KeyingCDMA Code Division Multiple AccessDS-CDMA Discrete Sequence Code Division Multiple AccessDS-SS Direct Sequence Spread SpectrumFDMA Frequency Division Multiple AccessGMSK Gussian Minimum Shift KeyingGP Processing GainGUI Graphic User InterfaceICI Inter Channel InterferenceLPD Low Probability of DetectionLPI Low Probability of InterceptLPPF Low Probability of Position FixLPSE Low Probability of Signal ExploitationML Maximal-lengthMUI Multi User InterferencePN PseudonoisePTP Point to PointQPSK Quadrature Phase Shift KeyingSNR Signal to Noise RatioSS Spread SpectrumTDMA Time Division Multiple AccessWGN White Guassian Noise vii
    • List of FiguresFig 2.1 General Model of Spread Spectrum Digital Communication SystemFig:2.2 Transmitter and receiver model of CDMA systemFig 2.3 Generation of a Gold Code setFig 3.1 message sequence of length 20Fig 3.2 Gold code generation shift register implementation.Fig 3.3 Gold code simulation outputFig 3.4 walsh code simulation outputFig 3.5 Block diagram of a Coherent BPSK demodulatorFig 4.1 Correlation Properties of Walsh and Gold CodesFig 4.2 Performance of Gold Codes over AWGN ChannelFig 4.3 Performance of Walsh Codes over AWGN ChannelFig 4.4 Performance of Gold and Walsh Codes over AWGN ChannelFig 4.5 Performance of Gold Codes over Rayleigh ChannelFig 4.6 Performance of Walsh Codes over Rayleigh ChannelFig 4.7 Performance of Gold and Walsh Codes over Rayleigh ChannelFig 4.8 Multi-user Gold and Walsh Code over AWGN ChannelFig 4.9 Multi-user Gold and Walsh Code over Rayleigh Channel viii
    • List of TablesTable 2.1 Table of m_sequences for various shift register stage ix
    • List of PlatesPlate A.1 Message sequence generationPlate A.2 Gold Code GenerationPlate A.3 M_Sequence Calculating FunctionPlate A.4 Walsh code generating functionPlate A.5 Walsh Code generating ScriptPlate A.6 Correlation Properties of Spreading CodesPlate A.7 BER Performance over AWGN ChannelPlate A.8 Multi-User BER Performance over AWGN ChannelPlate A.9 BER Performance over Rayleigh ChannelPlate A.10 Multi-User BER Performance over Rayleigh Channel x
    • ABSTRACTCode Division Multiple Access CDMA is a technology for digital transmission of radio signal intelecommunication systems. In this technology, multiple users can transmit their datasimultaneously over a channel using same bandwidth. Each user is assigned a unique code fortransmission. There are different codes used for this purpose. The types of code used includePN(Pseudonoise) sequence, Gold sequence and Walsh code generated using MatlabProgramming. Using Walsh code or Gold code, data was transmitted to receiver over AdditiveWhite Guassian Noise (AWGN) and Fading channels. Here, transmitted data is generatedrandomly using Matlab function. During transmission, modulation is done for both codes forsingle user and multi users over AWGN and/or Multipath(frequency selective) channel .Various spreading codes has been simulated for a digital communication system over AWGNand Multipath Fading Channnel. Evaluation of m-sequences obtainable from a given number ofshift register stage and correlation of the sequences compared using matlab simulation. Bit errorrate (BER) performance of both codes(Gold and Walsh) considered over AWGN as well asRayleigh Channel. xi
    • 1 CHAPTER 1 INTRODUCTION1.1 BackgroundWireless personal communications has grown over the last few years and the method ofcommunication known as spread spectrum has gained a great deal of prominence. Spread spectruminvolves spreading the desired signal over a bandwidth much larger than the minimum bandwidthnecessary to send the signal. It was originally developed by the military as a method ofcommunications that is less sensitive to intentional interference or jamming by third parties, but hasbecome very popular in the realm of personal communications recently. Also, as technologyadvances the security system of wireless communication need to be upgraded to avoid unintendedreception, hence spread spectrum techniques can be utilized in Code Division Multiple Access(CDMA) to create multi-user communications systems with very good security of information. Theidea behind spread spectrum is that individual pseudorandom codes called user signatures aregenerated at the transmitter for each user with which his/her message is spreaded in other to reducethe effect of multipath and multi-user/ multi-access interference (MAI). The length of the usersignature strongly determines the level of security of the message signal, the longer the better.This report will cover the details behind the method of Spread Spectrum communications, as wellas analyze two main types of coding systems used in Direct-Sequence Spread Spectrum (DS-SS),Gold code and Walsh-Hadamard code in terms of their interference, jamming and bit error rateperformances.
    • 21.2 Objective of StudyThe aim of this report is to give a general comparison between the bit error rate performance ofGold code and Walsh-Hadamard coding system in Direct Sequence Code Division Multiple AccessTechnique over additive white Gaussian noise (AWGN) channel and multipath fading channels.1.3 Scope of StudyThis report intends to give an appreciable light on DS-CDMA technology, its importance intelecommunication and its advantages. Also, it will discuss spread spectrum, two methods of codingwhich are Gold code and Walsh-Hadamard code: how they are generated both theoretically andusing Matlab programming language. Most importantly, this will lead to a comparison in the biterror rate performance of the two coding technique taking into consideration the various source ofchannel impairment from the environment such as Gaussian white noise, jamming, interferenceand also multipath fading .
    • 3 CHAPTER 2 LITERATURE REVIEWSoren(2010) studies various Spread Spectrum coding techniques in terms of their usage, generationand resistance to jamming and interference. The study includes the effect of AWGN and Fadingchannel with the simulated result of the Bit Error Rate Vs SNR done using Matlab(theoretical). Theresults of the work indicate that after certain SNR, the bit error rate becomes zero. The BERTool, asimulink model in Matlab is used to analyze the BER of various coding techniques with soft or harddecoding. Result of this tool is majorly a theoretical result using the various theoretical expressionsrelating the BER with other parameters of interest. Prapeep and Baskhar(2010) studied theperformance of a wideband CDMA system in the presence of Lognormal fading . The widebandCDMA system, modeled using Gaussian Approximation is analyzed on a slow fading Lognormalchannel and simulated results are obtained for Bit Error Rate (BER) versus signal-to-noise ratio(SNR in dB) for a fixed value of channel. Bellcore(1996) describe a number of important multi userdetectors for DS-CDMA . The article discuss the conventional DS-CDMA single user detector,accounting for the need for multiuser detectors such as linear detectors, and Minimum Mean-Squared Error (MMSE) Detector to combat the effect of multiple access interference.2.1 Spread SpectrumSpread spectrum (SS) techniques are methods in which energy generated at a single frequency isspread over a wide band of frequencies. This is done to achieve transmission that is robust againstchannel impairments, and to be able to resist natural interference or jamming and to prevent hostiledetection. These techniques were developed by military guidance and communication systems. The
    • 4techniques are said to be spread spectrum if transmission bandwidth is much greater than minimumbandwidth needed to transmit information. A system could achieve spread spectrum if it fulfills thefollowing requirements: Signal occupies bandwidth much in excess of the minimum bandwidth necessary to send information. Spreading is accomplished by means of spreading code signal which is independent of the data. At the receiver, de-spreading is accomplished by the correlation of the received spread signal with a synchronized replica of the spreading signal used to spread information.The SS signal is able to resist interference and jamming. The interference rejection capability ofspread spectrum is achieved by: Multiplying signal by spreading signal which spreads the signal bandwidth. Multiplying signal by spreading signal twice recovers original signal. Desired signal gets multiplied twice and interference gets multiplied only once, and that helps in signal recovering as the noise and information would not be at the same frequencies.The increase in bandwidth above the minimum bandwidth in a spread spectrum system can bethought of as applying gain to the desired signal with respect to the undesirable signals (Proakis,2001). This is called the processing gain GP defined as 2.1Where BWRF is the bandwidth that the signal has been increased, and BWinfo is the minimumbandwidth necessary to transmit the information or data signal. Processing gain can be thought of as
    • 5the improvement over conventional communication schemes due to the spreading done on thesignal.Often, a better measure of this gain is given by the jamming margin, MJ(dB)=GP(dB)– SNRmin 2.2Which indicates the amount of interference protection offered before the signal is corrupted. Figure2.1 highlight the key characteristics of any spread spectrum system.Spread spectrum techniques are implemented where transmission has to be operated withoutinformation being detected by anyone other than the intended receiver. Communications systemsdesigned for this task are known as low probability of detection ( LPD ) or low probability ofintercept filter (LPI). SS systems that are designed to present LPI may also be designed to exposelow probability of position fix (LPPF), thus even if the presence of the signal may be perceived,direction of the transmitter is difficult to pinpoint. They can further be made to expose lowprobability of signal exploitation (LPSE), meaning that identification of source is difficult todetermine. The goal of these systems is to use minimum signal power and optimum signalingscheme that results in minimum probability of being detected, intercepted or demodulated. SS useswideband, noise-like signals and because the signals are noise-like, they are hard to detect. Further,Spread Spectrum signals are harder to jam than narrowband signals (Soren, 2010).Spread spectrum techniques use code signal to perform spreading and de-spreading, and thesespreading code signals are called pseudorandom or pseudo noise codes. They are calledpseudorandom because they are not random at all; they are deterministic periodic signals that areknown to both transmitter and receiver. Though these signals are said to be deterministic, they holdrandomness properties and they appear random to unauthorized users. The spreading function isachieved through the use of a pseudorandom noise sequence (PN sequence).
    • 6Input Channel Modulator Channel De- Channel Outputdata encoder modulator decoder data e Pseudonoise Pseudonoise ee generator generator Fig 2.1 General Model of Spread Spectrum Digital Communication System
    • 7The data signal is combined with the PN sequence such that each data bit is encoded with several ifnot all the bits in the PN sequence. In order to achieve the same data rate as was desired beforespreading, the new data must be sent at a rate equal to the original rate multiplied by the number ofPN sequence bits used to encode each bit of data. This increase in bandwidth is the processing gain,which is a measure of the noise and interference immunity of this method of transmission. Thethree major types of interference that can arise when using wireless networks are: 1. Noise, 2. Intentional interference from a jammer(Garg, 2007) or other source trying to disrupt Communication. 3. Unintentional interference from other users of the same frequency band.Noise can be considered as background white Gaussian noise (WGN), and can be said to haveconstant power spectral density. Since the noise is white, the spreading of the bandwidth does nothave much of an effect here. The noise power is constant over the entire bandwidth, so increasingthe bandwidth actually lets more noise into the system, which might be seen as detrimental.However, this is not really a problem because only the wanted signal is spreaded twice which needsto being unspread while the noise will be spread at the receiver reducing the captured noise only asection within the filter bandwidth.Intentional interference comes from sources who are actively trying to corrupt the datatransmission by sending power transmissions in the same band as the intended transmission. Thebig difference between intentional interference and noise is that intentional interference is, by itsvery nature, a finite power signal, since it must be transmitted from a real source. Thus thespreading performed on the data signal allows the signal to “hide” itself in a larger bandwidth,
    • 8forcing the jamming signal to distribute its power over this new much larger bandwidth, and thusintuitively diminishing the effect that the jamming signal has on the data signal.The third major source of signal corruption comes from unintentional interference due to otherusers using the same frequency band, and here, the system uses the PN sequence and spreadspectrum technique of CDMA to combat this type of interference. In a wireless communicationsnetwork, all the signals propagate through the air by way of electromagnetic waves, thus there is noway to ensure that one user will receive only the signal he or she desires; that user will receive allthe signals being sent in that band. By giving each of the signals to be transmitted in the frequencyband its own code (CDMA), the effect of these other signals can be reduce at the receiver (when thereceiver correlates the input signal it receives with the code of the transmission it wants to receive,only the desired signal will Remain).Spread spectrum techniques can be classified into three main categories namely Direct sequence spread spectrum Frequency hopping spread spectrum and Time hopping spread spectrum and the combination of two or the three techniques.2.2 Direct Sequence Spread SpectrumDirect sequence spread spectrum is a technique used in CDMA where each bit of the original signalis represented by multiple bits in the transmitted signal, using a spreading code.Direct sequence (DS) CDMA is used in the third-generation mobile communication standard toprovide high capacity and high transmission rate over conventional schemes such as frequencydivision multiple access and time-division multiple access. However, due to inherent widebandwidth of the spread spectrum systems, severe frequency selective fading degrades system
    • 9performances. When transmitting data in the downlink, DS-CDMA relies on the low or zerocorrelation between the spreading codes to separate the different user signals. However, it suffersfrom inter channel interference (ICI) which destroys the orthogonality among users, giving rise toMulti User Interference (MUI) (Sadara and Bikash, 2009) which limits the capacity of the system(Selvi and Ramar, 2009). Since the multi user interference is in actual fact caused by the multipathchannel, it can be suppress by linear chip level equalization, followed by correlation with the user‟sspreading code (Soren, 2010). At the transmitter, the information is encoded using codes. Theencoded information is then transformed into a data modulated symbol sequence with a basebandmodulator. The modulated symbol sequence is spread in time domain by a chip sequence oforthogonal code generator, usually Walsh code or PN sequence. The information is shaped andpassed through a transmitter for transmission.At the receiver, the information is multiplied with the chip sequence by the correlators in the rakereceiver. The information is then summed and multiplied by locally generated spreading code. Theinformation is demodulated and decoded and original data can be recovered. In practice, BPSKmodulation scheme is used which can be represented as follows, A d(t) cos(2 ) 2.3WhereA=amplitude of signalfc = carrier frequencyd(t)=the discrete function that takes on the values +1 for one bit time if the corresponding bit streamis 1 and the value -1 for one bit time if the corresponding bit in the bit stream is 0.
    • 10To produce the DSSS signal, we multiply the BPSK signal in (2.3) by c(t) which is the PN sequencetaking on the values of +1 and -1. 2.4At the receiver, PN sequence is multiplied with the received waveform to recover the exacttransmitted wave. 2.5Now, if we allow both noise and a jamming signal sj(t) with finite power distributed evenly acrossthe frequency band, the received signal at the input to the receiver, Y(t), is 2.6Where n(t) represent additive white noise.Now, when the signal is correlated with the PN sequence, the data signal portion of y(t) is de-spread giving us the original d(t). However, the effect of multiplying sj(t) and n(t) with the signal ineffect spreads the signal out to have bandwidth fc, whereas the signal d(t) now has returned to itsoriginal frequency. So a filter following the signal correlation can recapture the signal d(t) with areduced amount of jamming power. The jamming power that can pass through the filter is nowdecreased by a factor fc/f, which was introduced earlier as the processing gain Gp, i.e.Gp=(BWRF/BWinfo)=(fc/f).2.3 Spreading CodesIn DS-CDMA system, for de-spreading operation, the received data should be multiplied with thesame code in the receiver. So the other user codes in the same frequency band must be uncorrelated
    • 11Transmitter Model:data Channel Data Chip coding modulation Shaping Time domain spreadingReceiver Model: Fig:2.2. Transmitter and receiver model of CDMA system
    • 12with the desired user code. For this reason the DS-CDMA codes have to be designed so as to possesvery low cross-correlation (Rusyn and Riley, 2010; Selvi and Ramar, 2009; Sivanesskumar andSukanesh, 2009).Autocorrelation shows the measure of similarity between the code and its cyclic shifted copy.Because of this reason, the codes that have the best properties of autocorrelation have frequentlybeen used in communication systems (Kandar and Sarkar, 2009). The auto-correlation function canbe expressed as below 2.7Cross-correlation is the measure of similarity between two different codes. In other words cross-correlation describes the interference between codes An and Bn . 2.8Where an and bn are the elements of two different codes and have period N (Dinan and Jabbari,1998).2.3.1 Pseudonoise (PN) SequenceA PN sequence is a periodic binary sequence of 1‟s and 0‟s. It has some characteristics that aresimilar to random binary sequences (having equal # of 0‟s and 1‟s), very low correlation betweenany two shifted version of the sequence and low cross-correlation between any two sequences.Pseudo-random sequence is not random (deterministic) but it looks randomly for the user whodoesn‟t know the code.
    • 13PN sequence is generated by a feedback shift register regulated by a single timing clock. Binarysequences are shifted through the shift registers and the output of the various stages are logicallycombined and feedback as the input to the first stage.When the feedback logic consists of exclusive-OR gates, the shift register is called a linear and insuch a case, the zero state is not permitted. Therefore the period of a PN sequence produced by alinear m-stage shift register cannot exceed N= 2m – 1. When a sequence of period 2m -1 generated,it is called a maximal-length (ML) sequence. For a given stage shift register, the number of possiblem-sequences is given by 2.9 2.10Where (N) is the Euler totient function which represents the number of integers less than N whichare relatively prime (pk) to it (Dinan and Jabbari, 1998; Utlaut 1978). Below is a table of m-sequences for some shift register stages.2.3.1.1 Properties of M-sequences1 Balance Property: An m-sequence has 2m-1 ones and 2m-1-1 zeros.2 Run Property: Here, the run represents a subsequence of identical symbols (1s or 0s) within one period of the sequence. The length of this subsequence is the length of the run. Among the runs of 1s and 0s in each period of a maximum-length sequence, one half the run of each kind are of length one, one-fourth are length two, one-eighth are of length three, etc. For a
    • 14 maximum-length sequence generated by a linear feedback shift register of length m, the total number of runs is (N+1)/2 where N=2 m-1.3 Correlation Property: The periodic autocorrelation of a +1 m-sequence is R( ) = 1 =0 mod(N) 2.11 Otherwise e eWelch (1974) obtained the following lower bound on the cross-correlation between any pair of ebinary sequences of period N in a set of M sequences as2.3.2 Gold Sequences (Codes)Gold codes can be generated by modulo-2 addition of two maximum-length sequences with thesame length. The code sequences are added chip by chip by synchronous clocking with thegenerated code having the same length as the m-sequences which are added together.Consider an m-sequence represented by a binary vector a of length N, and a second sequence a’obtained by sampling every qth symbol of a. the second sequence is called the decimation of thefirst and denoted by a’=a[q] . a’=a[q] will has period N (m-sequence) if and only if gcd (N,q)=1,where „gcd‟ denotes the greatest common divisor. Any pair of m-sequence having the same lengthN and can be related by a’=a[q] for some q are called preferred pair obeying the followingconditions. 1. N ≠ 0 (mod4) 2. q is odd and either q=2k + 1 or q=22k – 2k + 1 3.
    • 15 Table 2.1: Table of m_sequences for various shift register stage Number of m-Number of shift register stages Sequence length N sequences 2 3 1 3 7 2 4 15 2 5 31 6 6 63 6 7 127 18 8 255 16 9 511 48 10 1023 60
    • 16The set of Gold codes for this preferred pair of m-sequence is defined by{a,a’,a+a’,a+Da’,a+D2a’, … ,a+DN-1 a’} where D is the delay element. An illustration ofgenerating a Gold set is shown in figure 2.3.The N+1 elements of a Gold codes sets have the property that any pair of codes in the set have athree-valued cross-correlation. In this set, except the sequences a and a‟, the rest are not m-sequences. Hence, their autocorrelation functions are not two-valued, but it takes the same threevalues as cross-correlation. The cross correlation spectrum between a preferred pair is three-valued ,where those three values are –t(n), -1, t(n)-2 (Stallings, 2002) Where 2.132.3.3 Walsh codesThe Hadamard code, named after Jacques Hadamard, is a system used for signal error detection andcorrection. It is one of the family of [2n, n + 1, 2n − 1] codes. Especially for large n it has a poorrate but it is capable of correcting many errors. Hadamard codes can be considered as a special caseof Reed–Muller codes. In particular, first order Reed–Muller code is equivalent to Hadamard codes.These Hadamard codes are called Walsh codes.Walsh functions are generated by mapping codeword rows of special square matrices calledHadamard matrices. These matrices one row of all zeros, and the remaining rows each have equalnumber of ones and zeros. Walsh functions can be constructed for block length N=2 n. The
    • 17 [5 3] seq1:N=25 - 1=31 chips 1 2 3 4 5 Gold sequence 1 2 3 4 5 [5 4 3 2] seq2:N=25 - 1=31 chipssequence 1 1111100011011101010000100101100sequence 2 11111001001100001011010100011100 shift XOR 00000001111011011111011101000101 shift XOR 0000101010111100001010000110001…30 shift XOR 1000010001000101000110001101011 Fig 2.3 Generation of a Gold Code set
    • 18Hadamard matrix of desired length can be generated by the following recursive procedure: 2.14Where N is a power of 2 and the overscore denotes the binary complement of the bits in the matrix.In practice, Walsh sequences provide zero cross correlation when there is zero offset between thesequences, but in order to provide zero offset; all users have to be synchronized in time(Stallings,2002) .2.4 Channel ImpairmentThis refers to the contribution of the channel through which the information carrying signal passesfrom the transmitter to the receiver.Because of the analog nature of the channel, the binary codeword generated via spreading codes arealways modulated using any of the digital modulation techniques. Amplitude Shift Keying ASK Frequency Shift Keying FSK Phase Shift Keying PSKBPSK, an example of PSK is mostly used for Spread Spectrum application due to its resistance tofrequency selective fading (Freeman, 2004; Paizi, 2006).Small-scale fading or fading is used to describe the rapid fluctuations of the amplitudes, phases ormultipath delays of a radio signal over a short period of time or travel distance, so that large-scalepath loss effects may be ignored. Fading is caused by interference between two or more versions of
    • 19the transmitted signal which arrive at the receiver at slightly different times. These waves, calledmultipath waves, combine at the receiver antenna to give a resultant signal which can vary widelyin amplitude and phase, depending on the distribution of the intensity and relative propagation timeof the waves and the bandwidth of the transmitted signal.Multipath in the radio channel creates small-scale fading effects. The three most important effectsare: Rapid changes in signal strength over a small travel distance or time interval. Rapid frequency modulation due to varying Doppler shifts on different multipath signals. Time dispersion (echoes) caused by multipath propagation delays.2.5 Bit Error Rate (BER) PerformanceBER is defined as source of performance measurement that specifies the number of bits corruptedor destroyed as they are transmitted from its source to destination. So, in order to improve theperformance of a system, BER should be minimum. There are several factors that affect BER whichinclude bandwidth, SNR, multiuser, multipath, transmission speed and transmission medium.Kumar et. al.(May 2011) investigated BER performance of CDMA cellular system based on IS-95standard in the presence of additive white Gaussian noise (AWGN) and interference. Theperformance is evaluated under two types of decision feedback receivers for the CDMA reverselink. These two feedback receivers are:(a) Hard decision Viterbi decoder in which coded bit is estimated based on Hamming Distancemethod and
    • 20(b) Soft decision Viterbi decoder in which Euclidean Distance method is used for coded bitestimation.From this comparison, the BER is found to be less with hard decision viterbi decoding as comparedwith Soft decision viterbi decoding.Ali et. al.(May 2011) evaluated the performance of Multi-Code CDMA using different code sets inAWGN and in multipath fading channels. Compared to AWGN channel, the performance of theMulti-Code system degrades drastically in multipath fading channel. This led to the proposal of aMulti-Code Multi-Carrier CDMA system which retains the variable data rate capability of theMulti-Code system and is robust to multipath fading like Multi-Carrier CDMA. The proposedsystem has significantly better BER performance to the original Multi-Code CDMA system andhence supports more users for the same BER in a fading channel. The rate adaptation algorithmproposed ensures that the average data rate traces the instantaneous channel condition and therebyimproves the overall capacity of the system. Paizi(2006) studied and identified the PSK-baseddigital modulation scheme (BPSK, QPSK or GMSK) that gives the best BER performance in amultipath fading environment using computer simulation. Essentially, ideal and worst casecommunication channel models were studied and simulation programs were written to simulate thechannels. Each PSK-based digital modulation understudy are modeled and simulated underdifferent channel conditions. Subsequently, a comparison study is carried out to obtain the BERperformance for each PSK-based transmission scheme under 1-path and 4-path multipath fadingconditions and to identify which modulation scheme gives best BER performance.The comparison study showed that BER for BPSK and Quadrature Phase Shift Keying(QPSK) aresimilar and they give the lowest BER under multipath fading. Nonetheless, Gaussian MinimumShift Keying(GMSK) BER is just slightly higher than that of BPSK and QPSK.
    • 21Krishna et. al.(2005) presents a single correlator RAKE receiver for direct sequence code divisionmultiple access (DS-CDMA) systems. Contrary to conventional RAKE receivers where; multiplecorrelators are used to de-spread the multipath signals and then to align and combine those signalsin a later stage before making a bit decision, the simplified receiver structure uses a single correlatorand single code sequence generator to recover the multipath. Modified Walsh-Hadamard codes areused for data spreading to provide better un-correlation properties for the multipath signals. Themain advantage of this receiver structure is that it requires only a single correlator and a codegenerator in contrary to the conventional RAKE receiver concept with multiple correlators. It isshown in results that the proposed receiver achieves better bit error rates in comparison with theconventional one for more than one multipath.Alouini et. al.(1998) investigated the exact BER analysis of binary DS-CDMA systems operatingover generalized frequency-selective fading channels using alternate representations of theGaussian Q-function and the Marcum Q-function. Simulated results are applicable to systemsemploying RAKE reception with coherent maximal-ratio combining as well as noncoherent anddifferentially coherent equal-gain combining. The analyses assume independent resolvable fadingpaths which are not necessarily identically distributed nor even distributed according to the samefamily of distributions. The proposed approach gives new analytical expressions for BER undervery general channel conditions, in addition to simplifying previously-known results bothanalytically and computationally.
    • 22 CHAPTER 3 METHODOLOGY3.1 Message GenerationInformation signals otherwise called message can either be analog or digital in nature depending onthe source. For instance, sound signals are analog while a pulse generated by pressing any key of acalculator is discrete. For the purpose of this study, a message signal was modeled as digital butrandomized using Matlab programming language. The result of simulation is as follow while thematlab code used is represented in plate A.1 (Appendix). 3.2 Spreading Sequence Generation and SpreadingThe spreading code generation includes the simulation of Gold and Walsh-Hadamard codesrespectively. In the course of their generation, the number of messages (users) was put toconsideration and message(s) spread by the code.3.2.1 Gold Sequence GenerationGold sequence is the exclusive-OR output of two PN sequence of maximum length. Using the shiftregister connection in fig. 3.2 below for the simulation with a single user, The Matlab codes (PlateA.2) generated the expected spreading code and codeword. 3.2.1.1 M-SequencesNot all shift register connections are of maximum length (N=2 m-1), where m is the shift registerstage. M-sequences are maximum length PN sequences generated by some connection of the shift
    • 23register and for an m-stage shift register; the number of possible m-sequences is given by theequation below (Ipatov, 2005).
    • 24message =0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 Fig 3.1 message sequence of length 20
    • 25 [5 3] seq1:N=25- 1=31 chips1 2 3 4 5 Gold sequence1 2 3 4 5 [5 4 3 2] seq2:N=25 - 1=31 chips Fig 3.2 Gold code generation shift register implementation.
    • 26PN1 1111100011011101010000100101100PN2 1111100100110000101101010001110Gold_code 0000000111101101111101110100010Message 1 1 0 1 0 0 1 1 0 1Codeword(bit1) 0 0 0 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 Fig 3.3 Gold code simulation output
    • 27 3.1 3.2Where pk is from the set of prime factors of N.For instance, for m=4, N=15, P=prime factors of 15( i.e factor(15)).Hence, P=factor(15)= {3, 5},Meaning, for m=2, we have 2 m_sequences using only two possible connections.The Matlab function that executed this is written in Plate A.3. 3.2.2 Walsh Code GenerationWalsh sequences can be taken from the rows or column of the Hadamard matrix which isorthogonal and symmetric. The Hadamard matrix has input [0,1] but for its simulation, it was bestto map [0,1] to [-1,1] domain.The Matlab program in plate A.4 is a function that generated m numbers of walsh code of order 2nby calling it with the syntax walsh (n,m,p) with p being a vector representing the required lines ofthe walsh matrix.Using the above function to generate a Walsh code to encode a 10 bit message and ploting theoutputs, the Matlab code in plate A.5 ensured and the output of the Matlab code was as follows;
    • 28Message 1 1 0 1 1 0 0 1 0 0Walshcode 10011001100110011001100110011001codeword(bit 1) 10011001100110011001100110011001 Fig 3.4 walsh code simulation output
    • 293.3 Modulation and Channel ModelingModulation is the transformation of the codeword into a form that is transferable over the channel.It entails impregnating the codeword sequence over a continuous wave. For the course of this study,BPSK modulation was employed over a Gaussian channel.The channel was modeled to be additive and interference was also considered for a multiuserchannel. Multipath propagation was modeled by delaying the transmitted signal by severalpropagation delays to account for the different time taken for the signals in reaching the receiver.The following codes were used for the simulation of two different messages encoder separatelywith gold and Walsh codes and transmitted separately over both additive white Guassian channelwith/without multipath. In addition, fading channel was also considered.3.4 Receiver ModelingThe received waveform is never the transmitted one due to the channel characteristic whichincludes; intentional/unintentional interference, channel noise as well as multipath propagation asthe case may be.The receiver was modeled as a coherent BPSK detector which includes Local oscillator multiplied by the incoming received signal in the product modulator Low-pass filter for filtering out the high frequency carrier for the envelope.This was followed by de-spreading with the spreading code which was then led to detection anddecision stage done by an integrator (this was implemented in the course of the simulation by thetrapezium rule over the bit period Tb) and the decision block respectively(Simon, 2001). A detailedblock diagram of a coherent BPSK demodulator is as shown below in figure 3.5.
    • 30 Coherent Detector Low-Received Decision Product power Say 1 v > 0wave rule Modulato filter Say 0 v < 0 r Local Oscillator Spreading code Fig 3.5 Block diagram of a Coherent BPSK demodulator
    • 313.5 Correlation PropertiesThe working efficiency of any spreading sequence is a function of its correlation ratio. The ratio ofthe maximum cross-correlation to the maximum auto-correlation should be very low for a bettercode. Cross-correlation is a measure of likelihood of interference between different code whileautocorrelation is measure of resistance to asynchronous nature of the channel or the link.Using 5-stage shift-register to generate 2 different gold codes and also generating 2 different walshcodes of order 25. The Matlab script in plate A.6 was used to plot both autocorrelation and crosscorrelation curve for both gold codes and walsh codes respectively.
    • 32 CHAPTER 4 RESULTS 4.1 Correlation Analysis After running several simulations, fig.4.1 proved Gold code to have better autocorrelation than Walsh code while the reverse was the case when their cross-correlation property was compared. 4.2 BER Performance AnalysisAfter observing the correlation properties, factors affecting the BER were taken into considerationsuch as SNR, multiuser (k=number of users), multipath (L=number of paths), coding technique(Gold and Walsh), code-length and transmission medium (Rayleigh fading channel as well asAWGN channel ) so as to compare the BER of both Gold and Walsh coding system which is themain purpose of this research.At first, a single user (k=1), multipath (L=3), for both AWGN and Rayleigh channel wasexperimented to give the result shown in fig. 4.2, 4.3 and 4.4 as well as fig. 4.5, 4.6 and 4.7respectively; which show various responses as the signature length was varied accordingly i.eincreasing the signature length reduces the BER also showing walsh code to be better whenconsidering the effect of multipath interference. The same process was carried on multi-user (k=2,4, 8 and 16) with other parameters been constant which gave results shown in fig. 4.8 and fig. 4.9(Matlab codes for the simulated results are presented in plates A.7, A.8, A.9 and A.10respectively.). This proves Gold code to be more robust when considering multi-user interference.
    • 33Fig4.1 Correlation Property of Walsh and Gold code.
    • 34Fig 4.2 Performance of Gold Codes over AWGN Channel
    • 35Fig 4.3Performance of Walsh Codes over AWGN Channel
    • 36Fig. 4.4Performance of Gold and Walsh over AWGN Channel
    • 37Fig. 4.5 Performance of Gold over Rayleigh Channel
    • 38Fig. 4.6 Performance of Walsh over Rayleigh Channel
    • 39Fig. 4.7 Performance of Gold and Walsh over Rayleigh Channel
    • 40Fig 4.8 Multi-user Gold and Walsh Code over AWGN Channel
    • 41Fig 4.9 Multi-user Gold and Walsh Code over Rayleigh Channel
    • 424.3 Challenges EncounteredSpread spectrum analysis is a very wide subject which requires diversified approach in its researchmethodology. Matlab programming is utilized in the course of this study for simulating real lifescenario of several discrete sequence code division multiple access analysis which includes; Spreading sequence and spreading Modulation Channel modelling Coherent demodulation and detection De-spreading Correlation and BER performance comparison of the spreading sequenceThese above listed terms pose several challenges in the course of the study including, Transformation of Expressions and block diagram into Matlab codes The limits of the Matlab programming environment limit the study to low stage shift register Implementation. Linking of the written codes to a Graphical User Interface GUI for better presentation. The time spent in compiling a block of code is much (e.g 2hrs) making debugging and recompiling process frustrating.
    • 43 CHAPTER 5 CONCLUSIONThis project as a whole has been able to show clearly the importance of spreading in CDMAcommunication especially in DS-CDMA where either Gold or Walsh sequence is used to spread theinformation. It has also shown the strength, weakness and application of the two coding systems ifsubjected to the same environmental and channel impairment such as jamming, interference inAWGN and multipath. The above statement was proved using the key tests for data communicationwhich are Correlation property (auto-correlation and cross-correlation) and Bit Error RatePerformance.After series of simulations the following points and comparison can be said assertively about Goldand Walsh coding system  Gold code has a high auto-correlation (an advantage) and low cross-correlation ( a disadvantage) property making it suitable for Multi-user CDMA communication while Walsh code has low auto-correlation (a disadvantage) and low cross-correlation (an advantage) which suits WCDMA communication.  Both coding systems have similar good performance with respect to AWGN and Rayleigh channel.
    • 44 Most importantly, comparing the BER performance, Gold codes can be said to have better performance considering multi-user interference while Walsh codes takes care of multi-path interference better.
    • 45 ReferencesAlouini, M., Simon, M. K. and Goldsmith, A. ‘A Unified Performance Analysis of DS-CDMASystems over Generalized Frequency-Selective Fading Channels’ IEEE Communication Magazine,August 1998, p. 8Ali, M. S., Islam, M. S., Hossain, M. A., Khalid, M. and Jewel, H. „BER Analysis of Multi-CodeMulti-Carrier CDMA Systems in Multipath Fading Channel‟ International Journal of ComputerNetworks & Communications (IJCNC) Vol.3, No.3, May 2011, pp. 178-191Bellcore, S. M. „Multi-User Detection for DS-CDMA Communications‟ IEEE Communication Magazine , October 1996Dinan, E. H. and Jabbari, B Spreading codes for Direct Sequence and Wideband CDMA cellular networks IEEE Communications Magazine, September 1998Freeman, R. L., „Telecommunication System Engineering‟, 4th edition, John Willey & Sons Inc.,2004Garg,V. K. „Wireless Communications and Networking‟, 1st edition, Elsevier Inc., 2007Haykin, S „Communication Systems‟, 4th edition, John Willey & Sons Inc., 2001Ipatov, V. P. „Spread Spectrum and CDMA: principles and applications‟, John Willey & . Sons, Inc., 2005Kandar, D. and Sarkar, C. K. „Simulation of Spread Spectrum Radar Using Rake at the Receiver end‟ Progress in Electromagnetic Research Letters Vol.7, 2009, pp. 35-40
    • 46Kumar, S., Tuteja, M. and Singh, R. „BER Performance Analysis of CDMA Reverse Link under AWGN Channel‟ International Journal of Computer Applications Vol. 21, No. 2, May 2011, pp. 11-14Krishna, K. M., Mitra, A. and Ardil, C. ‘A Simplified Single Correlator Rake Receiver for CDMACommunications’ World Academy of Science, Engineering and Technology, 2005, pp. 106-109Matlab R2009B, „A Production of Mathworks.comPaizi, W. F. „BER Performance Study of PSK-Based Digital Modulation Schemes in Multipath Fading Environment‟ Master Degree Thesis, Department of Electrical-Electronics & Telecommunication, University of Technology, Malaysia, 2006Prapeep, A. M. and Baskhar, V „Performance Analysis of Wideband CDMA System in a Lognormal Fading Channel‟ International Journal of Civil Engineering Research . Vol. 1, No. 1 , 2010, pp. 11-18Proakis, J. „Digital Communications‟, 4th edition, McGraw-Hill, 2001Rusyn, T. and Riley, T. „A Co-channel Interference Model for Spread Spectrum Technologies‟National Telecommunications and Information Administration Report, U. S. Department ofCommerce, June 2010Sadara, P. D. and Bikash, K. D. „Channel Estimation in Multicarrier Communication System‟, Graduation Degree Thesis, Department of Electronics & Communication Engineering ,National institute of technology ROURKELA , 2009Selvi, S. T. and Ramar, K. „Performance Evaluation of Multiuser Detection for Uplink Wireless Communications with various Multiple Access Schemes‟ Journal of Theoretical and Applied Information Technology Vol.1, No.1,2009, pp. 724-730
    • 47Sivanesskumar, S. and Sukanesh, R. „Performance Analysis of Multi-Carrier Code Division Multiple Access System under Clipping Noise‟ European Journal of Scientific Research Vol. 38 ,No. 4 , 2009, pp. 590-595Soren, M. P. „Spread Spectrum Analysis for CDMA System‟, Graduation Degree Thesis, Department of Electronics & Communication Engineering ,National institute of technology ROURKELA, 2010Stallings, W. „Wireless Communications and Networks‟, Prentice Hall, 2002Utlaut, |W. F. „Spread Spectrum: Principles and Possible Application to Spectrum Utilization andAllocation‟ ITU Telecommunication Journal, Vol. 45,1978, pp. 20-32Welsh, L. R. , „Lower Bound on the Maximum Cross-Correlation of Signals‟ IEEE Trans. Info. Theory, Vol. IT-20, May 1974, pp. 397-399
    • 48 APPENDIXMatlab Codes used in the report
    • 49%...........message signalgeneration..........%.........message=randsrc(1,20);for i=1:20 if message(i)==-1 message(i)=0; EndEndmessage=messagestairs([message message(20)]);axis([0 21 -1 2]);%............end of program……..Plate A.1 Message sequence generation
    • 50%.......this code generate the gold sequence and code word%...........n=5; % using 5 stage shift registerinitial_state=ones(1,n); %...initialregister state..... a=initial_state; c=initial_state; connected_registers1=[3]; connected_registers2=[4 3 2]; b1=connected_registers1; b2=connected_registers2; [~, m1]=size(connected_registers1); [~, m2]=size(connected_registers2); x=2^n-1; % ........length or period of the code PN1=zeros(1,x); for i=1:x temp=a(1,n); for k=1:m1 t=b1(1,k); temp=xor(a(1,t),temp); End PN1(1,i)=a(1,n); for j=2:n a(1,n+2-j)=a(1,n+1-j); End a(1,1)=temp; End PN2=zeros(1,x); for i=1:x temp=a(1,n); for k=1:m2 t=b2(1,k); temp=xor(a(1,t),temp); End PN2(1,i)=a(1,n); for j=2:n a(1,n+2-j)=a(1,n+1-j); End a(1,1)=temp; End Gold_code=xor(PN1,PN2); gold=Gold_code; Plate A.2 Gold Sequence Generation
    • 51 %...turning into -1 and 1 sequence........ for j=1:x if (Gold_code(j)==0) gold(i)=-1; End End %......message itself........... message=randsrc(1,10); me=message; for i=1:10 if message(i)==-1 me(i)=0; End end %............generated codeword...... codeword=kron(message,gold); code=codeword; for i=1:numel(codeword) if code(i)==-1 code(i)=0; End End me %...............the message itself before spreading....... [PN1;PN2;Gold_code] %........generating the PN sequence and Gold code code(1:31) %........the message after being spreaded (firstbit)......... subplot(3,1,1) stairs([me me(10)]) axis([1 11 -1 2]) title(message) subplot(3,1,2) stairs([Gold_code Gold_code(x)]) axis([1 32 -1 2]) title(gold code) subplot(3,1,3) stairs([code code(numel(code))]) axis([1 numel(code)+1 -1 2]) title(codeword) %..............end of program…………… Plate A.2 Gold Sequence Generation (Cont’d)
    • 52%........This function calculate the number of m_sequences obtainable with%........a given number of shift register stage.%........It can be called by m_sequences(n) written on the command%........prompt where n is the shift register statefunction nx=m_sequences(n)x=2^n-1;p=factor(x);k=numel(p);for i=1:k a=p(1,i); for j=1:k b=p(1,j); if (a==b && j~=i) p(1,j)=0; End EndEndEuler_x=x;for i=1:k if (p(1,i)~=0) Euler_x=Euler_x*(p(1,i)-1)/p(1,i); EndEndnx=Euler_x/n;%........End of function........... Plate A.3 M_Sequence Calculating Function
    • 53%..... This function generate m rows of walsh codes of order 2^n........%......It can be called by walsh(n,m,p)...................................function [walsh_output walsh_output1 x]=walsh(n,m,p)if (m==numel(p) && max(p)<=2^n)if m<2^nif n<=13h=-1;for i=1:n h=[h h;h -h];Endy=2^n;s=p;for i=1:mwalsh_set(i,:)=h(s(i),:);Endwalsh_set1=walsh_set;for i=1:m for j=1:y if(walsh_set(i,j)==-1) walsh_set1(i,j)=0; End EndEndwalsh_output=walsh_set;walsh_output1=walsh_set1;Else errordlg(please use shift register less than 14); Plate A.4 Walsh code generating function
    • 54 %.........genarating a set of 4 walsh codes of order 2^5...... walsh_codes=walsh(5,4,[2 3 4 5]); %.........using the third of the 4 codes generated for encodering... walsh_code=walsh_codes(3,:); %.........the message itself before encoding......... me=randsrc(1,10); %.........the codeword...... code=kron(me,walsh_code); %.........mapping all the variables from [-1,1] to [0,1] for ploting message=me; for i=1:10 if me(i)==-1 message(i)=0; End End codeword=code; for i=1:numel(code) if code(i)==-1 codeword(i)=0; End End walshcode=walsh_code; for i=1:numel(walshcode) if walshcode(i)==-1 walshcode(i)=0; End End %......ploting the output.................. subplot(3,1,1); stairs([message message(numel(me))]); axis([1 11 -1 2]); title(message); subplot(3,1,2); stairs([walshcode walshcode(numel(walshcode))]); axis([1 numel(walshcode)+1 -1 2]); title(walsh code); subplot(3,1,3); stairs([codeword codeword(numel(codeword))]); axis([1 numel(codeword)+1 -1 2]); title(codeword);Plate A.5 Walsh Code Generating Script
    • 55 walsh_codes=walsh(5,2,[2 3]);%calling the function walsh gold_codes=gold_pn(5,2 [2 3]);%calling the function gold_pn %..........autocorrelation ................ [g_auto g_at]=xcorr(gold_codes(1,:)); [w_auto w_at]=xcorr(walsh_codes(1,:)); %..........cross correlation............... [g_cross g_xt]=xcorr(gold_codes(1,:),gold_codes(2,:)); [w_cross w_xt]=xcorr(walsh_codes(1,:),walsh_codes(2,:)); %..........ploting the outputs............ subplot(2,2,1); plot(g_at,g_auto); axis([min(g_at) max(g_at) min(g_auto) max(g_auto)]); title(Autocorrelation plot of gold code); subplot(2,2,2); plot(w_at,w_auto); axis([min(w_at) max(w_at) min(w_auto) max(w_auto)]); title(Autocorrelation plot of walsh code); subplot(2,2,3); plot(g_xt,g_cross); axis([min(g_xt) max(g_xt) min(g_cross) max(g_cross)]); title(cross correlation plot of gold code); subplot(2,2,4); plot(w_xt,w_cross); axis([min(w_xt) max(w_xt) min(w_cross) max(w_cross)]); title(cross correlation plot of walsh code);Plate A.6 Correlation Properties of Spreading Codes
    • 56% Matlab code for BER Performance over AWGN Channel with% Varying length of of codes,% Gold or Walshhandles.coding=1:3;handles.user=1:2;handles.channel=1:2;handles.shift_stage=5:8;handles.current_coding=handles.coding(1);handles.current_user=handles.user(1);handles.current_channel=handles.channel(1);handles.current_shift_stage=handles.shift_stage(1);handles.snr=-10:2:20;handles.gber=[];handles.wber=[];for i_stage=1:numel(handles.shift_stage)n=handles.shift_stage(i_stage);wcodes=walsh(n,2,[2^(n-1) 2^n])/sqrt(2^n);gcodes=gold_pn(n,2,[2^(n-1) 2^n-3])/sqrt(2^n-1);user1tx=randi([0 1],1,3000);handles.usertx=user1tx; user1=user1tx; u1=real(pskmod(user1,2)); gtx1=kron(u1,gcodes(1,:)); wtx1=kron(u1,wcodes(1,:)); %........the channel......... handles.g_s_user=gtx1; handles.w_s_user=wtx1; handles.g_s_user=modulate(handles.g_s_user,900000000,3000000000,fm); handles.w_s_user=modulate(handles.w_s_user,900000000,3000000000,fm); %....path consideration........ %......multipath.......handles.g_ber=zeros(numel(handles.snr),1);handles.w_ber=zeros(numel(handles.snr),1);for i_snr=1:numel(handles.snr) %.... Adding noise g_s_ctx=awgn(handles.g_s_user,handles.snr(i_snr),measured); w_s_ctx=awgn(handles.w_s_user,handles.snr(i_snr),measured);Plate A.7 BER Performance over AWGN Channel
    • 57g_out=[]; w_out=[]; for ii=1:3000 %.....multipath g_s_path1=g_s_ctx(1+(ii-1)*(2^n-1):ii*(2^n-1)); g=g_s_path1; g_s_path2=[zeros(1,3) g(4:(2^n-1))]; g_s_path3=[zeros(1,5) g(6:(2^n-1))]; w_s_path1=w_s_ctx(1+(ii-1)*(2^n):ii*(2^n)); w=w_s_path1; w_s_path2=[zeros(1,3) w(4:(2^n))]; w_s_path3=[zeros(1,5) w(6:(2^n))]; %......FM Demodulation............... g_s_crx=demod(g_s_path1,900000000,3000000000,fm); gm_s_crx1=g_s_crx; gm_s_crx2=demod(g_s_path2,900000000,3000000000,fm); gm_s_crx3=demod(g_s_path3,900000000,3000000000,fm); w_s_crx=demod(w_s_path1,900000000,3000000000,fm); wm_s_crx1=w_s_crx; wm_s_crx2=demod(w_s_path2,900000000,3000000000,fm); wm_s_crx3=demod(w_s_path3,900000000,3000000000,fm); %....the receiver.............. %.....multipath detection..... %......rake receiver despreader operation.......... gm1_s_rx=gm_s_crx1.*gcodes(1,:); wm1_s_rx=wm_s_crx1.*wcodes(1,:); gm2_s_rx=gm_s_crx2.*[zeros(1,3) gcodes(1,4:(2^n-1))]; wm2_s_rx=wm_s_crx2.*[zeros(1,3) wcodes(1,4:(2^n))]; gm3_s_rx=gm_s_crx3.*[zeros(1,5) gcodes(1,6:(2^n-1))]; wm3_s_rx=wm_s_crx3.*[zeros(1,5) wcodes(1,6:(2^n))]; gm=gm1_s_rx; wm=wm1_s_rx; Plate A.7 BER Performance over AWGN Channel (cont’d)
    • 58 %....integrate and sum......... %...........+.............. %........PSK demodulation....... handles.gm_rx=floor(2*sum(gm)-(gm(1)+gm(2^n-1))); handles.wm_rx=floor(2*sum(wm)-(wm(1)+wm(2^n))); handles.gm_rx=pskdemod(handles.gm_rx,2); handles.wm_rx=pskdemod(handles.wm_rx,2); %...picking detected bit output g_out=[g_out handles.gm_rx]; w_out=[w_out handles.wm_rx]; End %....correlating output with input for BER Calculation g_count=sum(kron(ones(1,1),user1tx)==g_out); w_count=sum(kron(ones(1,1),user1tx)==w_out); %....BER Calculation........ handles.g_ber(i_snr,:)=(3000*ones(1,1)-g_count)/3000; handles.w_ber(i_snr,:)=(3000*ones(1,1)-w_count)/3000;Endhandles.gber=[handles.gber handles.g_ber];handles.wber=[handles.wber handles.w_ber];Endsemilogy(handles.snr,handles.gber,-*);legend(gold-31,gold-63,gold-127,gold-255);title(gold over AWGN channel L=3,K=1);xlabel(SNR);ylabel(BER);grid;figure;semilogy(handles.snr,handles.wber,-*);legend(walsh-32,walsh-64,walsh-128,walsh-256);title(walsh over AWGN channel L=3,K=1);xlabel(SNR);ylabel(BER);Gridsemilogy(handles.snr,[handles.gber(:,1) handles.wber(:,1)],-*);grid;legend(Gold-31,Walsh-32);title(BER Performance over AWGN Channel (K=1,L=3)); Plate A.7 BER Performance over AWGN Channel (cont’d)
    • 59% Matlab code for BER Performance over AWGN Channel with% Varying number of usershandles.coding=1:3;handles.user=[2 2^2 2^3 2^4];handles.channel=1:2;handles.shift_stage=5:8;handles.current_coding=handles.coding(1);handles.current_user=handles.user(1);handles.current_channel=handles.channel(1);handles.current_shift_stage=8;handles.snr=0:2:20;handles.g_ber=zeros(numel(handles.user),1);handles.w_ber=zeros(numel(handles.user),1);for i_use=1:numel(handles.user)n=5;i_user=handles.user(i_use);handles.pick=2:2^n-1;wcodes=walsh(n,i_user,handles.pick(1:i_user))/sqrt(2^n);gcodes=gold_pn(n,i_user,handles.pick(1:i_user))/sqrt(2^n-1);user1tx=randi([0 1],1,2999);handles.usertx=user1tx; user1=user1tx; u1=real(pskmod(user1,2)); gtx=[];wtx=[];
    • 60for i_case=1:i_usergtx1=kron(u1,gcodes(i_case,:));wtx1=kron(u1,wcodes(i_case,:));wtx=[wtx;wtx1];gtx=[gtx;gtx1];End%........the channel.........handles.g_s_user=[]; handles.w_s_user=[];for i_case=1:i_userhandles.g_s_user1=modulate(gtx(i_case,:),900000000,3000000000,fm);handles.w_s_user1=modulate(wtx(i_case,:),900000000,3000000000,fm); handles.g_s_user=[handles.g_s_user; handles.g_s_user1]; handles.w_s_user=[handles.w_s_user; handles.w_s_user1];Endg_s_ctx=[];w_s_ctx=[];for i_case=1:i_user gcase=handles.g_s_user(i_case,:); wcase=handles.w_s_user(i_case,:);g_s_ctx1=awgn(gcase,10,1);w_s_ctx1=awgn(wcase,10,1);g_s_ctx=[g_s_ctx;g_s_ctx1];w_s_ctx=[w_s_ctx;w_s_ctx1];Endg_out=[];w_out=[];
    • 61 for ii=1:2999 g_s_path1=zeros(1,2^n-1); g_s_path2=zeros(1,2^n-1); g_s_path3=zeros(1,2^n-1); w_s_path1=zeros(1,2^n); w_s_path2=zeros(1,2^n); w_s_path3=zeros(1,2^n);for i_case=1:i_user %...multiple signal over awgn channel g_s_path1=sum([g_s_path1;g_s_ctx(i_case,(1+(ii-1)*(2^n-1):ii*(2^n-1)))]); g=g_s_ctx(i_case,(1+(ii-1)*(2^n-1):ii*(2^n-1))); g_s_path2=sum([g_s_path2;[zeros(1,3) g(4:(2^n-1))]]); g_s_path3=sum([g_s_path3;[zeros(1,5) g(6:(2^n-1))]]); w_s_path1=sum([w_s_path1;w_s_ctx(i_case,(1+(ii-1)*(2^n):ii*(2^n)))]); w=w_s_ctx(i_case,(1+(ii-1)*(2^n):ii*(2^n))); w_s_path2=sum([w_s_path2;[zeros(1,3) w(4:(2^n))]]); w_s_path3=sum([w_s_path3;[zeros(1,5) w(6:(2^n))]]);End %%%% ....FM Demodulation...... g_s_crx=demod(g_s_path1,900000000,3000000000,fm); gm_s_crx1=g_s_crx; gm_s_crx2=demod(g_s_path2,900000000,3000000000,fm); gm_s_crx3=demod(g_s_path3,900000000,3000000000,fm); w_s_crx=demod(w_s_path1,900000000,3000000000,fm);
    • 62wm_s_crx1=w_s_crx;wm_s_crx2=demod(w_s_path2,900000000,3000000000,fm);wm_s_crx3=demod(w_s_path3,900000000,3000000000,fm);%....the receiver..............%.....multipath detection.....%......rake receiver despreader operation..........gm1_s_rx=gm_s_crx1.*gcodes(1,:);wm1_s_rx=wm_s_crx1.*wcodes(1,:);gm2_s_rx=gm_s_crx2.*[zeros(1,3) gcodes(1,4:(2^n-1))];wm2_s_rx=wm_s_crx2.*[zeros(1,3) wcodes(1,4:(2^n))];gm3_s_rx=gm_s_crx3.*[zeros(1,5) gcodes(1,6:(2^n-1))];wm3_s_rx=wm_s_crx3.*[zeros(1,5) wcodes(1,6:(2^n))];gm=gm1_s_rx;wm=wm1_s_rx;%....integrate and sum.........%...........+..............%........PSK demodulation.......handles.gm_rx=floor(2*sum(gm)-(gm(1)+gm(2^n-1)));handles.wm_rx=floor(2*sum(wm)-(wm(1)+wm(2^n)));handles.gm_rx=pskdemod(handles.gm_rx,2);handles.wm_rx=pskdemod(handles.wm_rx,2);%...picking detected bit outputg_out=[g_out handles.gm_rx];w_out=[w_out handles.wm_rx]; Plate A.8 Multi-user BER Performance Over AWGN Channel (cont’d)
    • 63 End %....correlating output with input for BER Calculation g_count=sum(kron(ones(1,1),user1tx)==g_out); w_count=sum(kron(ones(1,1),user1tx)==w_out); %....BER Calculation........ handles.g_ber(i_use,:)=(2999-g_count)/2999; handles.w_ber(i_use,:)=(2999-w_count)/2999;Endsemilogy(handles.user,handles.g_ber,-*,handles.user,handles.w_ber,-r*);grid;title(Multi-user Gold and Walsh over AWGN (L=3));legend(Gold-31,walsh-32)ylabel(BER);xlabel(K); Plate A.8 Multi-user BER Performance Over AWGN Channel (cont’d)
    • 64% Matlab code for BER Performance over AWGN Channel with% Varying number of usershandles.coding=1:3;handles.user=[2 2^2 2^3 2^4];handles.channel=1:2;handles.shift_stage=5:8;handles.current_coding=handles.coding(1);handles.current_user=handles.user(1);handles.current_channel=handles.channel(1);handles.current_shift_stage=8;handles.snr=0:2:20;handles.g_ber=zeros(numel(handles.user),1);handles.w_ber=zeros(numel(handles.user),1);for i_use=1:numel(handles.user)n=5;i_user=handles.user(i_use);handles.pick=2:2^n-1;wcodes=walsh(n,i_user,handles.pick(1:i_user))/sqrt(2^n);gcodes=gold_pn(n,i_user,handles.pick(1:i_user))/sqrt(2^n-1);user1tx=randi([0 1],1,2999);handles.usertx=user1tx; user1=user1tx; u1=real(pskmod(user1,2)); gtx=[];wtx=[]; for i_case=1:i_user gtx1=kron(u1,gcodes(i_case,:)); wtx1=kron(u1,wcodes(i_case,:)); wtx=[wtx;wtx1];gtx=[gtx;gtx1]; End %........the channel......... handles.g_s_user=[]; handles.w_s_user=[]; for i_case=1:i_user handles.g_s_user1=modulate(gtx(i_case,:),900000000,3000000000,fm); handles.w_s_user1=modulate(wtx(i_case,:),900000000,3000000000,fm); handles.g_s_user=[handles.g_s_user; handles.g_s_user1]; handles.w_s_user=[handles.w_s_user; handles.w_s_user1];Plate A.8 Multi-user BER Performance over AWGN Channel
    • 65 End g_s_ctx=[];w_s_ctx=[]; for i_case=1:i_user gcase=handles.g_s_user(i_case,:); wcase=handles.w_s_user(i_case,:); g_s_ctx1=awgn(gcase,10,1); w_s_ctx1=awgn(wcase,10,1); g_s_ctx=[g_s_ctx;g_s_ctx1]; w_s_ctx=[w_s_ctx;w_s_ctx1]; End g_out=[]; w_out=[]; for ii=1:2999 g_s_path1=zeros(1,2^n-1); g_s_path2=zeros(1,2^n-1); g_s_path3=zeros(1,2^n-1); w_s_path1=zeros(1,2^n); w_s_path2=zeros(1,2^n); w_s_path3=zeros(1,2^n);for i_case=1:i_user %...multiple signal over awgn channel g_s_path1=sum([g_s_path1;g_s_ctx(i_case,(1+(ii-1)*(2^n-1):ii*(2^n-1)))]); g=g_s_ctx(i_case,(1+(ii-1)*(2^n-1):ii*(2^n-1))); g_s_path2=sum([g_s_path2;[zeros(1,3) g(4:(2^n-1))]]); g_s_path3=sum([g_s_path3;[zeros(1,5) g(6:(2^n-1))]]); w_s_path1=sum([w_s_path1;w_s_ctx(i_case,(1+(ii-1)*(2^n):ii*(2^n)))]); w=w_s_ctx(i_case,(1+(ii-1)*(2^n):ii*(2^n))); w_s_path2=sum([w_s_path2;[zeros(1,3) w(4:(2^n))]]); w_s_path3=sum([w_s_path3;[zeros(1,5) w(6:(2^n))]]);End %%%% ....FM Demodulation...... g_s_crx=demod(g_s_path1,900000000,3000000000,fm); gm_s_crx1=g_s_crx; gm_s_crx2=demod(g_s_path2,900000000,3000000000,fm); gm_s_crx3=demod(g_s_path3,900000000,3000000000,fm); w_s_crx=demod(w_s_path1,900000000,3000000000,fm);Plate A.8 Multi-user BER Performance over AWGN Channel(cont’d)
    • 66 wm_s_crx1=w_s_crx; wm_s_crx2=demod(w_s_path2,900000000,3000000000,fm); wm_s_crx3=demod(w_s_path3,900000000,3000000000,fm); %....the receiver.............. %.....multipath detection..... %......rake receiver despreader operation.......... gm1_s_rx=gm_s_crx1.*gcodes(1,:); wm1_s_rx=wm_s_crx1.*wcodes(1,:); gm2_s_rx=gm_s_crx2.*[zeros(1,3) gcodes(1,4:(2^n-1))]; wm2_s_rx=wm_s_crx2.*[zeros(1,3) wcodes(1,4:(2^n))]; gm3_s_rx=gm_s_crx3.*[zeros(1,5) gcodes(1,6:(2^n-1))]; wm3_s_rx=wm_s_crx3.*[zeros(1,5) wcodes(1,6:(2^n))]; gm=gm1_s_rx; wm=wm1_s_rx; %....integrate and sum......... %...........+.............. %........PSK demodulation....... handles.gm_rx=floor(2*sum(gm)-(gm(1)+gm(2^n-1))); handles.wm_rx=floor(2*sum(wm)-(wm(1)+wm(2^n))); handles.gm_rx=pskdemod(handles.gm_rx,2); handles.wm_rx=pskdemod(handles.wm_rx,2); %...picking detected bit output g_out=[g_out handles.gm_rx]; w_out=[w_out handles.wm_rx]; End %....correlating output with input for BER Calculation g_count=sum(kron(ones(1,1),user1tx)==g_out); w_count=sum(kron(ones(1,1),user1tx)==w_out); %....BER Calculation........ handles.g_ber(i_use,:)=(2999-g_count)/2999; handles.w_ber(i_use,:)=(2999-w_count)/2999;Endsemilogy(handles.user,handles.g_ber,-*,handles.user,handles.w_ber,-r*);grid;title(Multi-user Gold and Walsh over AWGN (L=3));legend(Gold-31,walsh-32)ylabel(BER);xlabel(K); Plate A.8 Multi-user BER Performance over AWGN Channel(cont’d)
    • 67% Matlab code for BER Performance over Rayleigh Channel with% Varying length of codes,% Gold or Walshhandles.coding=1:3;handles.user=1:2;handles.channel=1:2;handles.shift_stage=5:8;handles.current_coding=handles.coding(1);handles.current_user=handles.user(1);handles.current_channel=handles.channel(1);handles.current_shift_stage=handles.shift_stage(1);handles.snr=-10:2:20;bitrate=5000000;raych1=rayleighchan(1/bitrate,80);g=doppler.gaussian(0.1);raych1.DopplerSpectrum=g;raych1.ResetBeforeFiltering=0;raych1delay=raych1.ChannelFilterDelay;raych2=rayleighchan(1/bitrate,80,0.1/bitrate,-3);raych2.DopplerSpectrum=g;raych2.ResetBeforeFiltering=0;raych2delay=raych2.ChannelFilterDelay;raych3=rayleighchan(1/bitrate,80,0.1/bitrate,-3);raych3.DopplerSpectrum=g;raych3.ResetBeforeFiltering=0;raych3delay=raych3.ChannelFilterDelay;handles.gber=[];handles.wber=[];for i_stage=1:numel(handles.shift_stage)n=handles.shift_stage(i_stage);wcodes=walsh(n,2,[2^(n-1) 2^n])/sqrt(2^n);gcodes=gold_pn(n,2,[2^(n-1) 2^n-3])/sqrt(2^n-1);user1tx=randi([0 1],1,3000);handles.usertx=user1tx; user1=user1tx; u1=real(pskmod(user1,2)); gtx1=kron(u1,gcodes(1,:)); wtx1=kron(u1,wcodes(1,:)); Plate A.9 BER Performance over Rayleigh Channel
    • 68 %........the channel......... handles.g_s_user=gtx1; handles.w_s_user=wtx1; handles.g_s_user=modulate(handles.g_s_user,900000000,3000000000,fm); handles.w_s_user=modulate(handles.w_s_user,900000000,3000000000,fm);handles.gray_ber=zeros(numel(handles.snr),1);handles.wray_ber=zeros(numel(handles.snr),1);for i_snr=1:numel(handles.snr) %.....single path......... g_s_ctx=awgn(handles.g_s_user,handles.snr(i_snr),1); w_s_ctx=awgn(handles.w_s_user,handles.snr(i_snr),1); gray_out=[]; wray_out=[]; for ii=1:3000 %...faded signal over rayleigh channel gray_s_path1=filter(raych1,g_s_ctx(1+(ii-1)*(2^n-1):ii*(2^n-1))); gray_s_path2=filter(raych2,g_s_ctx(1+(ii-1)*(2^n-1):ii*(2^n-1))); gray_s_path3=filter(raych3,g_s_ctx(1+(ii-1)*(2^n-1):ii*(2^n-1))); gray_s_crx=demod(gray_s_path1,900000000,3000000000,fm); gmray_s_crx1=gray_s_crx; gmray_s_crx2=demod(gray_s_path2,900000000,3000000000,fm); gmray_s_crx3=demod(gray_s_path3,900000000,3000000000,fm); wray_s_path1=filter(raych1,w_s_ctx(1+(ii-1)*(2^n):ii*(2^n))); wray_s_path2=filter(raych2,w_s_ctx(1+(ii-1)*(2^n):ii*(2^n))); wray_s_path3=filter(raych3,w_s_ctx(1+(ii-1)*(2^n):ii*(2^n))); wray_s_crx=demod(wray_s_path1,900000000,3000000000,fm); wmray_s_crx1=wray_s_crx; wmray_s_crx2=demod(wray_s_path2,900000000,3000000000,fm); wmray_s_crx3=demod(wray_s_path3,900000000,3000000000,fm); %....the receiver.............. %.......despreader operation......... Plate A.9 BER Performance over Rayleigh Channel(cont’d)
    • 69 %handles.gray_s_rx1=gray_s_crx.*gcodes(1,:); %handles.wray_s_rx1=wray_s_crx.*wcodes(1,:); %.....multipath detection..... %......rake receiver despreader operation.......... gmray1_s_rx=... gmray_s_crx1.*[gcodes(1,raych1delay+1:2^n-1) zeros(1,raych1delay)]; wmray1_s_rx=... wmray_s_crx1.*[wcodes(1,raych1delay+1:2^n) zeros(1,raych1delay)]; %....integrate and sum.......... %...........+................... %........PSK demodulation....... handles.gmray1_s_rx=... floor(2*sum(gmray1_s_rx)-(gmray1_s_rx(1)+gmray1_s_rx(2^n-1))); handles.wmray1_s_rx=... floor(2*sum(wmray1_s_rx)-(wmray1_s_rx(1)+wmray1_s_rx(2^n))); handles.gmray_s_rx=pskdemod(handles.gmray1_s_rx,2); handles.wmray_s_rx=pskdemod(handles.wmray1_s_rx,2); %...picking detected bit output gray_out=[gray_out handles.gmray_s_rx]; wray_out=[wray_out handles.wmray_s_rx]; End %....correlating output with input for BER Calculation gray_count=sum(kron(ones(1,1),user1tx)==gray_out); wray_count=sum(kron(ones(1,1),user1tx)==wray_out); %....BER Calculation........ handles.gray_ber(i_snr,:)=(3000*ones(1,1)-gray_count)/3000; handles.wray_ber(i_snr,:)=(3000*ones(1,1)-wray_count)/3000;Endhandles.gber=[handles.gber handles.gray_ber];handles.wber=[handles.wber handles.wray_ber];Endsemilogy(handles.snr,handles.gber,-*);legend(gold-31,gold-63,gold-127,gold-255);title(gold over rayleigh channel L=3,K=1);xlabel(SNR);ylabel(BER);grid; Plate A.9 BER Performance over Rayleigh Channel(cont’d)
    • 70figure;semilogy(handles.snr,handles.wber,-*);legend(walsh-32,walsh-64,walsh-128,walsh-256);title(walsh over rayleigh channel L=3,K=1);xlabel(SNR);ylabel(BER);Gridsemilogy(handles.snr,[handles.gber(:,1) handles.wber(:,1)],-*);grid;legend(Gold-31,Walsh-32);title(BER Performance over Rayleigh Channel (K=1,L=3)); Plate A.9 BER Performance over Rayleigh Channel(cont’d)
    • 71% Matlab code for BER Performance over Rayleigh Channel with% Varying number of usershandles.coding=1:3;handles.user=[2 2^2 2^3 2^4];handles.channel=1:2;handles.shift_stage=5:8;handles.current_coding=handles.coding(1);handles.current_user=handles.user(1);handles.current_channel=handles.channel(1);handles.current_shift_stage=handles.shift_stage(1);handles.snr=0:2:20;bitrate=5000000;raych1=rayleighchan(1/bitrate,80);g=doppler.gaussian(0.1);raych1.DopplerSpectrum=g;raych1.ResetBeforeFiltering=0;raych1delay=raych1.ChannelFilterDelay;raych2=rayleighchan(1/bitrate,80,0.1/bitrate,-3);raych2.DopplerSpectrum=g;raych2.ResetBeforeFiltering=0;raych2delay=raych2.ChannelFilterDelay;raych3=rayleighchan(1/bitrate,80,0.1/bitrate,-3);raych3.DopplerSpectrum=g;raych3.ResetBeforeFiltering=0;raych3delay=raych3.ChannelFilterDelay;handles.gray_ber=zeros(numel(handles.user),1);handles.wray_ber=zeros(numel(handles.user),1);for i_use=1:numel(handles.user)n=5;i_user=handles.user(i_use);handles.pick=2:2^n-1;wcodes=walsh(n,i_user,handles.pick(1:i_user))/sqrt(2^n);gcodes=gold_pn(n,i_user,handles.pick(1:i_user))/sqrt(2^n-1);user1tx=randi([0 1],1,1111);handles.usertx=user1tx; user1=user1tx; u1=real(pskmod(user1,2)); gtx=[];wtx=[]; for i_case=1:i_user Plate A.10 Multi-user BER Performance over Rayleigh Channel
    • 72 gtx1=kron(u1,gcodes(i_case,:)); wtx1=kron(u1,wcodes(i_case,:)); wtx=[wtx;wtx1];gtx=[gtx;gtx1]; End %........the channel......... handles.g_s_user=[]; handles.w_s_user=[]; for i_case=1:i_user handles.g_s_user1=modulate(gtx(i_case,:),900000000,3000000000,fm); handles.w_s_user1=modulate(wtx(i_case,:),900000000,3000000000,fm); handles.g_s_user=[handles.g_s_user; handles.g_s_user1]; handles.w_s_user=[handles.w_s_user; handles.w_s_user1]; End g_s_ctx=[];w_s_ctx=[]; for i_case=1:i_user gcase=handles.g_s_user(i_case,:); wcase=handles.w_s_user(i_case,:); g_s_ctx1=awgn(gcase,10,1); w_s_ctx1=awgn(wcase,10,1); g_s_ctx=[g_s_ctx;g_s_ctx1]; w_s_ctx=[w_s_ctx;w_s_ctx1]; End gray_out=[]; wray_out=[]; for ii=1:1111 gray_s_path1=zeros(1,2^n-1); gray_s_path2=zeros(1,2^n-1); gray_s_path3=zeros(1,2^n-1); wray_s_path1=zeros(1,2^n); wray_s_path2=zeros(1,2^n); wray_s_path3=zeros(1,2^n);for i_case=1:i_user %...faded signal over rayleigh channel gray_s_path1=sum([gray_s_path1;filter(raych1,g_s_ctx(i_case,... (1+(ii-1)*(2^n-1):ii*(2^n-1))))]); gray_s_path2=sum([gray_s_path2;filter(raych2,g_s_ctx(i_case,... (1+(ii-1)*(2^n-1):ii*(2^n-1))))]); gray_s_path3=sum([gray_s_path3;filter(raych3,g_s_ctx(i_case,... (1+(ii-1)*(2^n-1):ii*(2^n-1))))]); Plate A.10 Multi-user BER Performance over Rayleigh Channel(cont’d)
    • 73 wray_s_path1=sum([wray_s_path1;filter(raych1,w_s_ctx(i_case,... (1+(ii-1)*(2^n):ii*(2^n))))]); wray_s_path2=sum([wray_s_path2;filter(raych2,w_s_ctx(i_case,... (1+(ii-1)*(2^n):ii*(2^n))))]); wray_s_path3=sum([wray_s_path3;filter(raych3,w_s_ctx(i_case,... (1+(ii-1)*(2^n):ii*(2^n))))]);End %%%% gray_s_crx=demod(gray_s_path1,900000000,3000000000,fm); gmray_s_crx1=gray_s_crx; gmray_s_crx2=demod(gray_s_path2,900000000,3000000000,fm); gmray_s_crx3=demod(gray_s_path3,900000000,3000000000,fm); wray_s_crx=demod(wray_s_path1,900000000,3000000000,fm); wmray_s_crx1=wray_s_crx; wmray_s_crx2=demod(wray_s_path2,900000000,3000000000,fm); wmray_s_crx3=demod(wray_s_path3,900000000,3000000000,fm); %....the receiver.............. %.......despreader operation......... gmray1_s_rx=... gmray_s_crx1.*[gcodes(1,raych1delay+1:2^n-1) zeros(1,raych1delay)]; wmray1_s_rx=... wmray_s_crx1.*[wcodes(1,raych1delay+1:2^n) zeros(1,raych1delay)]; %....integrate and sum......... %...........+.............. %........PSK demodulation....... handles.gmray1_s_rx=... floor(2*sum(gmray1_s_rx)-(gmray1_s_rx(1)+gmray1_s_rx(2^n-1))); handles.wmray1_s_rx=... floor(2*sum(wmray1_s_rx)-(wmray1_s_rx(1)+wmray1_s_rx(2^n))); handles.gmray_s_rx=pskdemod(handles.gmray1_s_rx,2); handles.wmray_s_rx=pskdemod(handles.wmray1_s_rx,2); %...picking detected bit output gray_out=[gray_out handles.gmray_s_rx]; wray_out=[wray_out handles.wmray_s_rx]; End Plate A.10 Multi-user BER Performance over Rayleigh Channel(cont’d)
    • 74 %....correlating output with input for BER Calculation gray_count=sum(kron(ones(1,1),user1tx)==gray_out); wray_count=sum(kron(ones(1,1),user1tx)==wray_out); %....BER Calculation........ handles.gray_ber(i_use,:)=(1111-gray_count)/1111; handles.wray_ber(i_use,:)=(1111-wray_count)/1111;Endsemilogy(handles.user,[handles.gray_ber handles.wray_ber],-*);grid;title(Multi-user Gold and Walsh over Rayleigh Channel (L=3));legend(Gold-31,walsh-32)ylabel(BER);xlabel(K); Plate A.10 Multi-user BER Performance over Rayleigh Channel(cont’d)