OFDM Simulation In Matlab Computer Science Essay
Abstract-This project involves the simulation and study of a simple Orthogonal Frequency Division Multiplexing (OFDM) system as an application of Digital Signal Processing. The area of focus is the signal processing block of the system which uses Fast Fourier Transform(FFT) engines to achieve orthogonality of channels and thereby improve the transmission channel utilization. The system is simulated using MATLAB and it involves transmission of a digitized audio file through an additive white Gaussian noise (AWGN) channel using OFDM technique and then recovering the file at the receiver. By correlating the original and the recovered file the effectiveness of this technique is tested. The whole system realization consists of multiple steps – source processing, channel, receiver processing, analysis.
Keywords-OFDM; AWGN; FFT; IFFT; BPSK; Orthogonality; Crosscorrelation
I. Introduction
Orthogonal frequency division multiplexing (OFDM) is a frequency division multiplexing scheme in which the frequency separation between adjacent carrier channels is minimized by the use of the concept of orthogonality. It is one of the multiple access techniques widely used in wireless and powerline communications. OFDM can provide large data rates with sufficient robustness against transmission channel impairments. The OFDM scheme allows several orthogonal, narrow band sub-channels or subcarriers to overlap in frequency domain and to be transmitted in parallel thereby dividing the available transmission bandwidth efficiently. The input data is divided into several parallel data streams or channels, one for each subcarrier. Each sub-carrier is modulated with a conventional digital modulation scheme (such as M-ary phase shift keying or Quadrature amplitude modulation) at a low symbol rate so as to maintain the total data rate similar to conventional single-carrier modulation schemes using the same bandwidth. The orthogonality is achieved using the fast Fourier transform (FFT) algorithm on the receiver side, and inverse FFT on the sender side as it allows for efficient modulator and demodulator implementation.
A general OFDM system diagram is shown in Fig. 1. At the transmitter, the modulated information signal x[n] is first transformed to frequency domain through IFFT. Then the signal is transmitted to the destination in the wireless channel. At the receiver, FFT is first applied to the received signal, then the transmitted information symbol is estimated with some decoding algorithm.
The processing at each block with the aid of MATLAB is described briefly as follows:
A.Source Processing
At the source, the audio file is first read using MATLAB as a vector music and converted into a binary data stream. Binary phase shift keying (BPSK) is used as the modulation scheme. In BPSK, each binary data 1 is mapped to an information symbol of 1, while 0 is mapped to −1. With BPSK modulation, we can obtain the information vector . Then a 512-point IFFT is performed on that vector to generate the vector tx for transmission. Zero-padding is used if the data is not a multiple of 512.
B. Channel
The channel is simple AWGN, which means that there is no channel fading and the noise is Gaussian distributed with zero mean and variance σ2. For a random noise, the received signal is transmitted signal(tx)+noise.
C. Receiver Processing
At the receiver, FFT is performed on the received data obtain the noisy data for decoding. Simple bit-wise maximum likelihood (ML) decoding is adopted. Thus, for each received noisy information bit, if the value is larger than 0, it is decoded as 1, otherwise, 0.
D. System Analysis
The received data will the compared with the transmitted data using crosscorrelation to study the difference. The implementation will be repeated for different values of noise variances.
In the sections that follow we discuss in a step-by-step fashion how we can implement such a system by considering all the essential resources. In section II, the development of the entire system is described along with relevant theoretical background. Section III shows how the system can be simulated using MATLAB tools. Section IV contains the results of simulation and analysis of the system. Section V concludes the paper by providing an abstract of the work done.
II. system model
The system is simulated using MATLAB. The flow diagram
of the system operations is shown in Fig. 2.
Fig. 2 OFDM system model [8]
A. Transmitter
The transmitter section includes reading the audio file, converting it into a binary stream, use BPSK to modulate this stream and then perform N-point IFFT on the modulated data to convert the data stream into N orthogonal OFDM channels. In BPSK, each binary data 1 is mapped to an information symbol of 1, while 0 is mapped to −1. Thus we get a serial stream of BPSK modulated data. The stream is divided into N parallel data which forms the basis of an OFDM symbol.
1. FFT-IFFT Algoritms and Orthogonality
An OFDM system treats the input BPSK modulated symbols at the transmitter as though they are in the frequency-domain. These symbols are converted into parallel and are used as the inputs to an IFFT block that converts the signal into the time domain. The IFFT takes in N symbols at a time where N is the number of subcarriers/channels in the system. By definition of Inverse Discrete Fourier Transform(DFT):
x_n = frac{1}{N} sum_{k=0}^{N-1} X_k e^{frac{2pi i}{N} k n} quad quad n = 0,dots,N-1.
The signals e€²°ikn/N are orthogonal over (0, N) where Xk is the input symbol. DFT is the Fourier Transform of discrete time signal taken at discrete instants 2°k/N. FFT/IFFT is a computationally efficient version of DFT/IDFT. For instance, for N point DFT the computational complexity is N2 whereas for radix-2 FFT the one time computation is broken down into log2N levels and each level need N computations hence the complexity is reduced to Nlog2N levels. Thus reducing the computation time in case of FFT. Thus from above definition the base functions IFFT are N orthogonal sinusoids, in other words IFFT is expressed as the weighted sum of orthogonal sinusoids. These sinusoids have a different frequency orthogonal to each other in frequency domain. Each input symbol acts like a complex/real weight for the corresponding sinusoidal term. Input symbols will be complex if M-ary PSK is used where M>2. In such case the value of the symbol determines both the amplitude and phase of the sinusoid for that subcarrier. However, since BPSK is used the weights are real. The IFFT output is the summation of the N weighted sinusoids. Thus, IFFT provides a simple way to modulate data onto N orthogonal closely spaced subcarriers . The block of N output samples from the IFFT make up a single OFDM symbol. http://www.wirelesscommunication.nl/reference/chaptr05/ofdm/images/fig4.gif
(a) (b)
Fig 3: OFDM spectrum (a) Single channel (b) 5 subcarriers [6]
The signals e2°kn/N are orthogonal over (0, N) as
sum_{n=0}^{N-1}
left(e^{ frac{2pi i}{N} kn}right)
left(e^{-frac{2pi i}{N} k’n}right)
=N~delta_{kk’}
This orthogonality due to FFT among adjacent channels implies closely spaced carriers. They can be spaced in such a way such that the null(zero amplitude response) of one channel will occur at the peak of the adjacent carrier as shown in Fig. 3. Thus only half of the available transmission bandwidth will be utilized compare to standard FDM, improving the channel utilization by 50 percent. The discrete time-domain signal that results from the IFFT is transmitted across the channel. Actual transmissions involve conversion of IFFT bins into baseband analog carriers before transmission over the channel. But for simplicity of analysis we transmit the digital baseband signal itself as N subcarriers in a multipath free environment. Orthogonality of the subcarriers due to IFFT allows the frequency spacing between each adjacent subcarrier to be minimum.
B. Channel
The channel is assumed to be simple AWGN, which means that there is no channel fading and the noise is Gaussian distributed with zero mean and variance σ. The transmitted serial stream of IFFT bins is added to the random AWGN noise generated using MATLAB to impose the effects of channel.
C. Receiver
At the receiver, an N point FFT block is used to process the received signal and bring it back into the frequency domain. By definition of Discrete Fourier Transform(DFT):
Due to reasons mentioned previously FFT is the used in place of DFT. The N point FFT output will be the original symbols that were sent to the IFFT block at the transmitter. The output of the FFT block is subject to maximum likelihood detection to extract the binary information from the noise infested symbols. After recovery of binary data, it is converted to its analog equivalent thereby reconstructing the original audio file.
III. matlab simulation
A. Transmitter
1.Input audio file processing
The samples of the audio file that has to be transmitted is read into a vector y using the wavread command. The wavread command also outputs two arguments viz. the sampling frequency and bits per sample which are stored in variables fs and bits respectively. The range and amplitude of the samples obtained are very small and hence they are increased by factor of 2(bits-1) and shifted by 2(bits-1) to get positive samples and thereby perform quantization and convert it into 16-bit binary data using the dec2bin command.
2. BPSK modulation
The binary data stored in a array is BPSK modulated using the simple algorithm of mapping each binary data 1 to an information symbol of 1, and 0 to −1 using a for loop. Figure 3 shows the constellation for BPSK(1bit/symbol).
Figure 4: BPSK constellation
3. IFFT
The BPSK modulated data which is stored in a martix is converted into a row vector using reshape command in order to perform 512 point IFFT which is in effect converting the serial stream into 512 point parallel stream. IFFT is performed using the command ifft. The result of IFFT of the modulated data is an 512 point OFDM symbol. Since IFFT in MATLAB is calculated using the definition of IDFT we need to multiply the IFFT vector by sqrt(N) to raise the average power level in order to maintain sufficient signal to noise power ratio in the channel. After IFFT the parallel data is converted to serial and stored in vector txdataN.
B. Channel
Channel is simulated by adding noise by generating random white noise (Gaussian distributed with mean 0 and variance as we specify) using the command randn. The white noise generated using randn is added it to txdataN. Thus, ch=txdataN+noise where noise= σ*randn(1,length(txdataN )).
C. Receiver
1.FFT
The received OFDM signal vector ch is coverted into parallel and 512 point FFT is performed using the command fft to recover the noisy BPSK modulated data. The scatterplot of the noise infested received data is shown in Fig. 5
Fig. 5: Received Constellation with noise
2.Maximum Likelihood(ML) Detection
If the output of FFT is observed to be complex, only the real part is taken to detect the data symbols. Simple bit-wise maximum likelihood (ML) decoding is used to recover the original binary data. Thus, for each received noisy information bit, if the value is larger than 0, it is decoded as 1, otherwise, 0.
3. Reconstruction of audio file from recovered data
The recovered digital data is converted into equivalent analog samples using bin2dec command where each sample corresponds to 16 bits. The samples are then stored as a wav file recovered_music at a sampling frequency fs using the command wavwrite.
4. Correlation
The recovered sound file is played using command soundsc to note the difference with the original file. The correlation coefficient of the received sound vector and the original sound vector is calculated using the command corrcoef and stored in a matrix corr. As we change the variance of the noise vector, which implies a change in the channel SNR, the covariance between the original and the recovered data decreases and as a result we get a noisy audio at the output.
IV. System analysis and Simulation Results
A. Frequency Analysis
1.Frequency Response of input data stream(BPSK Modulated).
2.OFDM channel frequency response
B. Input Sequence and corresponding OFDM symbol
C. Correlation between input and output data
1.Input sound samples. Fs=8kHz
2.Recovered sound samples w/ correlation coefficient=0.9042
Variance of AWGN=0.2
3.Recovered sound samples w/ correlation coefficient=1
Variance of AWGN=0.01
3.Recovered sound samples w/ correlation coefficient=0.1758
Variance of AWGN=1
V. Conclusion
Orthogonality in OFDM introduced due to the use of DSP engines FFT and IFFT have proven to be very effective in the improving channel spectral utilization by allowing the overlap of adjacent channels to almost half of the channels bandwidth. Also modulation and demodulation complexity is reduced due to the use FFT techniques. As a result it is feasible to use ML decoding to recover binary data.
In this project, a simple MATLAB model of OFDM was simulated to study OFDM using FFT. The power of FFT-IFFT to introduce orthogoniality in subcarriers was demonstrated. The effect of AWGN channel using different noise variances was illustrated. The results showed that small noise variances, that is, high signal to noise rations had negligible effect of original data. which was evident from the calculation of correlation coefficient of original and recovered data.
VI. References
E. Lawrey, “The suitability of OFDM as a modulation technique for wireless telecommunications, with a CDMA comparison,” B. Eng. thesis, James Cook University, Oct. 1997.
Anibal Luis Intini, “OFDM for Wireless Netwoks”, University of California, Santa Barbara, CA. Rep.Dec.2000.
G. Acosta,”OFDM simulation using MATLAB”, Georgia Institute of Technology,GA. Rep.Aug. 2000.
Alan C. Brrooks and Stephan J. Hoelzer, “Design and Implementation of OFDM Signalling”, Rep.May.2001.
John G.Proakis, Digital Signal Processing, 3rd ed.
Mathematical description of OFDM. [Online].Available: http://www.wirelesscommunication.nl [Revieved: 12/01/2010](Fig. 3)
Matlab Tutorial. [Online]. Available: www.mathworks.com/academia/
EEL5525 Class Notes (Fig. 1, 2)
Order Now