Digital Communication Systems Simulation 


using MATLAB and C MEX


With Wireless Communication Applications

 

My library
 

Last update: 1 Nov 2006

Turbo code

Last update: 16 January 2008 (C source codes have been posted)

Space-time trellis code

Last update: 9 Apr 2007 (add some tips how to run a simulation)

LDPC code

    LDPC codes

    Last update: 8 Jan 2013 (Added plot)

    LDPC Convolutional Codes 

About me!

Last update: 8 Jan 2013


Introduction

 

MATLAB has become one of the most important tools in the area of digital communication systems. The rapid increase of complexity in the area of digital communication makes design and analysis almost impossible to be conducted without computer simulation. MATLAB comes handy when computer simulation is needed. The way they handle arrays and matrices significantly reduce the development time. In addition, MATLAB has tons of ready-to-use functions in its toolboxes. Unlike other computer languages, you do not need to compile to execute a Matlab program. MATLAB scripts can be run directly within its shell; makes debugging and correction can be made on spot.

 

The benefits of MATLAB come with a heavy price tag. MATLAB is very slow compared to other compiled programs. Loops are the main culprit. When dealing with arrays and matrices, one should avoid traditional loops such as ‘for’ and ‘while’, and utilizes MATLAB’s matrix properties instead. In addition, MATLAB uses double precision floating point as a default numerical value which contributes to high utilization of memory.

 

MathWorks, which develop MATLAB, offers a solution to the problem of slow running MATLAB. It provides a library for calling and executing pre-compiled dynamic link libraries. The library is called MEX file and can be written using the C or Fortran language. The compiled libraries then can be called and executed like normal MATLAB .m file functions. We are not going to discuss Fortran language MEX, and from now on, the term MEX refers to the C language MEX.

 

MEX library significantly boost the performance of the MATLAB routine. Instead of drinking 10 cups of coffee plus one large pizza while waiting for bit error rate plot of turbo coding, you will only need one cup of coffee. Sounds amazing? Again, it does not come easy either. Writing MEX file is big headache compared to MATLAB .m file. You have to deal with the notorious C pointers and its possibility of memory leak, which may crash MATLAB shell. Converting MATLAB arrays index into MEX equivalent one is headache, not to mention about matrices, multi dimensional matrices, and complex number matrices. Finally, you are required to compile your MEX code. Error free during compilation does not translate to runtime error free. Runtime errors usually are very difficult to debug.

 

Once in a while, we were running 3G WCDMA system with convolutional code using normal MATLAB codes. The simulations could run a day, and when you made a mistake, a small one, you were punished for another day waiting. I thought myself, I had to write the simulation in C/MEX, made live easier, but the drawback is my skill in C language at that time. As for now, my gaining knowledge and proficiency in C language increase significantly, thanks to my current job. Having looked back, I still have passion to deliver my idea. That is the motivation behind this web page. I am willing to share my knowledge in wireless communication area and skill in programming to help students, engineers or researchers doing their simulation easier.

 

This web page contains MEX libraries of "difficult to write" error control coding such as turbo code and convolutional code, as well as the recent space-time trellis code. There are no introduction or tutorials here, as they could easily found in the internet. The application of those channel codes with 3G WCDMA systems will also be added in the future. Also, in the future I will also add MEX libraries of other emerging channel codes such as low density parity check (LDPC) code.


 Next: Compiler issue