data transmission report - 20111112 finished

Upload: hoang-mai

Post on 06-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    1/8

    Data Transmission Lab

    COMMUNICATIONSYSTEM

    Editor: Mai Xun Hong

    Instructor: Bi Th Minh T

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    2/8

    Mai Xun Hong

    2 Data Transmission Lab

    I. INTRODUCTION1. 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.

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    3/8

    Mai Xun Hong

    3 Data Transmission Lab

    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 bythe 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:

    bitsdtransmitteofnumberTotal

    bitserrorofNumberBER =

    In general, the probability of error is a function of SNR Signal to Noise Ratio.

    0

    10log10 N

    E

    SNRb

    =

    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.SIMULATION1. Simulation Concepts

    1.1 Hamming codeIn 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:

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    4/8

    Mai Xun Hong

    4 Data Transmission Lab

    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. fmtis information format, it

    is binary in this case.

    Note that, the msg input of encode function must be numeric character. Thus, togenerate msg we should utilize randintfunction 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 demodulationWe will use BPSK Binary phase-shift keying to code because it is the simplest formand the most robust all the PSKs. It uses two phases which are separated by 180

    0.

    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 ModelThe 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 correctsingle 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 lengthN = [20,50,1e4,2e5]; % Number of bit

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    5/8

    Mai Xun Hong

    5 Data Transmission Lab

    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)% Transmittermsg = randint(1,N(samp_N),[0,1]); % generating bit sequenceif mod(N(samp_N),4)~=0

    msg = [msg,zeros(1,4-mod(N(samp_N),4))];end

    % Without channel codingtx = 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');% Modulations = A(samp_A).*(2*x-1);% Channel AWGN% white gaussian noise has mean of 0 and variance of 1noise2 = randn(1,length(s));

    % Receiverr = s + noise2; % additive white gaussian noise% Demodulationy = 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 codingnErr_with_coding(samp_A) = sum(abs(msg-reco_msg2));% Countings the errors without channel codingnErr_without_coding(samp_A) = sum(abs(msg-reco_msg1));

    endBer_with_coding(samp_N,:) = nErr_with_coding/N(samp_N);Ber_without_coding(samp_N,:) = nErr_without_coding/N(samp_N);

    endclose allfigure(1)% Plot BER

    semilogy(SNR,Ber_without_coding(1,:), 'bs--','LineWidth',2);hold onsemilogy(SNR,Ber_with_coding(1,:), 'bo-','LineWidth',2);grid onlegend('N=20 without coding','N=20 with coding');figure(2)semilogy(SNR,Ber_without_coding(2,:), 'rs--','LineWidth',2);hold onsemilogy(SNR,Ber_with_coding(2,:), 'ro-','LineWidth',2);grid onlegend('N=50 wittout coding','N=50 with coding');figure(3)semilogy(SNR,Ber_without_coding(3,:), 'ks--','LineWidth',2);

    hold onsemilogy(SNR,Ber_with_coding(3,:), 'ko-','LineWidth',2);

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    6/8

    Mai Xun Hong

    6 Data Transmission Lab

    grid onlegend('N=10000 wittout coding','N=10000 with coding');figure(4)semilogy(SNR,Ber_without_coding(4,:), 'ms--','LineWidth',2);hold onsemilogy(SNR,Ber_with_coding(4,:), 'mo-','LineWidth',2);

    grid onlegend('N=200000 without coding','N=200000 with coding');

    3. ResultWith channel coding, BER was improved.

    -3.5 -3 -2.5 -2 -1.5 -1 -0.5 010-2

    10-1

    100

    N=20 without coding

    N=20 with coding

    -4 -3 -2 -1 0 1 2 3 410

    -2

    10-1

    100

    N=50 wittout coding

    N=50 with coding

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    7/8

    Mai Xun Hong

    7 Data Transmission Lab

    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:

    -4 -2 0 2 4 6 810

    -4

    10-3

    10-2

    10-1

    100

    N=10000 wittout coding

    N=10000 with coding

    -4 -2 0 2 4 6 810

    -5

    10-4

    10-3

    10-2

    10-1

    100

    N=200000 without coding

    N=200000 with coding

  • 8/3/2019 Data Transmission Report - 20111112 Finished

    8/8

    Mai Xun Hong

    8 Data Transmission Lab

    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 withto 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. ConclusionThe 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.

    The 1 dB corresponded that the power of channel no coding is equal to 25.110101

    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.

    -3.5 -3 -2.5 -2 -1.5 -1 -0.5 010

    -1

    100

    N=20 without coding

    N=20 with coding

    -4 -3 -2 -1 0 1 210

    -2

    10-1

    100

    N=50 wittout coding

    N=50 with coding