Академический Документы
Профессиональный Документы
Культура Документы
Chapter 3 Matlab Simulations.............................................................................................1 3.1 Introduction....................................................................................................................2 3.1.1 Introduction to Matlab............................................................................................2 3.1.2 Modules for Simulation..........................................................................................2 3.2 Coding............................................................................................................................4 3.2.1 Flow chart (If possible)...........................................................................................4 3.2.2 Simulations.............................................................................................................4 3.2.2.1 Comparison of multiplexing strategies............................................................4 3.2.2.2 Comparison of different coding strategies.......................................................4 3.2.2.3 Protocol testing................................................................................................4 3.2.2.4 Any more if there are...................................................................................4 3.3 Channel..........................................................................................................................5 In order to transmit, it is significant to simulate the channel. Wireless channels are impaired by fading and noise which will be simulated here separately along with their flowcharts.........................................................................................................................5 3.3.1 Flowchart of Fading ...............................................................................................5 3.3.2 Simulation of Fading...............................................................................................6 3.3.3 Gaussian Noise..................................................................................................11 Figure 6: Noise simulation flow chart...........................................................................11 3.3.4 Simulation of Gaussian Noise...........................................................................11 3.4 Modem.........................................................................................................................13 3.4.1 Flow chart.............................................................................................................13 3.4.2 Simulation.............................................................................................................13 3.5. Integration...................................................................................................................13 3.6 Diversity.......................................................................................................................13
3.1 Introduction
In this chapter, simulations are going to be discussed. Every block or part will be separately tested, analyzed and presented here. The language of technical computing Matlab is used for the simulations. The flowcharts for the matlab codes of these simulations will be shown for better and easy understanding of the codes. The codes are placed in the appendices for later reference.
Mux.m Protocfun.m Modulation_Simu.m AWGNChannel.m Demodulation_Simu.m o Diversity.m Decodefun.m Deprotocfun.m Demodulation_Simu14.m o Diversity14.m Plot_AWGN_Sample1_Code1_Diver.m Plot_AWGN_Samples_1510.m principa11.m principa12.m
The Questionfun.m module asks questions to the user about the choices of way of multiplexing, coding technique, the time of observation and diversity technique. Dopplarfading.m module generates flat Rayleigh complex fading and stores it in the matrix. Generfun.m generates the data which will be positions for our case to be transmitted. Mux.m multiplexes the data in chosen way. Protocfun.m places the data frame in the protocol. Modulation_Simu.m modulates the signal. AWGNChannel.m generates complex AWGN noise. Demodulation_Simu.m demodulates the signal and calls Diversity.m which uses diversity technique. Decodefun.m decodes which is comparing the redundant data and choosing the best one. Deprotocfun.m removes the protocol flags, counters and repetition bits. Have to discuss last six files
3.2 Coding
3.2.1 Flow chart (If possible) 3.2.2 Simulations
3.2.2.1 Comparison of multiplexing strategies 3.2.2.2 Comparison of different coding strategies 3.2.2.3 Protocol testing 3.2.2.4 Any more if there are
3.3 Channel
In order to transmit, it is significant to simulate the channel. Wireless channels are impaired by fading and noise which will be simulated here separately along with their flowcharts.
[2]
Figure 1: Smiths model N (0, ) shows two normally distributed generators with mean zero and standard deviation sigma. Ak and Bk are the zero mean Gaussian sequences in frequency domain which are multiplied with Fk. Fk are the filter coefficients and in our case they are the square root of sampled power spectral density of Rayleigh distribution. K represents sequence and k is the index. One component is multiplied with -j to make it complex and then added as follows: Zk=FkAk-jFkBk After obtaining Zk its inverse Discrete fourier transform is taken. In Matlab this will be Inverse fast fourier transform (IFFT) and time domain representation will be obtained which is zk. In the last block, the absolute value is taken which is obtained as k .
Figure 2: Channel fading for velocity 1 m/s and wavelength 88.2 mm at baseband It would be possible to transmit without errors in the upper part of the figure where the gain is 0 dBs and above. This is the place where the multipath waves interfere constructively thus giving strength to the transmitted signal. As we go down, we approach to a place where the multipath waves start to interfere destructively and thus reducing the strength of the signal. The maximum depth of deep fade can be seen till about -50 dB and -30dB where burst of errors are to occur. To avoid this, we have used redundancy coding technique and diversity technique which will be analyzed in the further sections. For good computer based Rayleigh simulation, one percent cumulative samples from minimum should be approximately 20 dB. We tested our channel about 30 times and 25 times 1% cumulative level was in the range of -21 to -18.5 dB and rest of the times it was between -22 to 17 dB. 3.3.2.2 Phase jumps of fading In the following figure 3 the phase changes can be seen:
Figure 3: Illustration of jump of angle Figure 3 is illustrating the jump of angle for the fading shown above in figure 2. It can be seen that every deep fade there is a jump of angle of about a pi. This also verifies that the deep fade has an effect of changing the transmission by pi which results in strength loss of the signal thus causing errors to occur.
Theoretically the envelop of fading should follow the Rayleigh distribution and phase should be uniformly distributed over [-pi,pi) Refer to Chapter 2.
Figure 4: Illustration of fading amplitude following Rayleigh distribution It can be seen in figure 4 that for 9600 samples and observation time 400 seconds, the amplitude of fading follows Rayleigh distribution ideally.
3.3.2.4 Verification of fading phase In figure 5 it can be seen that the phase of fading is uniformly distributed from pi to pi as explained in theory. This verifies that our channel simulation is ideal. The [-pi,pi) is marked by a line in the figure 5 and given a name of reference value.
Figure 5: Phase verification The phase -pi is the same as pi in matlab, so the probability at two sides show half of the total probability.
Figure 6: Noise simulation flow chart In the figure 6, there are two zero mean Gaussian generators. The non-complex part refers to the in-phase component of the noise and complex part refers to the quadrature component. Both components are at right angle to each other, therefore both of them will be normally distributed at right angles refer to section 3.3.2.2
Figure 7: Gaussian noise So, it can be seen that even if there is nothing transmitted the receiver might detect something which can cause errors. Modulation is used in order to handle this problem.
3.4 Modem
3.4.1 Flow chart 3.4.2 Simulation