# Digital Signal Processing (DSP) and CDMA Advantages

**Disclaimer:** This dissertation has been submitted by a student. This is not an example of the work written by our professional dissertation writers. You can view samples of our professional work here.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.

### 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:

- Image processing (pattern recognition, robotic vision, image enhancement, facsimile, satellite weather map, animation)
- Instrumentation and control (spectrum analysis, position and rate control, noise reduction, data compression)
- Speech and audio (speech recognition, speech synthesis, text to speech, digital audio, equalisation)
- Military (secure communication, radar processing, sonar processing, missile guidance)
- Telecommunications (echo cancellation, adaptive equalisation, spread spectrum, video conferencing, data communication)
- 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

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 .

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

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

### 3.3 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.

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

## POWERCONTROLCDMA 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 ## HANDOVERHandover 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

### 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:

- Ortoganal spreading sequences with rectangular pulse shape are applied.
- ζ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.
- 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

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

figure,semilogy(snr,bit_error_rate,'r*:',snr,bit_error_rate1,'g>:',snr,bit_error_rate2,'ys-',snr,bit_error_rate3,'kd-','linewidth',2);

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;

figure,semilogy(snr,bit_error_rate,'r*:',snr,bit_error_rate1,'k<-.',snr,bit_error_rate2,'g>-',snr,bit_error_rate3,'ms:','linewidth',2);

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

figure,semilogy(snr,bit_error_rate1,'r*:',snr,bit_error_rate2,'ks-','linewidth',2);

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

### Cite This Dissertation

To export a reference to this article please select a referencing stye below: