This dissertation has been submitted by a student. This is not an example of the work written by our professional dissertation writers.

### INTRODUCTION

### ANALOG AND DIGITAL SIGNALS

The signal is initially generated is in the form of an analog electrical voltage or current, produced for example by a microphone or some other type of transducer. The output from the readout system of a CD (compact disc) player, the data is already in digital form. An analog signal must be converted into digital form before DSP techniques can be applied. An analog electrical voltage signal, for example, can be digitized using an electronic circuit called an analog-to-digital converter or ADC. This generates a digital output as a stream of binary numbers whose values represent the electrical voltage input to the device at each sampling instant.

Digital signal processing (DSP)-digital representation of signals and the use of digital processors to analyze, modify, or extract information from signals. Many signals in DSP are derived from analogue signals which have been sampled at regular intervals and converted into digital form. The key advantages of DSP over analogue processing are

* Guaranteed accuracy (determined by the number of bits used)

* Perfect reproducibility

* No drift in performance due to temperature or age

* Takes advantage of advances in semiconductor technology

* Greater flexibility (can be reprogrammed without modifying hardware)

* Superior performance (linear phase response possible, and filtering

* algorithms can be made adaptive)

* Sometimes information may already be in digital form.

* There are however (still) some disadvantages

* Speed and cost (DSP design and hardware may be expensive, especially with high bandwidth signals)

* Finite word length problems (limited number of bits may cause degradation).

Application areas of DSP are considerable:

1. Image processing (pattern recognition, robotic vision, image enhancement, facsimile, satellite weather map, animation)

2. Instrumentation and control (spectrum analysis, position and rate control, noise reduction, data compression)

3. Speech and audio (speech recognition, speech synthesis, text to speech, digital audio, equalisation)

4. Military (secure communication, radar processing, sonar processing, missile guidance)

5. Telecommunications (echo cancellation, adaptive equalisation, spread spectrum, video conferencing, data communication)

6. Biomedical (patient monitoring, scanners, EEG brain mappers, ECG analysis, X-ray storage and enhancement).

### INTRODUCTION TO CDMA

Code Division Multiple Access (CDMA) is a radically new concept in wireless communications. It has gained widespread international acceptance by cellular radio system operators as an upgrade that will dramatically increase both their system capacity and the service quality. It has likewise been chosen for deployment by the majority of the winners of the United States Personal Communications System spectrum auctions. It may seem, however, mysterious for those who aren't familiar with it.

CDMA is a form of spread-spectrum, a family of digital communication techniques that have been used in military applications for many years. The core principle of spread spectrum is the use of noise-like carrier waves, and, as the name implies, bandwidths much wider than that required for simple point-to-point communication at the same data rate. Originally there were two motivations: either to resist enemy efforts to jam the communications (anti-jam, or AJ), or to hide the fact that communication was even taking place, sometimes called low probability of intercept (LPI). It has a history that goes back to the early days of World War II.

The use of CDMA for civilian mobile radio applications is novel. It was proposed theoretically in the late 1940's, but the practical application in the civilian marketplace did not take place until 40 years later. Commercial applications became possible because of two evolutionary developments. One was the availability of very low cost, high density digital integrated circuits, which reduce the size, weight, and cost of the subscriber stations to an acceptably low level. The other was the realization that optimal multiple access communication requires that all user stations regulate their transmitter powers to the lowest that will achieve adequate signal quality.

CDMA changes the nature of the subscriber station from a predominately analog device to a predominately digital device. Old-fashioned radio receivers separate stations or channels by filtering in the frequency domain. CDMA receivers do not eliminate analog processing entirely, but they separate communication channels by means of a pseudorandom modulation that is applied and removed in the digital domain, not on the basis of frequency. Multiple users occupy the same frequency band. This universal frequency reuse is not fortuitous. On the contrary, it is crucial to the very high spectral efficiency that is the hallmark of CDMA. Other discussions in these pages show why this is true.

### CDMA is altering the face of cellular and PCS communication by:

Â· Dramatically improving the telephone traffic capacity

Â· Dramatically improving the voice quality and eliminating the audible effects of multipath fading

Reducing the incidence of dropped calls due to handoff failures

Â· Providing reliable transport mechanism for data communications, such as facsimile and internet traffic

Â· Reducing the number of sites needed to support any given amount of traffic

Â· Simplifying site selection

Â· Reducing deployment and operating costs because fewer cell sites are needed

Â· Reducing average transmitted power

Â· Reducing interference to other electronic devices

Â· Reducing potential health risks

Commercially introduced in 1995, CDMA quickly became one of the world's fastest growing wireless technologies. In 1999, the International Telecommunications Union selected CDMA as the industry standard for new "third-generation" (3G) wireless systems. Many leading wireless carriers are now building or upgrading to 3G CDMA networks in order to provide more capacity for voice traffic, along with high-speed data capabilities.

### DS_CDMA

Multiple access systems based on DS CDMA have achieved increasing significance for mobile communications applications. A promising concept is based on DS_CDMA applying MRC at the receiver. MRC takes advantage of the channel diversity to combat the multipath fading. However the capacity of a DS_CDMA system is limited by both multi-user interference and inter symbol interference ISI in high data rate applications.

OFDM is applied to combat the frequency selectivity of the channel using a simple one tap equalizer Further more OFDM prevents the ISI and inter carrier interference ICI by inserting a guard interval between adjacent OFDM symbols OFDM is typically used for audio TV and HDTV transmission over terrestrial channels and achieves high spectral efficiency.

### The CMDA Technology overview

### FDMA

In Frequency Division Multiple Access, the frequency band is divided in slots. Each user gets one frequency slot assigned that is used at will. It could be compared to AM or FM broadcasting radio where each station has a frequency assigned. FDMA demands good filtering.

### TDMA

In Time Division Multiple Access, the frequency band is not partitioned but users are allowed to use it only in predefined intervals of time, one at a time. Thus, TDMA demands synchronization among the users.

### CDMA

CDMA, for Code Division Multiple Access, is different from its traditional ways in which it does not allocate frequency or time in user slots but gives the right to use both to all users simultaneously. To do this, it uses a technique known as Spread Spectrum . In effect, each user is assigned a code,which spreads its signal bandwidth in such a way that only the same code can recover it at the receiver end. This method has the property that the unwanted signals with different codes get spread even more by the process, making them like noise to the receiver .

### Spread Spectrum

### Definition of Spread Spectrum:

A transmission technique in which a pseudo-noise code, independent of the information data, is employed as a modulation waveform to "spread" the signal energy over a bandwidth much greater than the signal information bandwidth. At the receiver the signal is "despread" using a synchronized replica of the pseudo-noise code.

Spread Spectrum is a mean of transmission where the data occupies a larger bandwidth than necessary. Bandwidth spreading is accomplished before the transmission through the use of a code, which is independent of the transmitted data. The same code is used to demodulate the data at the receiving end. The following figure illustrate the spreading done on the data signal x(t) by the spreading signal c(t) resulting in the message signal to be transmitted, m(t).

Originally for military use to avoid jamming (interference created on purpose to make a communication channel unusable), spread spectrum modulation is now used in personal communication systems for its superior performance in an interference dominated environment .

### Basic Principle of Spread Spectrum System:

The Principal types of Spread Spectrum are Direct Sequence (DS), and Frequency Hopping (FH). An over view of these systems is hereby given:

Pseudo shift of the phase pseudo shift of the frequency

Coherent demodulation noncoherent

Direct Sequence Spread Spectrum (DSSS)

A pseudo-noise sequence pnt generated at the modulator, is used in conjunction with an M-ary PSK modulation to shift the phase of the PSK signal pseudo randomly, at the chipping rate Rc (=1/Tc) a rate that is integer multiple of the symbol rate Rs (=1/Ts).

The transmitted bandwidth is determined by the chip rate and by the base band filtering. The implementation limits the maximum chip rate Rc (clock rate) and thus the maximum spreading. The PSK modulation scheme requires a coherent demodulation.

PN code length that is much longer than a data symbol, so that a different chip pattern is associated with each symbol.

### Frequency Hopping Spread Spectrum

A Pseudo-noise sequence pnt generated at the modulator is used in conjuction with an M-ary FSK modulation to shift the carrier frequency of the FSK signal pseudurandomly, at the hopping rate Rh. The transmitted signal occupies a number of frequencies in time, each for a period of time Th (= 1/Rh), referred as dwell time. FHSS divides the available bandwidth into N channels and hops between these channels according to the PN sequence. At each frequency hop time the PN generator feeds the frequency synthesizer a frequency word FW (a sequence of n chips) which dictates one of 2n frequency position fhl . Transmitter and receiver follows the same frequency hop pattern.

The transmitted bandwidth is determined by the lowest and highest hop position by the bandwidth per hop position (âˆ†fch). For a given hop, instantaneous occupied bandwidth is the conventional M-FSK, which is typically much smaller than Wss. So the FHSS signal is a narrowband signal, all transmission power is concentrated on one channel. Averaged over many hops, the FH/M-FSK spectrum occupies the entire spread spectrum bandwidth. Because the bandwidth of an FHSS system only depends on the tuning range, it can be hopped over a much wider bandwidth than an DSSS system.

Since the hops generally result in phase discontinuity (depending on the particular implementation) a noncoherent demodulation is done at receiver. With slow hopping there are multiple data symbol per hop and with fast hopping there are multiple hops per data symbol.

Basic principle of Direct Sequence Spread Spectrum

### For BPSK modulation the building blocks of a DSSS system are:

### Input:

Binary data dt with symbol rate Rs = 1/Ts (=bitrate Rb for BPSK)

Pseudo-noise code pnt with chip rate Rc = 1/Tc (an integer of Rs)

### Spreading:

In the transmitter, the binary data dt (for BPSK, I and Q for QPSK) is 'directly' multiplied with the PN sequence pnt , which is independent of the binary data, to produce the transmitted baseband signal txb:txb = dt . pnt

The effect of multiplication of dt with a PN sequence is to spread the baseband bandwidth Rs of dt to a baseband bandwidth of Rc.

### Despreading:

The spread spectrum signal cannot be detected by a conventional narrowband receiver. In the receiver, the baseband signal rxb is multiplied with the PN sequence pnr .

If pnr = pnt and synchronized to the PN sequence in the received data, than the recovered binary data is produced on dr. The effect of multiplication of the spread spectrum signal rxb with the PN sequence pnt used in the transmitter is to despread the bandwidth of rxb to Rs .

If pnr â‰ pnt , than there is no dispreading action. The signal dr has a spread spectrum. A receiver not knowing the PN sequence of the transmitter can not reproduce the transmitted data.

### Performance in the presence of interference:

To simplify the presence of interference, the spread spectrum system is considered for baseband BPSK communication (without filtering).

The received signal rxb of the transmitted signal txb plus an additive inteferance i (noise, other users, jammer,......):

rxb = t xb + i = dt . pnt + i

To recover the original data dt the received signal rx0 is multiplied with a locally generated PN sequence pnr that is an exact replica of that used in the transmitter (that is pnr = pnt and synchronized) The multiplier output is therefore given by:

dr = rxb . pnt = dt . pnt . pnt + i . pnt

The data signal dt is multiplied twice by the PN sequence pnt , where as the unwanted inteferance i is multiplied only once.

### Due to the property of the PN sequence:

pnt + pnt = +1 for all t

### The multiplier output becomes:

dr = dt + i . pnt

The data signal dr is reproduced at the multiplier output in the receiver, except for the inteferance represented by the additive term i . pnt . Multiplication of the inteferance by the locally generated PN sequence, means that the spreading code will affect the inteferance just as it did with the information bearing signal at the transmitter. Noise and inteferance, being uncorrelated with the PN sequence, becomes noise-like, increase in bandwidth and decrease in power density after the multiplier.

After dispreading, the data component dt is narrow band (Rb) whereas the inteferance component is wideband (Rc). By applying the dr signal to a baseband (low-pass) filter with a band width just large enough to accommodate the recovery of the data signal, most of the inteferance component i is filtered out. The effect of inteferance is reduced by processing gain (Gp).

### Narrowband inteferance:

The narrowband noise is spread by the multiplication with the PN sequence pnr of the receiver. The power density of the noise is reduced with respect to the despread data signal. Only 1/Gp of the original noise power is left in the information baseband (Rs). Spreading and dispreading enables a bandwidth trade for processing gain against narrow band interfering signals. Narrow band inteferance would disable conventional narrow band receivers.

The essence behind the inteferance rejection capability of a spread spectrum system: the useful signal (data) gets multiplied twice by the PN sequence, but the inteferance signal get multiplied only once.

### Wideband interference:

Multiplication of the received signal with the PN sequence of the receiver gets a selective despread of the data signal (smaller bandwidth, higher power density). The inteferance signal is uncorrelated with the PN sequence and is spread.

### Origin of wideband noise:

Ã˜ Multiple Spread Spectrum user: multiple access mechanism.

Ã˜ Gaussian Noise: There is no increase in SNR with spread spectrum: The large channel bandwidth (Rc instead of Rs) increase the received noise power with Gp:

Ninfo = N0 . BWinfo Ã Nss = N0 . BWss = Ninfo .Gp

The spread spectrum signal has a lower power density than the directly transmitted signal.

Code division multiple access (CDMA) is a methode of multiplexing (wireless) users distinct (orthogonal) codes. All users can transmit at the same time, and each is allocated the entire available frequency spectrum for transmission. CDMA is also known as Spread-Spectrum multiple access (SSMA).

CDMA dose not require the bandwidth allocation of FDMA, nor the time synchronization of the individual users needed in TDMA. A CDMA user has full time and full bandwidth available, but the quality of the communication decreases with an increasing number of users (BER ).

### In CDMA each user:

Ã˜ Has it's own PN code

Ã˜ Uses the same RF bandwidth

Ã˜ Transmits simultaneously (asynchronous or synchronous)

Correlation of the received baseband spread spectrum signal rxb with the PN sequence of user 1 only despreads the signal of user 1. The other user produces noise Nu for user 1.

### OFDM Introduction

The basic principle of OFDM is to split a high-rate data stream into a number of lower rate streams that are transmitted simultaneously over a number of subcarriers. Because the symbol duration increases for lower rate parallel subcarriers, the relative amount of dispersion in time caused by multipath delay spread is decreased. Inter symbol interference is eliminated almost completely by introducing a guard time in every OFDM symbol. In the guard time, the symbol is cyclically extended to avoid inter carrier interference.

In OFDM design, a number of parameters are up for consideration, such as the number of subcarriers, guard time, symbol duration, subcarrier spacing, and modulation type per subcarrier. The choice of parameters is influenced by system requirements such as available bandwidth, required bit rate, tolerable delay spread, and Doppler values. Some requirements are conflicting. For instance, to get a good delay spread tolerance, a large number of subcarriers with small subcarrier spacing is desirable, but the opposite is true for a good tolerance against Doppler spread and phase noise.

As an example, figure shows four subcarriers from one OFDM signal. In this example, all subcarriers have the phase and amplitude, but in practice the amplitudes and phases may be modulated differently for each subcarrier. Note that each subcarrier has exactly an integer number of cycles in the interval T, and the number of cycles between adjacent subcarriers differs by exactly one. This properly accounts for the orthogonality between subcarriers.

The orthogonality of different OFDM subcarriers can also be demonstrated in another way. Each OFDM symbol contains subcarriers that are nonzero over a T -seconds interval. Hence, the spectrum of a single symbol is a convolution of group of Dirac pulses located at the subcarrier frequencies with the spectrum of a square pulse that is one for a T second period and zero otherwise. The amplitude spectrum of the square pulse is equal to sinc(ï?°fT) , which has zeros for all frequencies f that are an integer multiple of 1/T . This effect is shown in figure which shows the overlapping sinc spectra of individual subcarriers. At the maximum of each subcarrier spectrum, all other subcarrier spectra are zero. Because an OFDM receiver calculates the spectrum values at those points that correspond to the maxima of individual subcarrier, it can demodulate each subcarrier free from any interference from the other subcarriers. Basically, Figure shows that the OFDM spectrum fulfills Nyquist's criterion for an inter symbol interference free pulse shape. Notice that the pulse shape is present in frequency domain and note in the time domain, for which the Nyquist criterion usually is applied.

Therefore, instead of inter symbol interference (ISI), it is inter carrier interference(ICI) that avoided by having the maximum of one subcarrier spectrum correspond to zero crossing of all the others.

Block diagram of OFDM transmitter is given below:-

Block diagram of OFDM receiver is given below:-

### Choice of OFDM parameters

The choice of various OFDM parameters is a tradeoff between various, often conflicting requirements. Usually, there are three main requirements to start with: bandwidth, bit rate, and delay spread. The delay spread directly dictates the guard time. As a rule, the guard time should be about two to four times the root-mean-squared delay spread. This value depends on the type of coding and QAM modulation. Higher order QAM (like 64-QAM) is more sensitive to ICI and ISI than QPSK; while heavier coding obviously reduces the sensitivity to such interference. Now the guard time has been set, the symbol duration can be fixed. To minimize the signal-to-noise ratio (SNR) loss caused by guard time, it is desirable to have the symbol duration much larger than the guard time. It cannot be arbitrarily large, however, because larger symbol duration means more subcarriers with smaller subcarrier spacing, a larger implementation complexity, and more sensitivity to phase noise and frequency offset, as well as an increased peak-to-average power ratio. Hence, a practical design choice to make the symbol duration at least five times the guard time, which implies a 1dB SNR loss because the guard time.

After the symbol duration and guard time are fixed, the number of subcarriers follows directly as the required â€“3 dB bandwidth divided by the subcarrier spacing, which is the inverse of the symbol duration less the guard time. Alternatively, the number of subcarriers may be determined by the required bit rate divided by the bit rate per subcarrier. The bit rate per subcarrier is defined by the modulation type, coding rate, and symbol rate. An additional requirement that can affect the chosen parameters is the demand for an integer number of samples both within the FFT/IFFT interval and in the symbol interval.

### Multi-Carrier Code Division Multiple Access (MC CDMA) :

This is a multiple access scheme used in OFDM (Orthogonal Frequency Division Multiplexing) based tellicomunication system.MC CDMA spreads each user symbol in frequency domain each symbol is carried over multiple parallel subcarries only phase is shifted by 0 or 180 accordingly.The code values differ per subcarrier the reciever combines all the subcarriers signals by measuring these signls strengh.The code values differ per subcarrier and user .The reciever separtes signals of different user by different code values. Since each data symbol occupies a much wider bandwidth than the data rate , a signal-to-noise-plus-interference ratio(if defined as signal power divided by total noise plus interference power in the entire transmission band) of less than 0 dB is feasible.

One way of interpreting MC-CDMA is to regard it as a direct-sequence CDMA signal (DS-CDMA) which is transmitted after it has been fed through an inverse FFT (Fast Fourier Transform)

### ACCESS SCHEMES

For radio systems there are two resources, frequency and time. Division by frequency, so that each pair of communicators is allocated part of the spectrum for all of the time, results in Frequency Division Multiple Access (FDMA). Division by time, so that each pair of communicators is allocated all (or at least a large part) of the spectrum for part of the time results in Time Division Multiple Access (TDMA). In Code Division Multiple Access (CDMA), every communicator will be allocated the entire spectrum all of the time. CDMA uses codes to identify connections.

### Multiple Access Schemes

### CODING

CDMA uses unique spreading codes to spread the baseband data before transmission. The signal is transmitted in a channel, which is below noise level. The receiver then uses a correlator to despread the wanted signal, which is passed through a narrow bandpass filter. Unwanted signals will not be despread and will not pass through the filter. Codes take the form of a carefully designed one/zero sequence produced at a much higher rate than that of the baseband data. The rate of a spreading code is referred to as chip rate rather than bit rate.

### CDMA spreading

### CODES

CDMA codes are not required to provide call security, but create a uniqueness to enable call identification. Codes should not correlate to other codes or time shifted version of itself. Spreading codes are noise like pseudo-random codes, channel codes are designed for maximum separation from each other and cell identification codes are balanced not to correlate to other codes of itself.

### CDMA spreading

### POWERCONTROL

CDMA is interference limited multiple access system. Because all users transmit on the same frequency, internal interference generated by the system is the most significant factor in determining system capacity and call quality. The transmit power for each user must be reduced to limit interference, however, the power should be enough to maintain the required Eb/No (signal to noise ratio) for a satisfactory call quality. Maximum capacity is achieved when Eb/No of every user is at the minimum level needed for the acceptable channel performance. As the MS moves around, the RF environment continuously changes due to fast and slow fading, external interference, shadowing , and other factors. The aim of the dynamic power control is to limit transmitted power on both the links while maintaining link quality under all conditions. Additional advantages are longer mobile battery life and longer life span of BTS power amplifiers

### HANDOVER

Handover occurs when a call has to be passed from one cell to another as the user moves between cells. In a traditional "hard" handover, the connection to the current cell is broken, and then the connection to the new cell is made. This is known as a "break-before-make" handover. Since all cells in CDMA use the same frequency, it is possible to make the connection to the new cell before leaving the current cell. This is known as a "make-before-break" or "soft" handover. Soft handovers require less power, which reduces interference and increases capacity. Mobile can be connected to more that two BTS the handover. "Softer" handover is a special case of soft handover where the radio links that are added and removed belong to the same Node B.

### CDMA soft handover

### MULTIPATH AND RAKE RECEIVERS

One of the main advantages of CDMA systems is the capability of using signals that arrive in the receivers with different time delays. This phenomenon is called multipath. FDMA and TDMA, which are narrow band systems, cannot discriminate between the multipath arrivals, and resort to equalization to mitigate the negative effects of multipath. Due to its wide bandwidth and rake receivers, CDMA uses the multipath signals and combines them to make an even stronger signal at the receivers. CDMA subscriber units use rake receivers. This is essentially a set of several receivers. One of the receivers (fingers) constantly searches for different multipaths and feeds the information to the other three fingers. Each finger then demodulates the signal corresponding to a strong multipath. The results are then combined together to make the signal stronger.

### Difference between TDMA vs CDMA.

TDMA is "Time Division Multiple Access", while CDMA is "Code Division Multiple Access". Both technologies achieve the same goal of better utilization of the radio spectrum by allowing multiple users to share the same physical channel, but by using different methods and that is why the three of the four words in each acronym are identical. Both allow more than one person to carry out a conversation on the same frequency without causing interference.

The two technologies differ in the way in which users share the common resource. In TDMA the channel is chopped up into sequential time slices. The data of each user is put on the channel in a round-robin fashion. In reality, only one user actually uses the channel at any given point of time, but he uses it only for short bursts. He then gives up the channel for a short duration to allow the other users to have their turn. This is similar to how a computer with just one processor runs multiple applications simultaneously.

CDMA on the other hand allows everyone to transmit at the same time. With conventional methods of modulation techniques it would hav been simply not possible. What makes CDMA to allow all users to transmit simultaneously is a special type of digital modulation called "Spread Spectrum". In this modulation technique user's stream of bits is taken and splattered them across a very wide channel in a pseudo-random fashion. The "pseudo" part is very important here as at the receiver end the randomization must be undone in order to collect the bits together in a coherent order.

For example consider a room full of couples, and each couple trying to carry on one-on-one conversations. In TDMA each couple takes their turn for talking and they keep their turns short by speaking only one sentence at a time. As there is always more one person speaking in the room at any given point of time, no one has to worry about being heard over the background din. In CDMA assume each couple talks simultaneously, but they all use different languages. The background din doesn't cause any real problem as none of the listeners understand any language other than that of the individual to whom they are listening.

### Voice Encoding

At this point many people confuse two distinctly different issues involved in the transmission of digital audio. The first is the WAY in which the stream of bits is delivered from one end to the other. This part of the "air interface" is what makes one technology different from another. The second is the compression algorithm used to squeeze the audio into as small a stream of bits as possible.

This latter component is known at the "Voice Coder", or Vocoder for short. Another term commonly used is CODEC, which is a similar word to modem. It combines the terms "COder" and "DECoder". Although each technology has chosen their own unique CODECs, there is no rule saying that one transmission method needs to use a specific CODEC. People often lump a technology's transmission method with its CODEC as though they were single entities.

Voice encoding schemes differ slightly in their approach to the problem. Because of this, certain types of human voice work better with some CODECs than they do with others. The point to remember is that all PCS CODECs are compromises of some sort. Since human voices have such a fantastic range of pitch and tonal depth, one cannot expect any single compromise to handle each one equally well. This inability to cope with all types of voice at the same level does lead some people to choose one technology over another.

All of the PCS technologies try to minimize battery consumption during calls by keeping the transmission of unnecessary data to a minimum. The phone decides whether or not you are presently speaking, or if the sound it hears is just background noise. If the phone determines that there is no intelligent data to transmit it blanks the audio and it reduces the transmitter duty cycle (in the case of TDMA) or the number of transmitted bits (in the case of CDMA). When the audio is blanked your caller would suddenly find themselves listening to "dead air", and this may cause them to think the call has dropped.

To avoid this psychological problem many service providers insert what is known as "Comfort Noise" during the blanked periods. Comfort Noise is synthesized white noise that tries to mimic the volume and structure of the real background noise. This fake background noise assures the caller that the connection is alive and well.

However, in newer CODECs such as EVRC (used exclusively on CDMA systems) the background noise is generally suppressed even while the user is talking. This piece of magic makes it sound as though the cell phone user is not in a noisy environment at all. Under these conditions, Comfort Noise is neither necessary, nor desirable.

### DS-CDMA-INTRODUCTION

While multiple access interference (MAI) by other users has been recognized as the capacity-limiting factor in direct sequence code-division multiple-access (DS-CDMA)-based cellular communication systems, multiuser approaches have largely alleviated the problem when the noise process is additive Gaussian. With the availability of multiuser detectors, inaccurate or inappropriate noise modelling assumptions seem to have become the issue again.

Whereas multiuser detection has much to offer in the mobile- to-base station uplink, it does not at present appear to be feasible for the downlink due to the complexity involved and the

lack of resistance against adjacent cell interference. Moreover, the few multiuser proposals for the downlink require the knowledge of all spreading codes, which is not possible in the tactical military environment, for instance. Enhanced single-user receivers equipped with adaptive filter banks deliver promising performance with reasonable complexity, especially

in slowly varying channels. Thus, the performance of single-user detectors is still of interest, particularly in the presence of non-Gaussian noise. In both urban outdoor and indoor mobile radio environments, electromagnetic interference generated by man-made sources such as factories or power lines causes the noise to be of non-Gaussian nature. Large noise magnitudes are deemed very improbable by linear receivers, and consequently performance deterioration is experienced. It is therefore desirable to build systems that can maintain respectable functionality under a broad class of noise distributions, rather than strictly optimizing for the unrealistic Gaussian assumption. Such is the goal of robust detection and estimation theory, which aims to design systems that are suboptimal under nominal channel conditions (e.g., Gaussian channel) and yet do not face catastrophy when the noise distribution is not nominal (e.g., unlike linear schemes). Note that suboptimality here refers to very good performance that is slightly worse than that of the nominal-optimal detector/estimator.

The direct sequence code division multiple access (DS-CDMA) technique has been favourably considered for application in digital mobile cellular networks due to its potential to provide higher system capacity over conventional multiple access techniques. Unlike FDMA and TDMA capacities which are mostly limited by the bandwidth, the capacity of a CDMA system is mainly restricted by its interference level. Any reduction in interference produces a direct and linear increase in system capacity. Multiple access interference (MAI) caused by non-zero cross-correlation between different spreading sequences is the major type of interference limiting the CDMA system capacity. Much work has been done to characterize MAI, and to analyze and evaluate the CDMA system performance in the presence of MAI. Since the cross-correlation properties of most sets of spreading codes are either too complex to analyze or very difficult to compute when different transmissions are not synchronized, a random sequence model. In the case of moderate to large processing gains, Gaussian distribution with variable variance is a good approximation for the MAI distribution. One of the approaches to reduce MAI is to employ orthogonal spreading sequences, and try to synchronize the transmissions at the chip level (quasi-synchronization). However, this is generally difficult to achieve in multipoint-to-point systems, such as the reverse link (mobile-to-base) of a cellular system, due to a lack of synchronization of the various mobile terminals, and the variable transmission delays. In this paper, a multi-carrier DS-CDMA (MCDS-CDMA) scheme is employed to facilitate the synchronization process, and thus reduce MAI.

### SYSTEM MODEL

A model of the MS-DS-CDMA system for the kth user of a CDMA system is shown in the figure 1.

### TRANMSITTER MODEL

At the transmitter the user's data stream dk(t) is divided into M interleaved sub streams and spread by a spreading sequence ck(t) to a fraction 1/M of the entire transmission bandwidth W. The resultant chip sequences are then used to modulate M carrier. The carrier frequencies Ï‰m,m=1,2,...M are equally spaced by the chip rate so that they are mutually orthogonal over one channel symbol interval T. Let R be the information rate and Rc be the carrier control code rate then the channel symbol interval is

The data encoder is often crucial for performance of channels .The ned for interleaver depends on the channel characteristics and the multi-carrier scheme. For BPSK modulation scheme

The chip time is

They are uniformly distributed over (0,2Pi).

### CHANNEL MODEL:

The entire Bandwidth available for multicarrier transmission is much larger than the data rate. The channel is modelled for complex impulse response.

Î±k ,l â€“path amplitude

Ï‚k,l-delay spread

âˆ†fc-band width

A practical DS spectrum occupies a bandwidth much larger than âˆ†fc .

In MC-DS-CDMA system data are transmitted over parallel channels with bandwidth equal to fraction of W. The impulse response of sub channel is

Based on this model narrow band multi carrier schemes compared.

The channel output is

n(t)-AWGN( additive white Gaussian noise).

The time between sub-streams results from synchronization error and multi path delay.

### RECEIVER MODEL:

There are M branches in the receiver with each detecting the data substream from one sub channel .we are concerned with first sub channel .The time variation of fading is slow enough that the arrival time and phase of the desired signal can be acquired .The output of the low pass filter at the sampling point is

Imo, Jmo-MAI components from inside and outside functions of noise and so Soft decision is decoded serially and performed for channel fading.

### BER PERFORMANCE:

MC-DS-CDMA system performance measured by bit error rate through analysis and simulation.

### Analysis:

The BER is analysed based on the following:

1. Ortoganal spreading sequences with rectangular pulse shape are applied.

2.Î¶k,k=1...K are independent of random variables distributd in (-Î¶D,Î¶D) WHERE Î¶D=ÎµD+Ï‚D.Given W and Î¶D,M is chosen so that Î¶D<=TC.

3. It is assumed that the fading parameters of the desired user .

It is perfectly estimated so that the coherent detection and optimum soft decision decoding could be carried out at the receiver to make the problem analytically tractable. The fading amplitudes as independent Rayleigh random variables with equal second moments. The model is

Where N is spread spectrum processing gain

N=T/Tc .

The orthogonal spreading sequence is given by

For 0<n<N-1;

It is difficult to analyze the cross correlation properties of most practically used spreading sequence. In case of sequences with long period the sequence may be modeled as Bernouli process for the purpose of analysis. The correlation term is sum of +1 or -1 terms. When Nis moderate to large we may invoke the central limit theorem and model each term in the sum of as having a Gaussian distribution conditioned .The distribution has Zero man and the variance.

Which is a variable.

Where

Which is the received signal power P is constant for every signal stream when power control is assumed.

Is normalized range of time offset. It is seen that Imo does not depend on m0,.so m0 will be omitted in the sequel, and the average variance of I will be simply denoted as VI.

We can approximate this with Gaussian distribution

The average is given by

The optimum decoder combines the LPF output and forms Nc decision variables

Where Cij denotes the bit in the jth position of the ith code word ,mij denotes the sub channel number for the transmitting cij and Nc the total number of code words.assuming the code word c1 is transmitted for correct decoding,U1 must exceed all other decision variable Ui,i=2,3...,Nc.Let Si={j:C1Jâ‰ Cij}.

Instead of attempting to derive the exact error probability, we resort to a union bound. Let Pi =P(Âµi<0) Which is the probability of C1 being decoded Ci.

Pi depends not only on the hamming distance between C1 and C2 but also on the position of sub channels over which these different bits are transmitted because V is a function of m0.From the system performance point we need average error probability. To find the average decoded error probability we replace the term V by it is average.

The Hamming distance dmin is assumed between every pair of code words. For orthogonal codes like the Reed Muller (RM) code used in this scheme, the equal distance assumption turns out to be exact.

Mean is

Variance is

Conditional probability of error is

We are concerned with average system BER over a long period of transmission, the average interference variances VI and Vj are used in expressing average effect of the interference on the system performance. To find the unconditional error probability pi We need to find the PDF.

The PDF is

This is the average signal to noise plus interference ratio(SINR) per sub channel which can be further displayed as

Where SIR is defined as the average signal to interference ratio per sub channel

The closed form of solution

Probability for the function is

### MATLAB INTRODUCTION:

Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. It is a mainstay of the Mathematics Department software lineup and is also available for PC's and Macintoshes and may be found on the CIRCA VAXes. Matlab is well adapted to numerical experiments since the underlying algorithms for Matlab's builtin functions and supplied m-files are based on the standard libraries LINPACK and EISPACK.

Matlab program and script files always have filenames ending with ".m"; the programming language is exceptionally straightforward since almost every data object is assumed to be an array. Graphical output is available to supplement numerical results.

IMREAD Read image from graphics file.

A = IMREAD(FILENAME,FMT) reads a grayscale or color image from the file

Specified by the string FILENAME. If the file is not in the current directory, or in a directory on the MATLAB path, specify the full pathname. The text string FMT specifies the format of the file by its standard file extension. For example, specify 'gif' for Graphics Interchange Format files. To see a list of supported formats, with their file extensions, use the IMFORMATS function. If IMREAD cannot find a file named FILENAME, it looks for a file named FILENAME.FMT.

IMFINFO Information about graphics file.

INFO = IMFINFO(FILENAME,FMT) returns a structure whose fields contain information about an image in a graphics file. FILENAME is a string that specifies the name of the graphics file, and FMT is a string that specifies the format of the file. The file must be in the current directory or in a directory on the MATLAB path. If IMFINFO cannot find a file named FILENAME, it looks for a file named FILENAME.FMT.

IMWRITE Write image to graphics file.

IMWRITE(A,FILENAME,FMT) writes the image A to the file specified by

FILENAME in the format specified by FMT.

A can be an M-by-N (grayscale image) or M-by-N-by-3 (color image) array. A cannot be an empty array. If the format specified is TIFF, IMWRITE can also accept an M-by-N-by-4 array containing color data that uses the CMYK color space.

FILENAME is a string that specifies the name of the file.

SIZE Size of array.

D = SIZE(X), for M-by-N matrix X, returns the two-element row vector D = [M,N] containing the number of rows and columns in the matrix. For N-D arrays, SIZE(X) returns a 1-by-N vector of dimension lengths. Trailing singleton dimensions are ignored.

[M,N] = SIZE(X) for matrix X, returns the number of rows and columns in

X as separate output variables.

IMSHOW Display image in Handle Graphics figure.

IMSHOW (I) displays the grayscale image I. IMSHOW(I,[LOW HIGH]) displays the grayscale image I, specifying the display range for I in [LOW HIGH]. The value LOW (and any value less than LOW) displays as black, the value HIGH (and any value greater than HIGH) displays as white. Values in between are displayed as intermediate shades of gray, using the default number of gray levels. If you use an empty matrix ([]) for [LOW HIGH], IMSHOW uses [min(I(:)) max(I(:))]; that is, the minimum value in I is displayed as black, and the maximum value is displayed as white.

MEAN Average or mean value.

For vectors, MEAN(X) is the mean value of the elements in X. For matrices, MEAN(X) is a row vector containing the mean value of each column. For N-D arrays, MEAN(X) is the mean value of the elements along the first non-singleton dimension of X.

MIN Smallest component.

For vectors, MIN(X) is the smallest element in X. For matrices, MIN(X) is a row vector containing the minimum element from each column. For N-D arrays, MIN(X) operates along the first non-singleton dimension.

MAX Largest component.

For vectors, MAX(X) is the largest element in X. For matrices, MAX(X) is a row vector containing the maximum element from each column. For N-D arrays, MAX(X) operates along the first non-singleton dimension.

DOUBLE Convert to double precision.

DOUBLE(X) returns the double precision value for X. If X is already a double precision array, DOUBLE has no effect.

DOUBLE is called for the expressions in FOR, IF, and WHILE loops if the expression isn't already double precision. DOUBLE should be overloaded for all objects where it makes sense to convert it into a double precision value.

RAND Uniformly distributed pseudo-random numbers.

R = RAND(N) returns an N-by-N matrix containing pseudo-random values drawn from a uniform distribution on the unit interval.

RAND(M,N) or RAND([M,N]) returns an M-by-N matrix.

RAND(M,N,P,...) or RAND([M,N,P,...]) returns an M-by-N-by-P-by-... array.

RAND with no arguments returns a scalar.

RAND(SIZE(A)) returns an array the same size as A.

### PROGRAMS

1. Comparision of performance sensitivities to the variation of the number of users between MC-DS-CDMA and SC-DS-CDMA.

clear all;

close all;

clc;

%%

no_of_user=40;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh=hadamard(no_of_sub);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate(i)= errors_user1/N;

end

%% 70

no_of_user=70;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh=hadamard(no_of_sub);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate1(i)= errors_user1/N;

end

%% SC

n=6;k=4;

N1 = 10^4;

no_of_user=40;

for ku=1:no_of_user

ip1{ku} = rand(1,N1)>0.5;

end

ip=cell2mat(ip1);

ip2=encode(double(ip),n,k,'cyclic');

loc=randperm(length(ip2));

ip3=intrlv(ip2,loc);

s = 2*ip3-1;

N=length(s);

Eb_N0_dB = [0:2:8];

no_of_sub=6;

for jj = 1:length(no_of_sub)

for ii = 1:length(Eb_N0_dB)

n1 = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

h = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

sD = kron(ones(no_of_sub(jj),1),s);

y = h.*sD + 10^(-Eb_N0_dB(ii)/20)*n1;

yHat = y.*exp(-j*angle(h));

yHat = sum(yHat,1);

ipHat = real(yHat)>0;

ipde1=deintrlv(uint8(ipHat),loc);

ipde3=decode((ipde1),n,k,'cyclic');

nErr(jj,ii) = size(find([ip- ipde3]),2);

end

end

bit_error_rate2 = nErr/N;

%% 70

n=6;k=4;

N1 = 10^4;

no_of_user=70;

for ku=1:no_of_user

ip1{ku} = rand(1,N1)>0.5;

end

ip=cell2mat(ip1);

ip2=encode(double(ip),n,k,'cyclic');

loc=randperm(length(ip2));

ip3=intrlv(ip2,loc);

s = 2*ip3-1;

N=length(s);

Eb_N0_dB = [0:2:8];

no_of_sub=6;

for jj = 1:length(no_of_sub)

for ii = 1:length(Eb_N0_dB)

n1 = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

h = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

sD = kron(ones(no_of_sub(jj),1),s);

y = h.*sD + 10^(-Eb_N0_dB(ii)/20)*n1;

yHat = y.*exp(-j*angle(h));

yHat = sum(yHat,1);

ipHat = real(yHat)>0;

ipde1=deintrlv(double(ipHat),loc);

ipde3=decode(ipde1,n,k,'cyclic');

nErr(jj,ii) = size(find([ip- ipde3]),2);

end

end

bit_error_rate3 = nErr/N;

fig

legend('40 user MC CDMA ','70 user MC CDMA','40 user SC CDMA ','70 user SC CDMA');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

2. Effect of error control coding on MC-DS-CDMA and SC-DS-CDMA systems.

clear all;

close all;

clc;

%%

no_of_user=70;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

datamod = 2*data{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N;

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

out_data=recdata12;

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate(i)= errors_user1/N;

end

%% 70

no_of_user=70;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)*i/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate1(i)= errors_user1/(N*i);

end

%% SC

n=6;k=4;

N1 = 10^4;

no_of_user=70;

for ku=1:no_of_user

ip1{ku} = rand(1,N1)>0.5;

end

ip=cell2mat(ip1);

s = 2*ip-1;

N=length(s);

Eb_N0_dB = [0:2:8];

no_of_sub=6;

for jj = 1:length(no_of_sub)

for ii = 1:length(Eb_N0_dB)

n = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

h = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

sD = kron(ones(no_of_sub(jj),1),s);

y = h.*sD + 10^(-Eb_N0_dB(ii)/20)*n;

yHat = y.*exp(-j*angle(h));

yHat = sum(yHat,1);

ipHat = real(yHat)>0;

nErr(jj,ii) = size(find([ip- ipHat]),2);

end

end

bit_error_rate2 = nErr/N;

%% 70

nn=6;kk=4;

N1 = 10^4;

no_of_user=70;

for ku=1:no_of_user

ip1{ku} = randint(1,N1,2);

end

ip=cell2mat(ip1);

ip2=encode(ip,nn,kk,'cyclic');

loc=randperm(length(ip2));

ip3=intrlv(ip2,loc);

s = 2*ip3-1;

N=length(s);

Eb_N0_dB = [0:2:8];

no_of_sub=6;

for jj = 1:length(no_of_sub)

for ii = 1:length(Eb_N0_dB)

n = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

h = 1/sqrt(2)*[randn(no_of_sub(jj),N) + j*randn(no_of_sub(jj),N)];

sD = kron(ones(no_of_sub(jj),1),s);

y = h.*sD + 10^(-Eb_N0_dB(ii)/20)*n;

yHat = y.*exp(-j*angle(h));

yHat = sum(yHat,1);

ipHat = real(yHat)>0;

ipde1=deintrlv(uint8(ipHat),loc);

ipde3=decode((ipde1),nn,kk,'cyclic');

nErr(jj,ii) = size(find([ip- ipde3]),2);

end

end

bit_error_rate3 = nErr/N;

fig

legend('70 user MC CDMA without code ','70 user MC CDMA with','70 user SC CDMA without code','70 user SC CDMA with code');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

3. MC-DS-CDMA performance using different pulse shapes.

%% 70

no_of_user=70;

no_of_sub =8;

N=10^3;

fs = N/2;

t = -5:1/fs:5;

pulse_rectvalue = rectpuls(t,20e-6);

pulse_value=pulse_rectvalue(1:N);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=double(xor(data{ku},pulse_value));

mess= encode((msg),n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:1:18];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate1(i)= errors_user1/N;

end

%% sinc

no_of_user=70;

no_of_sub =8;

N=10^3;

Nk=N;

fs = Nk/2;

t = linspace(-5,5,Nk);

pulse_sin =sinc(t)>0.05;

pulse_value1=pulse_sin(1:Nk);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=double(xor(data{ku},pulse_value));

mess= encode((msg),n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = (2*intr_lve{ku}-1);

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:1:18];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-(snr(i))/10))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate2(i)= errors_user1/(N);

end

fig

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

4. MC-DS-CDMA system performance under different fading amplitude correlation assumptions.

clear all;

close all;

clc;

%% 70

no_of_user=70;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate1(i)= errors_user1/N;

end

%%

%% 70

no_of_user=70;

no_of_sub =8;

N=10^3;

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku})

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/1.6;

p2=0.9/1.5;

p3=0.7/1.3;

p4=0.2/0.4;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0:2:8];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku})

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_error_rate2(i)= errors_user1/N;

end

fig

legend('ucorrelation ','correlation');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

5. MC-DS-CDMA system performance versus the number of subchannels.

clear all

clc

close all

no_of_user=70;

sub_ch=[4 8 16 32];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=4;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=4;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=4;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [10];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate1(ksub)=bit_errorx1;

end

clear x13 x14 x15

%%

no_of_user=70;

sub_ch=[4 8 16 32];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=2;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=2;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [10];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/15))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate2(ksub)=bit_errorx1;

end

clear x13 x14 x15

%%

no_of_user=70;

sub_ch=[4 8 16 32];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=1;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=1;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [10];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/10))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate3(ksub)=bit_errorx1;

end

%% plot

fig

axis([4 32 10^-3 10^0]);

legend('delay case1 ','delay case2','delay case3');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

6. MC-DS-CDMA system performance versus the number of subchannels without interleaving and with interleaving for different delay spreads

clear all;

close all;

clc;

%%

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

datamod = 2*data{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N;

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

out_data=recdata12;

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx(i)= errors_user1/N;

end

bit_error_rate(ksub)=bit_errorx;

end

%%

clear x13 x14 x15

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub)

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=1;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=2;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate1(ksub)=bit_errorx1;

end

fig

axis([4 16 10^-2 10^0]);

legend('without inter ','with inter');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;

clear all;

close all;

clc;

%%

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

datamod = 2*data{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N;

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=8;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=8;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=8;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

out_data=recdata12;

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx(i)= errors_user1/N;

end

bit_error_rate(ksub)=bit_errorx;

end

%%

clear x13 x14 x15

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub)

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=8;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=8;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=8;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(20)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate1(ksub)=bit_errorx1;

end

fig

axis([4 16 10^-1 10^0]);

legend('without inter ','with inter');

title('performance');

xlabel('sub channel');

ylabel('bit error rate');

grid on;

clear all;

close all;

clc;

%%

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub);

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

datamod = 2*data{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1

locy=locx+(N-1)

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N;

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=3;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=3;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

out_data=recdata12;

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx(i)= errors_user1/N;

end

bit_error_rate(ksub)=bit_errorx;

end

%%

clear x13 x14 x15

no_of_user=50;

sub_ch=[4 8 16];

N=10^3;

for ksub=1:length(sub_ch)

no_of_sub =sub_ch(ksub)

%%

length_mess=no_of_user*N;

walsh1=hadamard(no_of_sub);

walsh=REEDMULER(walsh1);

kux=1;

for ku=1:no_of_user

code{ku}=walsh(kux,:);

kux=kux+1;

if(kux==no_of_sub)

kux=1;

end

end

n = 6; k = 4; % Set codeword length and message length % for a [6,4] code.

%%

original_message=randint(1,length_mess,2);

locx=1;

locy=N;

for ku=1:no_of_user

data{ku}= original_message(locx:locy);

msg=data{ku};

mess= encode(msg,n,k,'cyclic'); % Code will be a binary column.

len=length(mess);

ele{ku}=randperm(len);

intr_lve{ku}=intrlv(mess,ele{ku});

datamod = 2*intr_lve{ku}-1;

user_data_mod{ku}=datamod';

locx=locy+1;

locy=locx+(N-1);

end

%%

for ku=1:no_of_user

data_user11=user_data_mod{ku};

spdata1_user1=data_user11*(code{ku});

spdata12=(spdata1_user1)';

ifftdata_user1=ifft(spdata12);

ifftdata12=ifftdata_user1';

y1=[ifftdata12(:,[(no_of_sub-2):no_of_sub]) ifftdata12];

transdata1=y1';

tx_user=transdata1;

sp_data{ku}=tx_user;

end

%%

tx_data_final=zeros(size(sp_data{1}));

for ku=1:no_of_user

tx_data_final=tx_data_final+sp_data{ku};

end

%%

for ku=2:no_of_user

N1=N*(n/k);

Taps=4;

p1=0.5/2.3;

p2=0.9/2.3;

p3=0.7/2.3;

p4=0.2/2.3;

gain1=sqrt(p1/2)*[randn(1,N1) + j*randn(1,N1)];

gain2=sqrt(p2/2)*[randn(1,N1) + j*randn(1,N1)];

gain3=sqrt(p3/2)*[randn(1,N1) + j*randn(1,N1)];

gain4=sqrt(p4/2)*[randn(1,N1) + j*randn(1,N1)];

tx_data_final=sp_data{ku-1}+sp_data{ku};

x11=tx_data_final(:);

x12=reshape(x11,1,length(x11));

i=1:length(x12);

%%

delay1=3;

for i=delay1+1:length(x12)

x13(i)=tx_data_final(i-delay1);

end

delay2=3;

for i=delay2+1:length(x12)

x14(i)=tx_data_final(i-delay2);

end

delay3=3;

for i=delay3+1:length(x12)

x15(i)=tx_data_final(i-delay3);

end

x1=reshape(x13,(no_of_sub+3),length(x13)/(no_of_sub+3));

x2=reshape(x14,(no_of_sub+3),length(x14)/(no_of_sub+3));

x3=reshape(x15,(no_of_sub+3),length(x15)/(no_of_sub+3));

ch1=repmat(gain1,(no_of_sub+3),1);

ch2=repmat(gain2,(no_of_sub+3),1);

ch3=repmat(gain3,(no_of_sub+3),1);

ch4=repmat(gain4,(no_of_sub+3),1);

data_channel=(tx_data_final).*ch1+x1.*ch2+x2.*ch3+x3.*ch4;

data_noise1=data_channel(:);

data_noise2=reshape(data_noise1,1,length(data_noise1));

end

%%

noise = 1/sqrt(2)*[randn(1,length(data_noise2)) + j*randn(1,length(data_noise2))];

snr = [0];

for i = 1:length(snr)

y = data_noise2 + (sqrt(1)*10^(-snr(i)/20))*noise; %Addition of Noise

data_received =y;

rx1=reshape(data_received,(no_of_sub+3),length(data_received)/(no_of_sub+3));

rx12=rx1';

rx13 = rx12(:,[(4:(no_of_sub+3))]);

rx14=rx13';

fft_data_received =fft(rx14);

channel_response=fft([gain1;gain2;gain3;gain4],no_of_sub);

data_equilized=fft_data_received.*conj(channel_response);

ku=no_of_user;

recdata11=(data_equilized'*(code{ku})')';

recdata12=real(recdata11)>0;

mess1=deintrlv(uint8(recdata12),ele{ku});

out_data= decode(double(mess1),n,k,'cyclic'); % Code will be a binary column.

errors_user1= size(find([data{ku}- out_data]),2);

bit_errorx1= errors_user1/N;

end

bit_error_rate1(ksub)=bit_errorx1;

end

fig

axis([4 16 10^-1 10^0]);

legend('without inter ','with inter');

title('performance');

xlabel('SNR value');

ylabel('bit error rate');

grid on;