Data Transmission Lab: Communication System
Data Transmission Lab: Communication System
COMMUNICATION SYSTEM
Instructor: Bi Th Minh T
I. INTRODUCTION 1. Requirement - Check performance of system without channel coding and with channel coding (Hamming code): + Check if the received sequence is the same at the orignal signal? + For each value of A and N compute the SNR in dB, plot the probability of message bit error vs. Eb/No. 2. Fundametals: 1.1 Communication system: A simple communication system in presented in figure 1
Figure 1 A simple communication system In adigital communication system, the message is a sequence of binary digits. It was produced by the source are converted into a sequence of binary digits and compresesed so that the source output was in little or no redundancy. After that, the information sequence is passed to the channel encoder. The purpose of the channel encoder is to introduce, in a controlled manner, some redundancy in the binary information sequence that can be used at the receiver to overcome the effects of noise and interference encountered in the transmission of the signal through the channel. Thus, the added redundancy serves to increase the reliability of the received data and improves the fidelity of the received signal. In effect, redundancy in the information sequences aids the receiver in decoding the desired information sequence. The binary sequence at the output of the channel encoder is passed to the digital modulator, the primary purpose is to map the binary information sequence into signal waveforms. The communication channel is the physical medium that is used to send the signal from the transmitter to the receiver. The channel may be the atmosphere (free space) in wireless transmission or a variety of physical media, including wire lines, optical fiber cables, and wireless (microwave radio) in telephone channels. Whatever the physical medium used for transmission of the information, the essential feature is that the transmitted signal is corrupted in a random manner by a variety of possible mechanisms.
At the receiving end of a digital communications system, the digital demodulator processes the channel-corrupted transmitted waveform and reduces the waveform to a sequence of numbers that represent estimates of the transmitted data symbols (binary or M-ary). This sequence of numbers is passed to the channel decoder, which attempts to reconstruct the original information sequence from knowledge of the code used by the channel encoder and the redundancy contained in the received data. 1.2 Performance of communication channel: The average probability of a bit-error at the output of the decoder is a measure of the performace of the demodulator-decoder combination: Number of error bits BER = Total number of transmitted bits In general, the probability of error is a function of SNR Signal to Noise Ratio. E SNR = 10 log10 b N0
where Eb is energy average of signal and No is noise power. In BPSK case, energy average of signal is equal to the amplitude of the carrier.
II. SIMULATION 1. Simulation Concepts 1.1 Hamming code In this simulation, we will utilize one error control code, known as the (7,4) Hamming block code (7,4) means that 4 message bits, are converted into a 7-bit code. The coderate of this code is 4/7. In matlab, the encode function encodes messages using the error-correction coding methods. We can use the following systnax:
code = encode(msg,n,k,'hamming/fmt',prim_poly) encodes msg using the Hamming encoding method. where n is codeword length and k is the message length. fmt is information format, it is binary in this case. Note that, the msg input of encode function must be numeric character. Thus, to generate msg we should utilize randint function with values is 0 and 1 digit. Equivalently, the decode function aims to recover messages that were encoded using an error- correction coding technique. The technique and the defining parameters must match those that were used to encode the original signal. msg = decode(code,n,k,'hamming/fmt',prim_poly) decodes code using the Hamming method.
1.2 BPSK modulation demodulation We will use BPSK Binary phase-shift keying to code because it is the simplest form and the most robust all the PSKs. It uses two phases which are separated by 1800 . Thus it takes the highest level of noise or distortion to make the demodulator reach an incorrect decision. However, it is only able to modulate at 1bit/symbol and so is unsuitable for high data-rate applications when bandwidth is limited. 1.3 Simulation Model The Matlab script performs the following (a) Initial, the length of message is N=20. (b) Generate random binary sequence of 0s and 1s whose length is 20. (c) Code them using Hamming (7,4) systematic code. The length of coded binary sequence is 35. (d) Modulate 35-bit sequence into 35-number sequence corresponding transmitted signal on channel. The amplitudes of the carrier are values of A. (e) On AWGN channel, the received signal is transmitted signal which was added noise. (f) Demodulate to convert the continuous time signal back into a discrecte one by using 0 level as a slicer. The demodulated signal is 35-bit sequence (g) Decode this sequence by using Hamming coding technique to correct single bit errors in each codeword. (h) Count the number of errors (i) Repeat of multiple values of amplitude of the carrier. (j) Compute the SNR in dB and the probability of message bit error (k) Plot the simulation results. 2. Matlab script for general case of N:
clear all; clc; m = 3; n = 2^m-1; % Codeword length = 7 k = 4; % Message length N = [20,50,1e4,2e5]; % Number of bit
A = [0.5,1/sqrt(2),1,sqrt(2),2*sqrt(2),4,4*sqrt(2)]; SNR = 10*log10(A); Ber_without_coding = zeros(length(N),length(A)); Ber_with_coding = zeros(length(N),length(A)); for samp_N=1:length(N) for samp_A=1:length(A) % Transmitter msg = randint(1,N(samp_N),[0,1]); % generating bit sequence if mod(N(samp_N),4)~=0 msg = [msg,zeros(1,4-mod(N(samp_N),4))]; end % Without channel coding tx = A(samp_A)*(2*msg-1); noise1 = randn(1,length(tx)); rx = tx + noise1; reco_msg1 = rx > 0; % With channel coding % Hamming coding (7,4) x = encode(msg,n,k,'hamming/binary'); % Modulation s = A(samp_A).*(2*x-1); % Channel AWGN % white gaussian noise has mean of 0 and variance of 1 noise2 = randn(1,length(s)); % Receiver r = s + noise2; % additive white gaussian noise % Demodulation y = r > 0; % Hamming decoding (7,4) and correct a single error in each codeword reco_msg2 = decode(y,n,k,'hamming/binary'); % Countings the errors with channel coding nErr_with_coding(samp_A) = sum(abs(msg-reco_msg2)); % Countings the errors without channel coding nErr_without_coding(samp_A) = sum(abs(msg-reco_msg1)); end Ber_with_coding(samp_N,:) = nErr_with_coding/N(samp_N); Ber_without_coding(samp_N,:) = nErr_without_coding/N(samp_N); end close all figure(1) % Plot BER semilogy(SNR,Ber_without_coding(1,:),'bs--','LineWidth',2); hold on semilogy(SNR,Ber_with_coding(1,:),'bo-','LineWidth',2); grid on legend('N=20 without coding','N=20 with coding'); figure(2) semilogy(SNR,Ber_without_coding(2,:),'rs--','LineWidth',2); hold on semilogy(SNR,Ber_with_coding(2,:),'ro-','LineWidth',2); grid on legend('N=50 wittout coding','N=50 with coding'); figure(3) semilogy(SNR,Ber_without_coding(3,:),'ks--','LineWidth',2); hold on semilogy(SNR,Ber_with_coding(3,:),'ko-','LineWidth',2);
grid on legend('N=10000 wittout coding','N=10000 with coding'); figure(4) semilogy(SNR,Ber_without_coding(4,:),'ms--','LineWidth',2); hold on semilogy(SNR,Ber_with_coding(4,:),'mo-','LineWidth',2); grid on legend('N=200000 without coding','N=200000 with coding');
10
-1
10 -3.5
-2
-3
-2.5
-2
-1.5
-1
-0.5
10
10
-1
10
-2
-4
-3
-2
-1
10
10
10
-2
10
-3
10
-4
-4
-2
10
10
-2
10
-3
10
-4
10
-5
-4
-2
When the number of bits N was greater, the probability of message bit error increased. With N=20 or N=50, there might be the invalid result as two below figures:
10
10
10
-1
10 -3.5
-1
-3
-2.5
-2
-1.5
-1
-0.5
10
-2
-4
-3
-2
-1
Because when BER decreased corresponding the increased SNR, the number of error bits was not enough to simulate. Therefore the validity of the results depends on not only of A, but also data stream length. A simulation was not useful if the chosen parameters yielded no errors, because there was always the least of one error bit on communication system. Example, we would need the least of 107 bits to simulate with to detect a probability of error of 10-7. However we shouldnt choose a very long data stream because it might become computationally prohibitive. In valid result, the curves of channel coding was always under the curves of channel no coding. This was closely with the theoretical curves shown in figure 5.
III. Conclusion The quality of channel coding was better than channel no coding. However the inserted bit was increased, the bandwidth would be limitted.
Assuming acceptable BER was 10-4 in digital communication system, this BER could be gotten with a SNR diference of 1dB between coding curve and no coding curve.
1
The 1 dB corresponded that the power of channel no coding is equal to 1010 1.25 time of the power of channel coding. Equivalently, the saved power was time of neceesary power when channel coding was used.
But the bandwidth increased 70% for channel using (7,4) Hamming code. In other words, the bit rate decreased 70%. Therefore, if we needed the high bit rate, we should simply raise the signal to noise ratio without channel coding. On other hand, if we needed save power, we should use coding to control error.