summaryrefslogtreecommitdiff
path: root/3446/CH8/EX8.3/Ex8_3.sce
blob: 43e6a72fb35e6913cd7cc5c0ea96f1278f5d0a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Exa 8.3
// To demostrate 4X4 Bit interleaving/de-interleving.

clc;
clear all;

BitStream= [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1];//Last bit to first bit

//solution
disp("Interleaving is performed by storing the data in a table containing rows and  columns at the transmitter. The data is written in rows and transmitted in a vertical direction (according to columns). At the receiver, the data is written and read in the opposite manner. ")

// Interleaver
              Input1=[1 0 0 0      //Writing data row wise
                      1 0 0 0
                      1 1 1 0
                      0 0 0 0];
disp("GIven Bit stream is")
disp(BitStream);
disp("Input to interleaver is")
disp(Input1);

Output1=[0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1];    // Reading data column wise
disp("Output of interleaver is");
disp(Output1);
//De-interleaver
              Input2=[1 1 1 0  //Writing o/p data row wise
                      0 0 1 0    
                      0 0 1 0
                      0 0 0 0];
 // Let From 6th to 9th bits have Burst Error 
 disp("Input to de-interleaver is");
 disp(Input2);
 //Output of deinterleaver
                             
Output2= [0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1]; 
disp("Output of de-interleaver is")
disp(Output2);
disp( "Bits with Burst error were from 6th to 9th. But in output of de-interleaver, they relocated to positions 3rd, 6th, 10th and 14th.");