When wireless signals travel from a transmitter to a receiver they do so after reflection, refraction, diffraction and scattering from the environment. Very rarely is there a direct line of sight (LOS) between the transmitter and receiver. Thus multiple time delayed copies of the signal reach the receiver that combine constructively and destructively. In a sense the channel acts as an FIR (finite impulse response) filter. Furthermore since the transmitter or receiver may be in motion the amplitude and phase of these replicas varies with time.
There are several methods to model the amplitude and phase of each of these components. We look at one method called the “Smiths Fading Simulator” which is based on Clark and Gans model. The simulator can be constructed using the following steps.
1. Define N the number of Gaussian RVs to be generated, fm the Doppler frequency in Hz, fs the sampling frequency in Hz, df the frequency spacing which is calculated as df=(2*fm)/(N-1) and M total number of samples in frequency domain which is calculated as M=(fs/df).
2. Generate two sequences of N/2 complex Gaussian random variables. These correspond to the frequency bins up to fm. Take the complex conjugate of these sequences to generate the N/2 complex Gaussian random variables for the negative frequency bins up to -fm.
3. Multiply the above complex Gaussian sequences g1 and g2 with square root of the Doppler Spectrum S generated from -fm to fm. Calculate the spectrum at -fm and +fm by using linear extrapolation.
4. Extend the above generated spectra from -fs/2 to +fs/2 by stuffing zeros from -fs/2 to -fm and fm to fs/2. Take the IFFT of the resulting spectra X and Y resulting in time domain signals x and y.
5. Add the absolute values of the resulting signals x and y in quadrature. Take the absolute value of this complex signal. This is the desired Rayleigh distributed envelope with the required temporal correlation.
The Matlab code for generating Rayleigh random sequence with a Doppler frequency of fm Hz is given below.
We have already seen in previous posts that the BER of BPSK increases significantly when the channel changes from a simple AWGN channel to a fading channel. One solution to this problem, that was proposed by Alamouti, was to use Transmit Diversity i.e. multiple transmit antennas transmit the information over multiple time slots increasing the likelihood of receiving the information. We have considered the simplest case of two transmit antennas and BPSK modulation (QPSK modulation would give the same BER with twice the throughput). Given below is the Python code for this, feel free to modify it and run it from the console given below.
We have previously calculated the bit error rate of BPSK in an AWGN channel, we now do the same for a Rayleigh fading channel. Remember that we have now shifted our focus from MATLAB to Python since its open and free to use. We are currently using Python-2 but intend to Python-3 once some integration issues with Trinket are sorted out.
Here is a piece of Python code that calculates Bit Error Rate (BER) of BPSK. The code is a bit slow at the moment, compared to MATLAB implementation, but this is work in progress and further optimizations would be carried out. We would like to point out that the main reason for this slower implementation is that a bit by bit error calculation is done, instead of a vectorial implementation. We already pointed out in our previous post that a “for loop” implemented in Python is not that efficient.
Have you ever thought about how life would be without MATLAB. As it turns out there are free and open source options such as Python. We have so far restricted ourself to MATLAB in this blog but now we venture out to find out what are the other options. Given below is a most basic Pyhton code that calculates the Bit Error Rate of Binary Phase Shift Keying (BPSK). Compare this to our MATLAB implementation earlier [BPSK BER].
There are various IDEs available for writing your code but I have used Enthought Canopy Editor (32 bit) which is free to download and is also quite easy to use [download here]. So as it turns out that there is life beyond MATLAB. In fact there are several advantages of using Python over MATLAB which we will discuss later in another post. Lastly please note the indentation in the code below as there is no “end” statement in a for loop in Python.
from numpy import sqrt
from numpy.random import rand, randn
import matplotlib.pyplot as plt
N = 5000000
EbNodB_range = range(0,11)
itr = len(EbNodB_range)
ber = [None]*itr
for n in range (0, itr):
EbNodB = EbNodB_range[n]
x = 2 * (rand(N) >= 0.5) - 1
noise_std = 1/sqrt(2*EbNo)
y = x + noise_std * randn(N)
y_d = 2 * (y >= 0) - 1
errors = (x != y_d).sum()
ber[n] = 1.0 * errors / N
print "EbNodB:", EbNodB
print "Error bits:", errors
print "Error probability:", ber[n]
plt.plot(EbNodB_range, ber, 'bo', EbNodB_range, ber, 'k')
plt.axis([0, 10, 1e-6, 0.1])
Diffraction is a phenomenon where electromagnetic waves (such as light waves) bend around corners to reach places which are otherwise not reachable i.e. not in the line of sight. In technical jargon such regions are also called shadowed regions (the term again drawn from the physics of light). This phenomenon can be explained by Huygen’s principle which states that as a plane wave propagates in a particular direction each new point along the wavefront is a source of secondary waves. This can be understood by looking at the following figure. However one peculiarity of this principle is that it is unable to explain why the new point source transmits only in the forward direction.
The electromagnetic field in the shadowed region can be calculated by combining vectorially the contributions of all of these secondary sources, which is not an easy task. Secondly, the geometry is usually much more complicated than shown in the above figure. For example consider a telecom tower transmitting electromagnetic waves from a rooftop and a pedestrian using a mobile phone at street level. The EM waves usually reach the receiver at street level after more than one diffraction (not to mention multiple reflections). However, an approximation that works well in most cases is called knife edge diffraction, which assumes a single sharp edge (an edge with a thickness much smaller than the wavelength) separates the transmitter and receiver.
The path loss due to diffraction in the knife edge model is controlled by the Fresnel Diffraction Parameter which measures how deep the receiver is within the shadowed region. A negative value for the parameter shows that the obstruction is below the line of sight and if the value is below -1 there is hardly any loss. A value of 0 (zero) means that the transmitter, receiver and tip of the obstruction are all in line and the Electric Field Strength is reduced by half or the power is reduced to one fourth of the value without the obstruction i.e. a loss of 6dB. As the value of the Fresnel Diffraction Parameter increases on the positive side the path loss rapidly increases reaching a value of 27 dB for a parameter value of 5. Sometimes the exact calculation is not needed and only an approximate calculation, as proposed by Lee in 1985, is sufficient.
Fresnel Diffraction Parameter (v) is defined as:
d1 is the distance between the transmitter and the obstruction along the line of sight
d2 is the distance between the receiver and the obstruction along the line of sight
h is the height of the obstruction above the line of sight
and lambda is the wavelength
The MATLAB codes used to generate the above plots are given below (approximate method followed by the exact method). Feel free to use them in your simulations and if you have a question drop us a comment.
% Calculation of the path loss based on the value of
% Fresnel Diffraction Parameter as proposed by Lee
% Lee W C Y Mobile Communications Engineering 1985
% Copyright www.raymaps.com
if v(n) <= -1
elseif v(n) <= 0
elseif v(n) <= 1
elseif v(n) <= 2.4
plot(v, G, 'b')
xlabel('Fresnel Diffraction Parameter')
ylabel('Diffraction Loss (dB)')
% Exact calculation of the path loss (in dB)
% based on Fresnel Diffraction Parameter (v)
% T S Rappaport Wireless Communications P&P
% Copyright www.raymaps.com
xlabel('Fresnel Diffraction Parameter')
ylabel('Diffraction Loss (dB)')
An interesting video explaining the phenomenon of diffraction.
In ray-tracing simulations one is faced with a complexity at points of intersection between rays and objects. How to handle the reflection, should it be specular or scattered. In this post we consider the two extreme cases; pure reflection vs scattering.
For this we consider that in the case of specular reflection the power of the ray is reduced by 3dB (that is R=0.5) and the ray continues as it would if there was no interaction with the object (off course direction would be changed with angle of reflection being equal to angle of incidence).
In the case of scattered ray we assume that the point of interaction between the ray and the object is a point source from where the rays are regenerated. Therefore there is a rapid drop in the E-field strength as the ray propagates away from the point of interaction.
The simulation code above considers that a ray travels unobstructed for 100 m and at this point comes in contact with an object and is reflected (reflection coefficient of 0.5 is assumed) or scattered. The ray then again travels for another 100 m without coming in contact with an object.
It is observed that there is a rapid decrease in E-field strength of the scattered ray beyond 100 m. This is because the E-field strength at the point of interaction is much lower than that at the source and when this is considered to be a point source, re-generating the rays, the resulting E-field decays quite rapidly.
We assume that the reflection is specular in most of our simulations as this is closer to reality than assuming a fully scattered ray.
Radio frequency planning is an essential component of network planning, roll-out, up-gradation, expansion etc. Several methods can be adopted for this from something as simple as free space models, empirical path loss models to the significantly more complicated, time consuming and expensive drive testing. Drive testing gives very accurate results but these results can be rendered useless by changing the position of an antenna or the tilt or transmit power of an antenna requiring another run in the field. One solution to this problem is ray-tracing which is very accurate but is usually considered to be very computationally expensive and of little practical value. But recent advances in computational power of machines coupled with efficient techniques have given a new lease of life to this method.
Eclipse is a near real-time simulation software for prediction of signal strength in urban areas. The software uses shooting and bouncing ray (SBR) method of ray tracing with 1 degree ray separation, 1 m step size and 9 interactions per ray path. The simulation parameters can be varied according to the resolution required. The code is highly optimized to give results in shortest possible time. It is especially useful for network planning of ultra-dense wireless networks where a dense network of antennas is placed on lamp posts instead of telecom towers. Various frequency bands can be simulated, along with different antenna radiation patterns and MIMO configurations.
Note: If you would like to run a test simulation send us a request at email@example.com
We have previously looked at frequency domain fading simulators i.e. simulators that define the Doppler components in the frequency domain and then perform an IDFT to get the time domain signal. These simulators include Smith’s Simulator, Young’s Simulator and our very own Computationally Efficient Rayleigh Fading Simulator. Another technique that has been widely reported in the literature is Sum of Sinusoids Method. As the name suggests this method generates the Doppler components in the time domain and then sums them up to generate the time domain fading envelope. There are three parameters that define the properties of the generated signal.
1) Number of sinusoids – Higher the number better the properties of the generated signal but greater the computational complexity
2) Angle of arrival – This can be generated statistically or deterministically, spread from –pi to pi.
3) Phase of the arriving wave – This is uniformly distributed between –pi and pi.
The MATLAB code below gives three similar sum of sinusoids techniques for generating a Rayleigh faded envelope .
% SUM OF SINUSOIDS FADING SIMULATORS
% fd - Doppler frequency
% fs - Sampling frequency
% ts - Sampling period
% N - Number of sinusoids
% Method 1 - Clarke
% Method 2 - Pop, Beaulieu
% Method 3 - Chengshan Xiao
All the three techniques given above are quite accurate in generating a Rayleigh faded envelope with the desired statistical properties. The accuracy of these techniques increases as the number of sinusoids goes to infinity (we have tested these techniques with up to 1000 sinusoids but realistically speaking even 100 sinusoids are enough). If we want to compare the three techniques in terms of the Level Crossing Rate (LCR) and Average Fade Duration (AFD) we can say that the first and third technique are a bit more accurate than the second technique. Therefore we can conclude that a statistically distributed angle of arrival is a better choice than a deterministically distributed angle of arrival. Also, if we look at the autocorrelation of the in-phase and quadrature components we see that for the first and third case we get a zero order Bessel function of the first kind whereas for the second case we get a somewhat different sequence which approximates the Bessel function with increasing accuracy as the number of sinusoids is increased.
The above figures show the theoretical Bessel function versus the autocorrelation of the real/imaginary part generated by method number two. The figure on the left considers 20 sinusoids whereas the figure on the right considers 40 sinusoids. As can be seen the accuracy of the autocorrelation sequence increases considerably by doubling the number of sinusoids. We can assume that for number of sinusoids exceeding 100 i.e. N=100 in the above code the generated autocorrelation sequence would be quite accurate.
 Chengshan Xiao, “Novel Sum-of-Sinusoids Simulation Models for Rayleigh and Rician Fading Channels,” IEEE TRANSACTIONS ON WIRELESS COMMUNICATIONS, VOL. 5, NO. 12, DECEMBER 2006.
In the previous posts we had discussed generation of a correlated Rayleigh fading sequence using Smith’s method  and Young’s modification of Smith’s method . The main contribution of Young was that he proposed a mechanism where the number of IDFTs was reduced by half. This was achieved by first adding two length N IID zero mean Gaussian sequences filtered by the filter F[k] and then performing the IDFT on the resulting complex sequence.
This was different to Smith’s method where the IDFT was performed simultaneously on two branches and then the outputs of these branches were added in quadrature to achieve the desired sequence with Rayleigh distributed envelope and Uniformly distributed phase. Another problem with Smith’s method was that the outputs of the two arms after performing IDFTs was assumed to be real which is not always the case in implementation and depends upon the combination of Doppler frequency (fm) and length of Gaussian sequence (N).
Young’s technique is shown graphically in the above figure. Also shown is the definition of filter F[k] which depends upon N, fm and km (please note that the fm in the above equation is normalized by the sampling frequency fs). Here km = N*(fm/fs). We propose three modifications to Young’s technique which significantly reduces computation and at the same time maintains the statistical properties of the generated sequence. The modifications we propose are.
1. First modification has to do with the generated Gaussian sequence. It is observed that the filter F[k], at very high sampling rates, is mostly zero and there are very few points which have some non-zero value. So when we multiply the Gaussian sequence with the filter we mostly get zeros at the output. So we propose that the filter response in the frequency domain must be calculated first and the the Gaussian random sequence must be generated for only those points where the filter F[k] is non-zero e.g. for a sampling frequency of 7.68 MHz (standard sampling frequency for a BW of 5 MHz in LTE) and Doppler frequency of 70 Hz (corresponding to medium Doppler case in LTE) the filter F[k] has 99.9982% zeros in its frequency response and it would be a highly wasteful to calculate Gaussian RVs for all those values.
2. Secondly according to Clarke  the Doppler Spectrum measurements have “Marked disagreement at very low frequencies and at frequencies in the region of the sharp cut-off associated with the maximum Doppler frequency shift. At very low frequencies the spectral energy is always observed to be higher than that predicted by theory”. He goes on to add “The reason for this is that neither theoretical model takes into account the large scale variations in total energy which result from the changing topography between transmitter and mobile receiver”. This suggests that the Classical Doppler Spectrum might not be the best choice under all scenarios. This has also been noted in  where a flat fading model is evaluated in terms of its Level Crossing Rate and Average Fade Duration. Such a flat spectrum is especially suited to indoor scenarios as noted in  and .
We propose a filter that gives equal weight to all the frequencies up to the maximum Doppler frequency. So our filter is a box-type filter which applies a constant scaling factor to all the frequencies in the pass-band and zeros out all the frequencies in the stop-band. So in fact the Gaussian sequence that is generated in the in-phase arm may directly be added with the Gaussian sequence from the other arm without applying the frequency domain filter and then IDFT of the complex sequence is taken. We will look into the deviation from ideality that this causes later.
3. The third modification that we propose is in the implementation of the IDFT. Here again we take into consideration that the complex sequence being fed to the IDFT is filled with zeros (as we noted earlier 99.9982% zeros for 7.68 MHz and even more for higher frequencies) so we can avoid a lot multiplications and summations. The IDFT is defined below and also given is our modification to it.
Further improvement in computation time is achieved by implementing the above as a matrix multiplication. The matrix multiplication is implemented as H*X where H is the IDFT coefficients of size N x 2(km+1) and X is a vector of size 2(km+1) x 1 upon which the IDFT has to be performed.
Now let us look at the output sequence generated by using the above techniques. We consider the case of Medium Doppler Frequency of 70 Hz (EVA channel) as defined by LTE specifications. Sampling frequency is fixed at 10 kHz giving a normalized Doppler frequency of 0.007. This was done due to limitation of memory on the machine. The author also experimented with a sampling frequency of 7.68 MHz but this did not yield enough samples for statistically accurate results. We did use a sampling frequency of 7.68 MHz for our bit error rate simulation which is shown in the end.
It is observed for fm=70 Hz the envelope of the output sequence using the proposed technique matches quite well with the envelope of the output sequence generated by the ideal filter proposed by Young. Also the phase and envelope of the sequence generated using the proposed technique has the desired distribution. Some of the other metrics that we can look at are the level crossing rate (LCR) and average fade duration (AFD) as well as the Auto Correlation of the real and imaginary parts of the complex sequence generated.
If we look at the results for LCR and AFD we see that the simulated results match reasonably well with the results predicted by theory. These results correspond to 100 snapshots of the fading sequence. It was important to take the average of several snapshots as results varied with each simulation run. Sometimes Young’s technique produced more accurate results while at other times the proposed technique was better. Again the limitations of computer memory and processing power dictated the length of the sequence that could be generated.
In general Young’s technique produced better results than our proposed technique. It was found that product of LCR and AFD for both cases matched quite well with the theoretical value. So the total time spent in a fade state per second was equal in both the cases. In the proposed method the duration of a single fading event was higher, whereas the number of fading events per second was lower. This can be attributed to the fact that in our proposed technique higher weighting is given to lower frequency components and the fading sequence is smoothed out by these low frequency components. One technique to overcome this is spectral broadening as suggested by  but this is not the subject here and we postpone its discussion to another article.
Auto Correlation of Real Part fm=70Hz
The Auto Correlation of the real and imaginary parts of the generated sequences are also calculated for a Doppler frequency of 70 Hz. It is found that the Auto Correlation sequence for the two techniques matches quite well. However, the Auto Correlation sequence deviates from the theoretical value as calculated the by Bessel function of the first kind and zero order. Since we have used a flat spectral mask the Auto Correlation function resembles the sinc(x) function which is the same as zeroth order Spherical Bessel Function of the first kind (which is related to 1/2 order Bessel Function of the first kind).
It was found that when the Rayleigh fading sequence is generated by the program provided in Young’s thesis the shape of the Auto Correlation function depends upon the sampling frequency. At a normalized Doppler frequency of 0.05 and N=2^16 Young’s technique produces quite accurate results. We also measured the mean squared error (MSE) between the two Auto Correlations sequences and found it to be a function of the Normalized Doppler Frequency. It was found that as the Normalized Doppler Frequency was increased from 0.00007 to 0.0007 the MSE error dropped from 0.0277 to 0.0041. The relationship between the Normalized Doppler Frequency and MSE, for a fixed sequence length, seems to be resembling an exponential function. For more accurate results, at higher sampling frequencies, the number of samples would have to be increased considerably. In fact it was found that if the variable km (km=N*fm/fs) is maintained at around 20 the error between the two correlation sequences is less than 1% for all possible sampling rates.
We also compared the bit error rate (BER) performance of different QAM modulation schemes using both the techniques for fading envelope generation and found these to be matching quite well. A single tap was used which results in a flat fading channel. This is a simplistic channel model but it gives us some confidence that the proposed approach does have the desired statistical properties. A good test of a temporally correlated Rayleigh fading sequence is to test it on a system that implements interleavers and channel coders whose performance strongly depends upon factors such as the LCR and AFD e.g. a certain forward error correction (FEC) code might work well in high LCR and low AFD as this distributes out errors in different blocks and allows the code to correct them. In simulations done so far (not shown here) we have found that for a 1/2 rate convolutional encoder with Hard Viterbi Decoding the BER for the two schemes matches quite well. In general the results for correlated fading are much worse than uncorrelated fading.
In future we would also like to evaluate the bit error rate (BER) performance of an M-QAM OFDM system with Frequency Selective Rayleigh fading as described by the LTE fading channels EPA, EVA and ETU. This is probably a good scenario to compare the accuracy of the two techniques used to generate Rayleigh fading sequences above. One challenge in this regard is that the LTE channel taps are described in increments of 10 nsec whereas the LTE signal sampling rate is defined on a different scale (minimum Ts=32.5521 nsec corresponding to a sampling rate of 30.72 Msps). So we would have to do sample rate conversion to implement a time varying frequency selective Rayleigh fading channel.
 John I. Smith, “A Computer Generated Multipath Fading Simulation for Mobile Radio”, IEEE Transactions on Vehicular Technology, vol VT-24, No. 3, August 1975.
 David J. Young and Norman C. Beaulieu, “The Generation of Correlated Rayleigh Random Variates by Inverse Discrete Fourier Transform”, IEEE Transactions on Communications vol. 48 no. 7 July 2000.
 R. H. Clarke, A Statistical Theory of Mobile Radio Reception”, Bell Systems Technical Journal 47 (6), pp 957–1000, July 1968.
 Rosmansyah, Y.; Saunders, S.R.; Sweeney, P.; Tafazolli, R., “Equivalence of flat and classical Doppler sample generators,” Electronics Letters , vol.37, no.4, pp.243,244, 15 Feb 2001.
 JTC (Joint Technical Committee T1 RIP1.4 and TIA TR46.3.3/TR45.4.4 on Wireless Access): “Draft final report on RF channel characterization”. Paper no. JTC(AIR)/94.01.17-238R4, January 17, 1994.
 ETSI (European Telecommunications Standards Institute): “Universal mobile telecommunications system (UMTS); selection procedures for the choice of radio transmission technologies of the UMTS (UMTS 30.03 version 3.2.0)”. Technical Report, TR 101 112 V3.2.0 (1998-04), http://www.etsi.org, 1998.