Simulation environment for Software Defined Radio with application to Wideband CDMA

Similar documents
Technical Aspects of LTE Part I: OFDM

Multiplexing Module W.tra.2

A Simulation Tool for Third Generation CDMA Systems Presentation to IEEE Sarnoff Symposium

W-CDMA for UMTS Principles

PERFORMANCE ANALYSIS OF DOWNLINK POWER CONTROL IN WCDMA SYSTEM

Transmit Diversity Schemes for CDMA-2000

Lecture 9: Spread Spectrum Modulation Techniques

Level 6 Graduate Diploma in Engineering Wireless and mobile communications

CDMA - QUESTIONS & ANSWERS

SC - Single carrier systems One carrier carries data stream

Spread Spectrum Techniques

Chapter 7. Multiple Division Techniques

Mobile and Personal Communications. Dr Mike Fitton, Telecommunications Research Lab Toshiba Research Europe Limited

Multiple Access Schemes

Lab 3.0. Pulse Shaping and Rayleigh Channel. Faculty of Information Engineering & Technology. The Communications Department

Mobile Communication Systems. Part 7- Multiplexing

SPREAD SPECTRUM (SS) SIGNALS FOR DIGITAL COMMUNICATIONS

Spread Spectrum. Chapter 18. FHSS Frequency Hopping Spread Spectrum DSSS Direct Sequence Spread Spectrum DSSS using CDMA Code Division Multiple Access

RADIO LINK ASPECT OF GSM

CDMA Principle and Measurement

WCDMA Basics Chapter 2 OBJECTIVES:

ECS455: Chapter 4 Multiple Access

Chapter 2 Channel Equalization

Lecture 3 Cellular Systems

About Homework. The rest parts of the course: focus on popular standards like GSM, WCDMA, etc.

ETSI SMG#24 TDoc SMG 903 / 97. December 15-19, 1997 Source: SMG2. Concept Group Alpha - Wideband Direct-Sequence CDMA: System Description Summary

Lecture LTE (4G) -Technologies used in 4G and 5G. Spread Spectrum Communications

DESIGN AND IMPLEMENTATION OF WCDMA RAKE RECEIVER USED IN 3G WIRELESS COMMUNICATION

CHAPTER 4 PERFORMANCE ANALYSIS OF THE ALAMOUTI STBC BASED DS-CDMA SYSTEM

Part 3. Multiple Access Methods. p. 1 ELEC6040 Mobile Radio Communications, Dept. of E.E.E., HKU

Implementation of Different Interleaving Techniques for Performance Evaluation of CDMA System

ECS455: Chapter 4 Multiple Access

EC 551 Telecommunication System Engineering. Mohamed Khedr

Spread Spectrum Basics Spreading Codes IS-95 Features- Transmitter/Receiver Power Control Diversity Techniques RAKE Receiver Soft Handoff

<3rd generation CDMA wireless systems>

Simple Algorithm in (older) Selection Diversity. Receiver Diversity Can we Do Better? Receiver Diversity Optimization.

A MULTICARRIER CDMA ARCHITECTURE BASED ON ORTHOGONAL COMPLEMENTARY CODES FOR NEW GENERATION OF WIDEBAND WIRELESS COMMUNICATIONS

Mobile & Wireless Networking. Lecture 2: Wireless Transmission (2/2)

Multirate schemes for multimedia applications in DS/CDMA Systems

Cognitive Radio Transmission Based on Chip-level Space Time Block Coded MC-DS-CDMA over Fast-Fading Channel

Page 1. Overview : Wireless Networks Lecture 9: OFDM, WiMAX, LTE

Abstract. Marío A. Bedoya-Martinez. He joined Fujitsu Europe Telecom R&D Centre (UK), where he has been working on R&D of Second-and

Wireless Medium Access Control and CDMA-based Communication Lesson 14 CDMA2000

Wireless Networks (PHY): Design for Diversity

Wireless Transmission in Cellular Networks

Wireless Communication: Concepts, Techniques, and Models. Hongwei Zhang

CDMA & WCDMA (UMTS) AIR INTERFACE. ECE 2526-WIRELESS & CELLULAR COMMUNICATION SYSTEMS Monday, June 25, 2018

UNIK4230: Mobile Communications. Abul Kaosher

Comparative Analysis of the BER Performance of WCDMA Using Different Spreading Code Generator

T325 Summary T305 T325 B BLOCK 3 4 PART III T325. Session 11 Block III Part 3 Access & Modulation. Dr. Saatchi, Seyed Mohsen.

Lecture 3: Wireless Physical Layer: Modulation Techniques. Mythili Vutukuru CS 653 Spring 2014 Jan 13, Monday

Multiple Antenna Processing for WiMAX

2: Diversity. 2. Diversity. Some Concepts of Wireless Communication

Performance Evaluation Of Digital Modulation Techniques In Awgn Communication Channel

ISHIK UNIVERSITY Faculty of Science Department of Information Technology Fall Course Name: Wireless Networks

Performance Evaluation of ½ Rate Convolution Coding with Different Modulation Techniques for DS-CDMA System over Rician Channel

Comparative Study of OFDM & MC-CDMA in WiMAX System

Communications Theory and Engineering

Cellular Network Planning and Optimization Part VI: WCDMA Basics. Jyri Hämäläinen, Communications and Networking Department, TKK, 24.1.

Spread Spectrum: Definition

Diversity. Spring 2017 ELE 492 FUNDAMENTALS OF WIRELESS COMMUNICATIONS 1

RESEARCH ON METHODS FOR ANALYZING AND PROCESSING SIGNALS USED BY INTERCEPTION SYSTEMS WITH SPECIAL APPLICATIONS

ALi Linear n-stage t ShiftRegister output tsequence

Multipath signal Detection in CDMA System

OFDMA and MIMO Notes

The 5th Smart Antenna Workshop 21 April 2003, Hanyang University, Korea Broadband Mobile Technology Fumiyuki Adachi

Interleaved spread spectrum orthogonal frequency division multiplexing for system coexistence

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE FADING CHANNEL CHARACTERIZATION AND MODELING

CHAPTER 6 SPREAD SPECTRUM. Xijun Wang

SNS COLLEGE OF ENGINEERING COIMBATORE DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK

ETSI SMG#24 TDoc SMG2 898 / 97 Madrid, Spain December 15-19, 1997 Source: SMG2. Concept Group Delta WB-TDMA/CDMA: Evaluation Summary

3G TECHNOLOGY WHICH CAN PROVIDE AUGMENTED DATA TRANSFER RATES FOR GSM STANDARTS AND THE MODULATION TECHNIQUES

WCDMA / UMTS. Principle of Spectrum Spreading. Frequency used

Multiple Access Techniques

Combined Transmitter Diversity and Multi-Level Modulation Techniques

Lecture 12: Summary Advanced Digital Communications (EQ2410) 1

History of the Digital Mobile Radio Systems in NTT & DoCoMo

ECE 476/ECE 501C/CS Wireless Communication Systems Winter Lecture 9: Multiple Access, GSM, and IS-95

Mobile Communications TCS 455

PERFORMANCE EVALUATION OF WCDMA SYSTEM FOR DIFFERENT MODULATIONS WITH EQUAL GAIN COMBINING SCHEME

CHAPTER 3 ADAPTIVE MODULATION TECHNIQUE WITH CFO CORRECTION FOR OFDM SYSTEMS

Link Adaptation in Mobile Communication Networks

FPGA Simulation of WCDMA Baseband Receiver Carrier Synchronization Unit

MIMO Systems and Applications

Exam 3 is two weeks from today. Today s is the final lecture that will be included on the exam.

Dynamic bandwidth direct sequence - a novel cognitive solution for ultra-wideband communications

Chapter 7 Multiple Division Techniques for Traffic Channels

CDMA Mobile Radio Networks

MODULATION AND MULTIPLE ACCESS TECHNIQUES

The Parametric Analysis of Gaussian Pulse Shaping Filter in WCDMA Network

QUESTION BANK SUBJECT: DIGITAL COMMUNICATION (15EC61)

Wireless Networks: An Introduction

CHAPTER 5 DIVERSITY. Xijun Wang

Performance of Wideband Mobile Channel with Perfect Synchronism BPSK vs QPSK DS-CDMA

An Overview of the QUALCOMM CDMA Digital Cellular Proposal

OFDM and MC-CDMA A Primer

AN IMPROVED WINDOW BLOCK CORRELATION ALGORITHM FOR CODE TRACKING IN W-CDMA

Evolution of Cellular Systems. Challenges for Broadband Wireless Systems. Convergence of Wireless, Computing and Internet is on the Way

Further Vision on TD-SCDMA Evolution

Chapter 5 3G Wireless Systems. Mrs.M.R.Kuveskar.

Transcription:

Simulation environment for Software Defined Radio with application to Wideband CDMA Master of Science Thesis in Electronic System Design by Weisheng Zhong Stockholm, January 2007 Supervisor: Svante Signell Jinliang Huang Examiner: Svante Signell

ABSTRACT Software Defined Radio (SDR) switches across various wireless air interfaces by using a programmable and dynamically reconfigurable method and Wideband Code Division Multiple Access (WCDMA) is a promising candidate to be adopted into SDR. We implement WCDMA system in a SDR workbench in Matlab/Octave environment. Two scenarios are considered in this thesis. In non-adaptive scheme, the Channel State Information (CSI) is not known at the transmitter side. The signals are transmitted in a fixed rate and modulation method. In adaptive scheme, the transmitter has complete and accurate knowledge of the CSI so that adaptive modulation is applied to achieve high data rate transmission under a target BER. The performance of WCDMA is examined in both flat Rayleigh fading and frequency selective Rayleigh fading channel. In an attempt to accelerate simulation speed in Matlab/Octave, mixed C++/Matlab and C++/Octave programming is employed. It turns out that programming using C++/Matlab is more efficient than the Matlab code only when the size of matrix is not larger than 25; the simulation speed is slowed down by programming C++/Octave compared to Octave. ii

Acknowledgments This thesis work was carried out at the School of Information and Communication Technology (ICT), KTH. I would like to thank my advisor Prof. Svante Signell for giving me this opportunity and the valuable guidance and comments. I would also thank my advisor Jinliang Huang for always offering suggestions and discussions throughout the thesis work. I also would like to thank my parents for their consistent encouragement and support. Specially, I want to take the opportunity and express my deepest regards to all my friends for many great helps with my thesis research and graduate study. iii

Contents Abstract... ii Acknowledgments... iii Contents...iv List of Figures... vii List of Tables... vii Abbreviations... viii Chapter 1 Introduction...1 1.1 WCDMA...1 1.2 Programming using Matlab/Octave...1 and C++...1 1.3 Thesis Outline...3 Chapter 2 Overview of Previous Work...4 2.1 Introduction to Software Defined Radio...4 2.2 3G air interface Fundamentals...4 2.3 Workbench Architecture...8 Chapter 3 WCDMA Simulation...10 3.1 Characteristics...10 3.1.1 Background...10 3.1.2 Characteristics...10 3.2 Spreading and Despreading...11 3.2.1 Direct Sequence Spread spectrum...13 3.2.2 Pseudorandom Sequences (Spreading Codes)...15 3.3 Multipath Radio Channel...16 3.4 Rake receiver...17 3.5 WCDMA Simulation results in SDR-WB...21 3.5.1 Flat Fading Channel...21 3.5.1.1 Non-Adaptive Scheme...21 3.5.1.2 Adaptive Scheme...22 3.5.2 Frequency Selective Fading Channel...24 3.5.2.1 Frequency Selective Fading Channel with Non-adaptive Scheme...25 3.5.2.2 Frequency Selective Fading Channel with Adaptive Scheme...26 Chapter 4 Programming using Matlab/Octave and C++...28 4.1 Introduction...28 4.1.1 Matlab and Interface Function MEX file...28 4.1.2 Octave and Interface Function OCT file...29 iv

4.2 Methodlogy...30 4.2.1 Performance Analysis...30 4.2.2 MEX File Programming...32 4.2.3 OCT File Programming...32 4.3 Numerical Results...33 4.3.1 Programming using Matlab and C++...33 4.3.2 Programming using Octave and C++...34 4.4 Conclusion...36 Chapter 5 Conclusions and Future Work...37 5.1 Conclusions...37 5.2 Future Work...37 Appendix A MEX FILE...38 Appendix B DLL FILE...45 Bibliography...49 v

List of Figures 2.1 System block diagram...8 2.2 Block diagrams of TX and RX...9 3.1 Direct Sequence Spread Spectrum...13 3.2 Transmitted signals in DS-CDMA system...13 3.3 Power spectral density of baseband signal and SS signal...14 3.4 Power spectral density of baseband SS signal and Noise...14 3.5 Power spectral density of baseband SS signal and Interference...15 3.6 Block diagram of a generalized feedback shift register with m stages...15 3.7 Fast Rayleigh fading as caused by multipath propagation...16 3.8 A Spread Spectrum System with RAKE receiver...17 3.9 Rake Receiver Architecture with L branches...19 3.10 Performance comparation of the three combining methods...20 3.11 Average BER for BPSK and QPSK over a Rayleigh fading channel...22 3.12 Throughput of an adaptive system in a Flat Rayleigh fading channel...23 3.13 Throughput of the adaptive system for different target BER...24 3.14 BER versus SNR over a frequency selective Rayleigh fading channel...25 3.15 Comparison of BER versus SNR in Flat FC and FS fading channel...26 3.16 Throughput of adaptive system in a Frequency Selective fading channel...27 3.17 Throughput of the adaptive system for different target BER...27 4.1 Time spent on the functions...30 4.2 Time spent on the sub-lines...31 4.3 Time spent on the lines...31 4.4 Time costs in the MATLAB multiplication with large matrix-size...33 4.5 Time costs in the MATLAB multiplication with small matrix-size...34 4.6 Time costs in the OCTAVE multiplication with small matrix-size...35 4.7 Time costs in the OCTAVE multiplication with large matrix-size...35 vi

List of Tables 2.1 Main differences between WCDMA and GSM air interfaces...5 2.2 Main differences between WCDMA and IS-95 air interfaces...6 2.3 A comparison of major physical layer operational parameters of WCDMA, CDMA2000 and TD-SCDMA standards...7 3.1 Direct Sequence Spread Spectrum Diagram...11 vii

Abbreviations 3G 3GPP AWGN BER BPSK CDMA CLPCF CSI DS-CDMA FDD FDMA GSM IID IMT-2000 ISI MIMO OFDM OVSF PCBC PSBC QAM QoS QPSK SNR TDD UMTS VSF TD-SCDMA WCDMA 3rd Generation 3rd Generation partnership project Additive white Gaussian noise Bit error rate Binary phase shift keying Code division multiple access Closed loop power control frequency Channel State Information Direct spread code division multiple access Frequency Division Duplex Frequency division multiple access Global System for Mobile Communications independent and identical distributed. International mobile telephony, 3rd generation networks are referred as IMT-2000 within ITU Intersymbol Interference Multiple-input multiple-output Orthogonal Frequency Division Multiplexing Orthogonal variable spreading factor Pilot channel based coherent Pilot symbol based coherent Quadrature amplitude modulation Quality of service Quadrature phase shift keying Signal to noise ratio Time Division Duplex Universal mobile telecommunication services Variable spreading factor Time division synchronous CDMA Wideband CDMA, Code division multiple access viii

Chapter 1 Introduction 1.1 WCDMA The goal for the next generation of mobile communications system is to seamlessly provide a wide variety of communication services to anybody, anywhere, anytime. The intended service for next generation mobile phone users includes services like transmitting high speed data, video and multimedia traffic as well as voice signals. The technology needed to tackle the challenges to make these services available is popularly known as the Third Generation (3G) Cellular Systems. The first generation systems are represented by the analog mobile systems designed to carry the voice application traffic. The subsequent digital counterparts are known as second generation cellular systems. Third generation systems mark a significant leap, both in applications and capacity, from the current second generation standards. Whereas the current digital mobile phone systems are optimized for voice communications, 3G communicators are oriented towards multimedia message capability. Third generation systems are designed for multimedia communication: person to person communication can be enhanced with high quality images and video, and access to information and services on public and private networks will be enhanced by the higher data rates and new flexible communication capabilities of third generation systems. Nowadays, WCDMA technology has emerged as the most widely adopted third generation air interface [3]. The principles of the WCDMA will be introduced in detail in Chapter 3. 1.2 PROGRAMMING USING MATLAB/OCTAVE AND C++ Today software is used to solve complex numerical problems in a wide variety of 1

environments. Therefore the software and the mathematical algorithms need to run on various inhomogeneous hardware components, employing small specialized mobile devices as well as high performance mainframes. Interactive array languages such as Matlab and Octave have proven to be effective development tools for numerical algorithms. Comparing with conventional languages, such as C++, many programmers consider that using array languages is easier to prototype algorithms. The main reason is the interactive nature of the language, which facilitates debugging and analysis [4]. Another, in these languages it is not necessary to specify the dimension or type of arrays. Though static typing decreases the probability of programming errors, the practice of omitting types is a convenient feature to programmers. The third, these languages also offer a rich set of functions and higher-level operators for matrix manipulation. At the same time, however, the drawback is that interactive array languages are executed with interpreters, which often makes programs inefficient. The interpreter is parsing the program, allocating storage for variables dynamically, and determining at runtime which version of the operations to invoke. This way type declared, which are omitted in Octave, are set dynamically at runtime. In fact, most of the execution time is wasted doing work that could be done once before deploying the software, at compile time. Because of these downsides, interactive array languages are used only for the prototyping of algorithms. Later the algorithm is re-implemented in a conventional language, such as C++. An alternative would be to analyze and translate interactive array languages using the interface functions to improve the efficient of the simulation environment. MEX-Files are a way to call our custom C++ routines directly from MATLAB as if they were MATLAB built-in functions. On Octave, it can also dynamically load and execute functions written in C++. Octave can only directly call functions written in C++, but we can also load functions written in other languages by calling them from a simple wrapper function written in C++ [16]. We discussed the estimation on both of the two systems and a detailed result analysis will be given in Chapter 4. 2

1.3 THESIS OUTLINE The introduction of this workbench architecture, which is the basic simulation environment for SDR is presented in Chapter 2. This architecture is based on the existed simulation environment, but refined to fit the needs of this thesis. The brief description of key characteristics of WCDMA system is provided in Chapter 3. In this Chapter, the physical layer of the WCDMA system is described in detail. The WCDMA simulation results in SDR-WB are also described in this chapter. The improvement of the efficiency of the simulation workbench is discussed in Chapter 4. Both Matlab and Octave have their own interface function of C++ program. We tried to call C functions from Matlab and Octave in the simulation codes of MIMO-OFDM. The results are shown and the analysis follows. Finally Chapter 5 gives a conclusion and directions for further research. 3

Chapter 2 Overview of Previous Work 2.1 INTRODUCTION TO SOFTWARE DEFINED RADIO Traditional communications systems have typically been implemented using custom hardware solutions [1]. Even with a single communication system the hardware development cycle is onerous. While multiple communications systems requirements are considered, both silicon area and design validation are major inhibitors to commercial success. Most radios are hardware defined with little or no software control, and they are fixed in function for mostly consumer items for broadcast reception. They have a short life and are designed to be discarded and replaced. Software defined radio (SDR) is an exciting new field for the wireless industry; it is gaining momentum and beginning to be included in commercial and defense products. The technology offers the potential to revolutionize the way radios are designed, manufactured, deployed, and used. SDR promises to increase flexibility, extend hardware lifetime, lower costs, and reduce time to market [2]. The basic definition of SDR can be summarized like that: SDR is a kind of open system structure which connects modular and standardized hardware units by way of bus to form a basic platform and accomplish different wireless communication functions through the software control. 2.2 3G AIR INTERFACE FUNDAMENTALS Analog cellular systems are commonly referred to as first generation systems. The digital systems currently in use, such as GSM, PDC, CDMA-One (IS-95) and US-TDMA (IS-136), are second generation systems. These systems have enabled voice communications to go wireless in many of the leading markets, and customers are increasingly finding value also in other services, 4

such as text messaging and access to data networks, which are starting to grow rapidly. Now, the third generation systems have been played an important role in the modern communication. As we mentioned before, WCDMA technology has emerged as the most widely adopted third generation air interface. The main differences between the third and second generation air interfaces are described. GSM and IS-95 (the standard for CDMA-One systems) are considered as the main second generation air interfaces here [3]. Table 2.1 lists the main differences between WCDMA and GSM, and Table 2.2 lists the main differences between WCDMA and IS-95. In this comparison only the air interface is considered. Table 2.1 Main differences between WCDMA and GSM air interfaces WCDMA GSM Carrier spacing 5MHz 200kHz Frequency reuse factor 1 1-18 Power control frequency 1500Hz 2Hz or lower Quality control Radio resource management algorithms Network planning (frequency planning) Frequency diversity 5MHz bandwidth gives Frequency hopping multipath diversity with Rake receiver Packet data Load-based packet scheduling Time slot based scheduling with GPRS Downlink transmit diversity Supported for improving Not supported by the standard, downlink capacity but can be applied The differences in the air interface reflect the new requirements of the third generation systems. For example, the larger bandwidth of 5 MHz is needed to support higher bit rates. Transmit diversity is included in WCDMA to improve the downlink capacity to support the asymmetric capacity requirements between downlink and uplink. Transmit diversity is not supported by the second generation standards. The mixture of different bit rates, services and quality requirements in third generation systems requires advanced radio resource management algorithms to guarantee quality of service and to maximize system throughput. Also, efficient support of non-real time packet data is important for the new services. 5

Table 2.2 Main differences between WCDMA and IS-95 air interfaces WCDMA IS-95 Carrier spacing 5 MHz 1.25 MHz Chip rate 3.84 Mcps 1.2288 Mcps Power control frequency 1500 Hz, both uplink and downlink Uplink: 800 Hz, downlink: slow power control Base station synchronization Not needed Yes, typically obtained via GPS Inter-frequency handovers Yes, measurements with Possible, but measurement slotted mode method not specified Efficient radio resource Yes, provides required quality of service Not needed for speech only networks Packet data Load-based packet scheduling Packet data transmitted as short circuit switched calls Downlink transmit diversity Supported for improving Not supported by the standard downlink capacity The main differences between WCDMA and IS-95 are discussed below. Both WCDMA and IS-95 utilize direct sequence CDMA. The higher chip rate of 3.84 Mcps in WCDMA enables higher bit rates. The higher chip rate also provides more multipath diversity than the chip rate of 1.2288 Mcps, especially in small urban cells. Most importantly, increased multipath diversity improves the coverage. The higher chip rate also gives a higher trunking gain, especially for high bit rates, than do narrowband second generation systems. Experiences from second generation air interfaces have been important in the development of the third generation interface, but there are many differences, as listed above. In order to make the fullest use of the capabilities of WCDMA, a deep understanding of the WCDMA air interface is needed, from the physical layer to network planning and performance optimization. However, an important problem with 3G is that it has added to the number of air interface standards that needs to be supported by the infrastructure and terminal industry. Of the 3G standards, the 3GPP Universal Mobile Telecommunications System (UMTS) is unlikely to be universal and will be strongest in Europe. The 3GPP2 CDMA2000 standard and the TDMA based GSM-EDGE systems will be successful in North and South America, while Japan has its own WCDMA system similar to UMTS. The TD-SCDMA standard makes use of TDD synchronous CDMA technology and offers several operational advantages. This standard has received the full 6

blessing of the Chinese government and will surely play a critical role in mobile communications development in China as well as in the world. A comparison of fundamental system parameters of WCDMA, CDMA2000 and TD-SCDMA standards is given in Table 2.3 [4]. Table 2.3 A comparison of major physical layer operational parameters of W-CDMA, CDMA2000 and TD-SCDMA standards WCDMA CDMA2000 TD-SCDMA Multiple Access DS-CDMA DS-CDMA/MC-CDMA TDMA/DS-CDMA CLPCF 1600Hz 800 Hz 200Hz Channel coding Convolutional, RS, or turbo coding Convolutional or turbo coding Convolutional or turbo coding Spreading code OVSF DL:Walsh, UL:M-ary OVSF Walsh mapping VSF 4 256 4 256 1 16 Carrier 2 GHz 2 GHz 2 GHz Modulation DL: QPSK, UL: BPSK DL: QPSK, UL: BPSK QPSK, 8-PSK (at 2 Mb/s) Bandwidth 5*2 MHz 1.25*2/3.75*2 MHz 1.6 MHz UL-DL spectrum Paired Paired Unpaired Chip rate 3.84 Mchips/s 1.2288/3.6864 Mchips/s 1.28 Mchip/s Frame length 10 ms 20 ms, 5 ms 10 ms Interleaving 10/20/40/80 ms 5/20/40/80 ms 10/20/40/80 ms periods Maximum 2 Mb/s 2.4 Mb/s 2 Mb/s data rate Detection PCBC PSBC PSBC Inter-BS timing Asynchronous/synchronous Synchronous Synchronous All of the 3G systems are potential SDR applications. Software radio offers the potential to solve many of the problems caused by the proliferation of new air interfaces. Base stations and terminals using SDR architectures can support multiple air interfaces during periods of transition and be easily software upgraded. Intelligent SDR can detect the local air interface and adapt to suit the need. 7

2.3 WORKBENCH ARCHITECTURE In the previous work, we have an existed simulation environment. The workbench consists of five parts: SOURCE, TX, CH, RX and SINK. These modules realize the most basic functions. Signals to be transmitted generate inside SOURCE. TX defines the transmitters and RX defines the receivers. Different channel models were defined in CH module. The Channel State Information (CSI) can be transmitted from RX to TX through a feedback channel CH_R. Finally, the received signals were demodulated and decoded in SINK module [5]. The system block diagram is shown in Figure 2.1. SOURCE TX CH RX SINK CH_R Figure 2.1. System block diagram Inside each module, there are sub-modules that define sub-blocks. The block diagram of TX and RX are shown in Figure 2.2: where BBU_T/BBU_R are the BaseBand Unit, SPU_T/SPU_R are the Space Processing Unit, DRU_T/DRU_R are the Digital Radio Unit and ARU_T/ARU_R are the Analog Radio Unit. The EAU_R is the Estimation and Adaptation Unit. Data bits are encoded in the BBU_T block, and then fed into SPU_T, where baseband modulation is accomplished. The outputs of SPU_T are OFDM modulated in DRU_T part if wideband communication is chosen. More details about the workbench are introduced in [6]. TX BBU_T SPU_T DRU_T ARU_T 8

RX ARU_R DRU_R SPU_R BBU_R EAU_R Figure 2.2. Block diagrams of TX and RX In this thesis, we did the physical layer simulation of WCDMA systems based on a SDR environment. Here we set two m file dsencoder.m and dsdecoder.m in the SPU_T and SPU_R modules. The function of the two files will be explained in Section 3.3. 9

Chapter 3 WCDMA Simulation This chapter introduces the principles of the WCDMA and analyzes the performance of the WCDMA system. The main characteristics of the WCDMA are introduced in Section 3.1. The concept of spreading and despreading is described in Section 3.2, followed by a presentation of the multipath radio channel in Section 3.3 and Rake receiver in Section 3.4. The WCDMA simulation results in wideband will be shown in Section 3.5. 3.1 CHARACTERISTICS 3.1.1 Background One of the most promising approaches to 3G is to combine a Wideband CDMA (WCDMA) air interface with the fixed network of GSM. Several proposal supporting WCDMA were submitted to the International Telecommunication Union (ITU) and its International Mobile Telecommunications for the year 2000 (IMT2000) initiative for 3G. 3.1.2 Characteristics We present the main system design parameters of WCDMA in this section. Here we highlight some of the items that characterize WCDMA [3]. WCDMA is a wideband Direct-Sequence Code Division Multiple Access (DS-CDMA) system, i.e. user information bits are spread over a wide bandwidth by multiplying the user data with pseudorandom (PN) sequence derived from CDMA spreading codes. In order to support very high bit rates (up to 2 Mbps), the use of a variable spreading factor and multi-code connections is supported. The chip rate of 3.84 Mcps leads to a carrier bandwidth of approximately 5 MHz. DS-CDMA 10

systems with a bandwidth of about 1 MHz, such as IS-95, are commonly referred to as narrowband CDMA systems. The inherently wide carrier bandwidth of WCDMA supports high user data rates and also has certain performance benefits, such as increased multipath diversity. Subject to its operating license, the network operator can deploy multiple 5 MHz carriers to increase capacity, possibly in the form of hierarchical cell layers. WCDMA supports highly variable user data rates, in other words the concept of obtaining bandwidth on demand is well supported. The user data rate is kept constant during each 10 ms frame. However, the data capacity among the users can change from frame to frame. WCDMA supports two basic modes of operation: Frequency Division Duplex (FDD) and Time Division Duplex (TDD). In the FDD mode, separate 5 MHz carrier frequencies are used for the uplink and downlink respectively, whereas in TDD only one 5 MHz is timeshared between the uplink and downlink. Uplink is the connection from the mobile to the base station, and downlink is that from the base station to the mobile. Table 3.1 summarizes the main parameters related to the WCDMA air interface. Table 3.1. Main WCDMA parameters Multiple Access Scheme DS-CDMA Duplex Scheme FDD/TDD Base station synchronisation Asynchronous operation Chip Rate 3.84 Mcps Carrier Spacing 4.4-5.2 MHz (200 khz carrier raster) Frame Length 10ms Multirate concept Variable spreading factor and multicode Detection Coherent using pilot symbols or common pilot Channel Coding Scheme Convolutional Code (rate 1/2 and 1/3 ) Turbo code 3.2 SPREADING AND DESPREADING In 1985, the FCC (Federal Communications Commission) allocated three frequency bands for a radio transmission technique known as spread spectrum communications, originally developed by the military. This transmission technique has much greater immunity to interference 11

and noise compared to conventional radio transmission techniques. In addition, an increasing number of users can use the same frequency. These rules are designed to drive usage towards local data communications. Spread spectrum is a modulation technique which increases the transmit signal bandwidth. There are several benefits obtained in exchange for this increased bandwidth. First, spread spectrum modulation mitigates the effect of inter-symbol interference (ISI) and narrowband interference. The narrowband interference rejection also applies to hostile jamming signals, and for that reason spread spectrum is often used in military systems. In addition, spread spectrum also hides the signal beneath the noise floor. This property means that the transmitted signal is another desirable property for military communication systems. Finally, spread spectrum modulation can be used as a multiple access technique, which is the basis of the digital cellular standard IS-95. There are two common forms of spread spectrum: direct sequence (DS) and frequency hopping (FH). Since direct sequence is more commonly used, we will focus on this technique. In this section, the operation of direct sequence spread spectrum radio technology will be presented. Conventional DS-CDMA systems offer several advantages in cellular environments including easy frequency planning, high immunity against interference if a high processing gain is used, and flexible data rate adaptation. Besides these advantages, DS-CDMA suffers from several problems in multi-user wireless communications systems with limited available bandwidth: Multiple access interference (MAI) As the number of simultaneously active users increases, the performance of the DS-CDMA system decreases rapidly, since the capacity of a DS-CDMA system with moderate processing gain (limited spread bandwidth) is limited by MAI. Complexity In order to exploit all multipath diversity it is necessary to apply a matched filter receiver approximated by a rake receiver with sufficient number of arms. In addition, the receiver has to be matched to the time-variant channel impulse response. Thus, proper channel estimation is necessary. This leads to additional receiver complexity with adaptive receiver filters and a considerable signaling overhead. 12

Single-/Multitone interference In the case of single-tone or multi-tone interference the conventional DS-CDMA receiver spreads the interference signal over the whole transmission bandwidth whereas the desired signal part is despread. If this interference suppression is not sufficient, additional operations have to be done at the receiver. Hence, this extra processing leads to additional receiver complexity. 3.2.1 Direct Sequence Spread spectrum Figure 3.1 shows the process of a direct sequence spread spectrum system. A common communication system that employs a wide bandwidth is a direct sequence spread spectrum (SS) system. Its basic components are shown in the following figure. Information is encoded and modulated by a PN sequence and transmitted over a bandwidth W. Information Sequence Channel Encoder Modulator Channel Demodulator Channel Decoder Output Data Pseudorandom Pattern Generator Pseudorandom Pattern Generator Figure 3.1. Direct sequence Spread spectrum The following Figure depicts the basic operations of spreading and despreading for a DS-CDMA System. Figure 3.2. Transmitted signals in DS-CDMA system 13

User data is here assumed to be a BPSK-modulated bit sequence. The spreading operation, in this example, is the multiplication of each user data bit with a sequence of 8 code bits, called chips. We assume this also for the BPSK spreading modulation and we can see that the resulting spread signal has the same random appearance as the spreading code. In this case we would say that we used a spreading factor of 8. This wideband signal would then be transmitted across a wireless channel to the receiving end. During despreading we multiply the spread user signal sequence, bit duration by bit duration, with the very same 8 code chips as we used during the spreading of these bits. As shown, the original user bit sequence has been recovered perfectly, provided we have (as shown in Figure 3.2) also perfect synchronization between the spread user signal and the spreading code. Figure 3.3. Power spectral density of baseband signal and SS signal Figure 3.3 shows the power spectral density of baseband SS signal. A narrowband signal is spread to a wideband signal over a broader portion of the radio frequency band, in order to utilize the entire available bandwidth. Figure 3.4 shows the power spectral density of Basepass SS signal after the interference of noise. Figure 3.4. Power spectral density of baseband SS signal and Noise 14

Figure 3.5. Power spectral density of baseband SS signal and Interference Figure 3.5 shows the power spectral density of baseband SS signal and Interference after despreading. We can find that the part of noise which will interfere with the detector signal is the detector noise that falls within the frequency region of the desired signal. Thus, this technique makes the SS signal immune to interference 3.2.2 Pseudorandom Sequences (Spreading Codes) The pseudorandom (PN) sequence is a binary sequence with an autocorrelation that resembles, over a period, the autocorrelation of a random binary sequence. Its autocorrelation also roughly resembles the autocorrelation of band-limited white noise. Although it is deterministic, a PN sequence has many characteristics that are similar to those of random binary sequences, such as having a nearly equal number of -1s and +1s, very low correlation between shifted versions of the sequence, very low correlation between any two sequences, etc. The PN sequence is usually generated using sequential logic circuits. A feedback shift register, which is diagrammed in Figure 3.6, consists of consecutive stages of two state memory devices and feedback logic. FEEDBACK LOGIC Clock Stage 1 Stage 2 Stage 3 Stage m PN seq output Figure 3.6. Block diagram of a generalized feedback shift register with m stages 15

Binary sequences are shifted through the shift registers in response to clock pulses, and the output of the various stages are logically combined and fed back as the input to the first stage. This shift register is called a linear PN sequence generator. The initial contents of the memory stages and the feedback logic circuit determine the successive contents of the memory. If a linear shift register reaches zero state at some time, it would always remain in the zero state, and the output would subsequently be all 0s. Since there are exactly m 2 1 nonzero states for an m-stage shift register, a sequence of period m 2 1 generated by a linear feedback register is called a maximal length (ML) sequence. 3.3 MULTIPATH RADIO CHANNEL Multipath radio propagation in the land mobile channel is characterized by multiple reflections, diffractions and attenuation of the signal energy. These are caused by natural obstacles such as buildings, hills, and so on. 10 0 Received field 10-1 Received field intensity 10-2 10-3 10-4 0 1 2 3 4 5 6 7 8 9 10 time Figure 3.7. Fast Rayleigh fading as caused by multipath propagation 16

Figure 3.7 shows an exemplary fast fading pattern as would be discerned for the arriving signal energy at a particular delay position as the receiver moves. We see that the received signal power can drop considerably when phase cancellation of multipath reflections occurs. 3.4 RAKE RECEIVER A DS spread-spectrum signal waveform is well matched to the multipath channel. In a multipath channel, the original transmitted signal reflects from obstacles such as buildings and mountains, and the receiver receives several copies of the signal with different delays. If the signals arrive more than one chip apart from each other, the receiver can resolve them. Actually, from each multipath signal s point of view, other multipath signals can be regarded as interference and are suppressed by the processing gain [7]. A further benefit is obtained, if the resolved multipath signals are combined using a RAKE receiver. Thus, the signal waveform of CDMA signals facilitates use of multipath diversity. Expressing the same phenomenon in the frequency domain means that the bandwidth of the transmitted signal is larger than the coherence bandwidth of the channel and the channel is frequency selective. A RAKE receiver consists of correlators, each receiving a multipath signal. After despreading by correlators, the signals are combined using, for example, maximal ratio combining. Because the received multipath signals are fading independently, diversity order and thus performance are improved. The following Figure 3.8 illustrates a spread spectrum system with RAKE receiver. n(t)+i(t) Data bits x(t) Modulation g(t) X X (t) PN Generator cos 2πfct Channel r(t) h(t) + X Demod sc sc( t τ ) PN Generator Decision Device Figure 3.8. A Spread Spectrum System with RAKE receiver 17

After spreading and modulation, the signal is transmitted and it passes through a multipath channel, which can be modeled by a tapped delay line. The multipath components have different delays and attenuation factors, and each of them correspondes to a different propagation path. It is assumed that the receiver has perfect channel estimation. The RAKE receiver has a receiver finger for each multipath component. In each finger, the received signal is correlated by the spreading code, which is time-aligned with the delay of the multipath signal. After despreading, the signals are combined by MRC, where each signal is weighted by the path gain. Because of transmitter or receiver movements, the scattering environment will change, and thus, the delays and attenuation factors change as well. Consider the case that the wideband signals are transmitted in a multipath environment. It is regarded as a frequency selective channel which will be introduced in detail in section 3.5.2. As we mentioned in section 3.2, the spreading codes are designed to have very low autocorrelation, multipath components delayed by more than one chip duration are uncorrelated and appear as resolvable paths in the model. Typically, WCDMA systems are designed to have several resolvable paths within the multipath delay spread. At the same time, the delay spread must be lower than the bit duration T. If the delay spread is larger than the bit duration T, then the data rate is higher than the coherence bandwidth and ISI is introduced to the system. To avoid ISI, the data rate should be maintained below the coherence bandwidth. When the delay spread is lower than T and there are several delayed versions of the transmitted code sequence with delay differences larger than Tc, they will have a low correlation with the original code sequence. Thus, each of these delayed signals will appear at the receiver as another uncorrelated user and will be ignored by the matched filter receiver of the desired signal. However, spread spectrum signals are inherently resistant to multipath fading since multipath components carry the information about the transmitted signal and they are independent. Thus, if one of the multipath components is attenuated by fading, the other may not be and the receiver could use unfaded components to make the decision. The WCDMA receiver that takes advantage of the multiple paths to provide diversity is called a rake receiver. The Rake receiver structure, shown in Figure 3.9, consists of a bank of correlators. Each of them is used to detect separately one of the L strongest multipath components. This receiver is 18

basically a diversity receiver based on the fact that the multipath components in a WCDMA system are uncorrelated if the relative delays are larger than the chip period. It uses the autocorrelation properties of the code to coherently combine all multipath components. X sc(t) X Received Signal r(t) sc ( t τ 1) X Coherent Combiner Demodulator Data Output sc ( t τ 2) X sc( t τl 1) Figure 3.9. Rake Receiver Architecture with L branches Maximum Ratio Combining (MRC), Equal Gain Combining (EGC) and Selective Combining (SC) are the three main combing methods. Although EGC is the most common, since it doesn t require knowledge of the multipath amplitudes. As in other diversity receivers, the outputs from the correlators are weighted and added to compute the estimate for the transmitted signal. Considering the three combining methods, the mean value of the combining gain is shown in Figure 3.10. Observing that, EGC is just slightly poorer than maximal ratio combining. For large values of L, we can see that there is about 1 db difference when compared to MRC. From the figure, we can see that MRC has the best combing gain. If the MRC technique, which gives the highest reduction of fading, is used, the weighting * coefficient is the complex conjugate of the corresponding channel tap coefficient α =. k α k 19

4.5 4 3.5 MRC EGC SC 3 Combining Gain 2.5 2 1.5 1 0.5 0 0 2 4 6 8 10 12 14 16 18 20 Number of Path N Figure 3.10. Performance comparation of the three combining methods Each multipath demodulator in the RAKE receiver is called a finger. In the original Rake receiver [8] the delay between consecutive taps and the number of taps was fixed. These receivers require a large number of taps in order to capture major multipath components. Modern receivers have only a few Rake fingers and are capable of adjusting the tap positions. In this thesis, it is assumed that there are 5 RAKE fingers and each of them is capable of adjusting the tap position. A more detailed description of the RAKE receiver for the discrete-time multipath channel model with unknown delays and amplitudes can be found in [9]. If we ignore the effects of interference and synchronization errors, and we also assume a steep autocorrelation function which equals zero for codes delayed by more than a chip time and one for codes within a chip time, then performance of the RAKE receiver with L branches is identical to any other L-branch diversity technique. Since these assumptions usually don t hold in practice and spread spectrum is more difficult to implement than other diversity techniques, spread spectrum is not usually used for diversity alone. However, if spread spectrum signaling is chosen for its other benefits, such as its multi-user or interference rejection capabilities, then L branch diversity comes almost for free. [10] 20

3.5 WCDMA SIMULATION RESULTS IN SDR-WB 3.5.1 Flat Fading Channel We know that a multipath fading channel having a delay spread much smaller than the symbol duration is referred to a flat fading channel. When the channel is flat fading, both the amplitude and the phase of the channel multiplicative factor can be estimated at the receiver. The average symbol error probability is obtained by averaging the conditional symbol error probability over all possible values of Γ as Ps = Ps ( γ ) pγ ( γ ) dγ 0 +, (3.1) where Γ is the instantaneous received SNR and p ) is the probability density function (pdf) Γ (γ of the instantaneous SNR. The amplitude of a fading channel is Rayleigh distributed. The average bit error probability of BPSK is given by [11] where γ 0 is the average received SNR/bit. 1 γ 0 P b = 1 (3.2) 2 1+ γ 0 3.5.1.1 Non-Adaptive Scheme Firstly, let s consider a non-adaptive scheme, where the Channel State Information (CSI) is not known at the transmitter side. The signals are transmitted in a fixed rate and modulation method. As shown in Equation 3.2, the average BER is a function of the mean SNRγ 0 only. Here the length of the spreading code is 127. The average BER for BPSK is plotted in Figure 3.11. It is observed that the BER is decreasing with the increasing SNR. The BER decreases slowly as compared to the performance of the theoretical BER for BPSK in a Rayleigh fading channel given by Equation 3.2. 21

10 0 10-1 Theoretical Empirical.BPSK 10-2 BER 10-3 10-4 10-5 -10-5 0 5 10 15 20 25 30 35 SNR Figure 3.11. Average BER for BPSK and QPSK over a Rayleigh fading channel 3.5.1.2 Adaptive scheme Adapting transmission parameters according to the CSI can increase average throughput, reduce required transmit power, or reduce error probability. We consider adaptation to enhance the spectral efficiency. The basic idea of adaptive system is to estimate the channel at the receiver and feed it back to the transmitter, so that the transmission parameters can be adapted relatively to the CSI. Adaptive modulation enables robust and spectrally efficient transmission over flat fading channels. In this case, the transmitter has complete and accurate knowledge of the CSI so that adaptive modulation can be applied to achieve high data rate transmission under a target BER. To approach channel capacity, Gaussian signal has to be used. In reality, however, Gaussian coding with continuous rate is unavailable and MQAM modulation with discrete modulation orders is used instead. When the full CSI is known at the transmitter side, a channel with high SNR can be assigned with a high modulation order, whereas a channel with low SNR is assigned with a low modulation order. No bits are loaded when the SNR is too low to carry. 22

11 10 9 Capacity Capacity CQAM Throughput Rate & Throughput [bps/hz] 8 7 6 5 4 3 2 1 0 5 10 15 20 25 30 35 40 SNR [db] Figure 3.12. Throughput of an adaptive system in a Flat Rayleigh fading channel Assuming a target BER, the optimum switching thresholds in order to maximize the spectral efficiency are found for the transmission. The relationship between the modulation scheme and various SNR can be found in details in [18]. In Figure 3.12, the performance of a DS-CDMA adaptive modulation system with the target BER = 0.001 is plotted. The upper curve is the theoretic value of the channel capacity given by Shannon theory and the middle curve is the spectral efficiency by using continuous MQAM modulation [12]. The lower curve is the empirical spectral efficiency. Limited to the modulation scheme of 64QAM, there is a leveling out of the practical throughput while SNR larger than 25dB. It is also observed that there exists a large gap between the channel capacity and the spectral efficiency, which is due to that Gaussian coding and infinite coding length is assumed to achieve the capacity whereas uncoded discrete rate, MQAM modulation, is applied in practice. CQAM, is a closer upper bound to the practical spectral efficiency. The difference between them only comes from the rate continuity, which is not achievable in practice. 23

6 5.5 5 Throughput.TargetBER=0.01 Throughput.TargetBER=0.001 Rate & Throughput [bps/hz] 4.5 4 3.5 3 2.5 2 1.5 1-5 0 5 10 15 20 25 30 35 SNR [db] Figure 3.13. Throughput of the adaptive system for different target BER Figure 3.13 shows the throughput versus SNR for different target BER. The higher the target BER becomes, the higher the throughput will be. 3.5.2 Frequency Selective Fading Channel If the transmitted signal has a bandwidth B R larger than the coherence bandwidth of the channel B m, the channel can no longer be considered as a flat fading channel. In this case the radio channel is regarded as a frequency selective channel. Given the symbol duration T and delay spread T, we can assume that T >> T so that the ISI is negligible. m m The signal is transmitted through a multipath channel with different path gains. However, each transmission of these signals can be considered as a transmission through a flat fading channel. Using the channel model for the frequency selective channel shown in Figure 3.10, we may express the received signal as L r( t) = ci ( t) s( t i / W ) + i= 1 n( t) (3.3) 24

where W is the bandwidth of the signal and n(t) represents the AWGN. Therefore, the frequency selective channel provides the receiver with up to L replicas of the transmitted signal, where each signal component is multiplied by a corresponding channel tap weight c i (t), i=1, 2,, L. As introduced in section 3.3, in order to perform maximal ratio combining, it is necessary to estimate the channel tap coefficients (t) c i from the received signal. Here a RAKE demodulator is used to collect all the signal components on all channel taps. 3.5.2.1 Frequency Selective Fading channel with Non-adaptive scheme Similarly to the flat fading channel, we assume that the transmitter and the receiver have complete and accurate knowledge of the CSI. The average BER is plotted for BPSK and QPSK in a frequency selective Rayleigh fading channel is shown in Figure 3.14. As seen from the figure, the BER decreases with the increasing SNR. 10 0 Empirical.QPSK Empirical.BPSK 10-1 BER 10-2 10-3 -10-5 0 5 10 15 20 25 30 SNR [db] Figure 3.14. BER versus SNR over a frequency selective Rayleigh fading channel We also compared the BPSK and QPSK modulation in Flat Fading channel and Frequency Selective fading channel, respectively. The number of paths L = 5 and the length of PN sequence 25

Lc = 127. The results are shown in Figure 3.15. 10 0 BPSK.Flat FC QPSK.Flat FC BPSK.FS FC QPSK.FS.FC 10-1 BER 10-2 10-3 -10-5 0 5 10 15 20 25 30 35 SNR [db] Figure 3.15. Comparison of BER versus SNR in Flat FC and FS fading channel We can see that with the same modulation, the BER in the frequency selective fading channel is a little lower than that in flat fading channel. Since direct sequence (DS) waveforms have a wide bandwidth, anytime that bandwidth exceeds the coherence bandwidth of the channel, the fading tends to be frequency selective. Thus, a RAKE receiver can be used to enhance system performance and decrease the BER with the same SNR. 3.5.2.2 Frequency Selective Fading channel with Adaptive scheme In this section, the signal that transmitted through a Frequency Selective fading channel is considered. In this channel model, a RAKE receiver with perfect CSI was assumed. The result is shown in Figure 3.16. Similar with that in Flat Fading channel, the throughput of an adaptive system with the target BER =0.001 is plotted. In the following figure, the upper curve is the theoretic value of the system throughput and the middle curve is the theoretic value of system capacity with CQAM. The lower curve is the empirical throughput. Compared with the upper bound of system throughput, the empirical result is much less because of the QAM modulation, without coding and a SNR loss. 26

11 10 9 Capacity Capacity CQAM Throughput Rate & Throughput [bps/hz] 8 7 6 5 4 3 2 1-5 0 5 10 15 20 25 30 35 SNR [db] Figure 3.16. Throughput of adaptive system in a Frequency Selective fading channel Figure 3.17 shows the performance of the same system for different target BER. The throughput increases with the increasing SNR. Comparing the two curves, we can see that the higher the target BER, the lower the throughput. 6 5.5 5 Throughput.TargetBER=0.01 Throughput.TargetBER=0.001 Rate & Throughput [bps/hz] 4.5 4 3.5 3 2.5 2 1.5 1-5 0 5 10 15 20 25 30 35 SNR [db] Figure 3.17. Throughput of the adaptive system for different target BER 27

Chapter 4 Programming using Matlab/Octave and C++ 4.1 INTRODUCTION 4.1.1 Matlab and Interface Function MEX file MATLAB is a powerful tool in engineering field. However, it takes a long time to execute because its nature is very slow in executing functions. In order to solve this problem, Mathworks provides a toolbox to compile M-Files converting them to executable ones. Then we can write and compile a script be executable whose extension is exe. Functions could also be compiled to other executables called MEX-Files. MEX-Files in Microsoft Windows have the dll extension. Now MATLAB can execute these functions very quickly. MEX-Files in other operating systems have different extensions. As we know, DLL is the abbreviation of Dynamic Link Library, and contains variables, functions and classes which can be dynamically loaded by the operating system or in this case by MATLAB. They can be executed very fast because they have been compiled. The MATLAB M-Files are very good for putting functions or scripts together that run many of MATLAB's fast Built-In functions. One of the advantages of these files is that they are never compiled and can run in any system that is already running in MATLAB [13]. MATLAB achieves so by interpreting each line of the M-File every time when running. This method of running the code can make processing time very slow for complicated functions, especially those with many loops, because every line within the loop will be interpreted as a new line. Good MATLAB code avoids these things by using as many Built-In features and array operations as possible. However, sometimes this is not enough. 28

MATLAB is capable of running C++ functions. The files that hold sources for these functions are called MEX-Files. The mexfunctions are not intended to be a substitute for MATLAB's Built-In operations. However, if you need to code many loops and other things, at which MATLAB is not very good, mexfunction is a good choice. This feature also allows system-specific Application Programming Interface (API) to be called to extend MATLAB's abilities. 4.1.2 Octave and Interface Function OCT file GNU Octave is a high-level language, primarily for numerical computations [14]. It provides a convenient command line interface for solving linear or nonlinear problems numerically, and for performing other numerical experiments by using a language that is compatible with Matlab. It may also be used as a batch-oriented language. The strength of Octave (as well as Matlab) is its short syntax for matrix operations. In fact it is almost as readable and writable as the mathematical notation. In some systems, such as Linux, Octave can dynamically load and execute C++ functions [15]. Octave can only directly call functions written in C++, but we can also load functions written in other languages by calling them from a simple wrapper function written in C++. An OCT-File is a dynamical extension of the Octave interpreter, a shared library or shared object in other words. The source files, that make up an OCT-File, are written in C++, and therefore, conventionally, carry the extension cc. It is a means of writing an Octave function in a compliable language like C++, rather than as a script file. This result is a significant acceleration in the code. Sometimes the performance of native Octave-code is not enough to tackle a problem. Octave-code is interpreted, thus it is inherently slow when executing. In such a case moving from M-code to compiled C++-code speeds up the execution by a factor of ten or more. The second group of problems, where reverting to low-level code is necessary, is when interfacing with foreign libraries or routines written in languages other than C++, most notably Fortran. 29

4.2 METHODOLOGY 4.2.1 Performance Analysis Nowadays, software is used to solve complex numerical problems in a wide variety of environments. Therefore the software and its mathematical algorithms need to be run in various inhomogeneous hardware components. Before we try and make any program to run faster, we first need to find out which bits of it are executed slowly. Profiling the execution time of MATLAB code is easily achieved by adding the commands [17]. The command is profile on before the start of the program, and profile viewer after the codes end. The profiling was run based on simulation of a MIMO-OFDM system. The three following figures show the time spent on the functions and lines. The function of line 190 and line 192 are the same base on the same simulation situation. Line 192 is the existed code written by Matlab, and line 190 is rewritten by Matlab and c++. Figure 4.1 shows the line 192 was the most time consuming part through the whole system. Thus, we should first try to rewrite the Matlab code of the line 190. Figure 4.1. Time spent on the functions However, from the following figure, we can see that the line 190 consumes more time than line 192. In our simulation environment, the programming using Matlab and C++ seems to be less 30

effective than Matlab programming. In order to rewrite the Matlab code with C++, we need to rewrite three computation algorithm codes. These computed codes are used to compute the multiplication between complex matrices, complex number and complex matrices, and the addition between complex matrices. Figure 4.2 shows the time spent on the three computation algorithm. It illustrates that the computation between complex matrices took up the most time. Thus, first we should rewrite the computation between complex matrices to increase the efficiency of the system. Figure 4.2. Time spent on the lines Figure 4.3. Time spent on the sub-lines Analyzing the time spent in line 190, from the two figures above, we can see that commulz is the most time consuming command in the written codes. This function is used for computing the multiplication between two complex matrices. We will study the performance of this function in the later sections. 31