Final Copy (Record)

Embed Size (px)

Citation preview

  • 8/6/2019 Final Copy (Record)

    1/187

  • 8/6/2019 Final Copy (Record)

    2/187

    AIM:

    To write a program to find the shortest distance between two nodes using distance vector

    routing algorithm for linear topology in LAN-T network routing protocol simulator.

    APPARATUS REQUIRED:

    1. LAN-T network routing protocol simulator.

    2. Personal computer.

    PROCEDURE :

    1. In step 1, open the LAN-T Routing protocol simulator version 3.1.

    2. Create the linear network model and assign number of nodes and edges in the

    program.

    3. Then assign the co-ordinates for each defined nodes in the program.

    4. In this step, declare the distance between each node.

    5. Open the linear network model by using the path File-> load configuration.

    6. Apply distance vector routing algorithm mechanism using the path simulator->

    configure-> distance vector.

    7. Observe the values of graph adjacency matrix, which is displayed in the screen.

    8. Preceding the above step, finally record the values.

    9. Update the step value for each node by n based on the prescribed design using the

    path.

    10. Finally, stop updating the step size where distance variant becomes constant in the

    step values.

    2

    EX NO: 1a

    DATE: 17.09.10IMPLEMENTATION OF DISTANCE VECTOR ROUTING ALGORITHM IN

    LINEAR TOPOLOGY

  • 8/6/2019 Final Copy (Record)

    3/187

    PROGRAM:

    # Any line begining with '#' is a comment

    #Number of nodes

    N=15

    #Number of Edges

    E=14

    # Give the coordinates for nodes N1,N2,N3 etc in order

    N0= {25,175}

    N1= {100,300}

    N2= {150,100}

    N3= {200,300}

    N4= {250,100}

    N5= {300,300}

    N6= {350,100}N7= {400,300}

    N8= {450,100}

    N9= {500,300}

    N10= {550,100}

    N11= {600,300}

    N12= {650,100}

    N13= {700,300}

    N14= {825,175}

    THEORY:

    Distance Vector Routing

    Modern computer networks generally use dynamic routing algorithms rather than static

    ones described above. Two dynamic algorithm in particular distance vector and link state

    routing are the most popular.

    3

  • 8/6/2019 Final Copy (Record)

    4/187

  • 8/6/2019 Final Copy (Record)

    5/187

    E7= {n7, n8, 2, 8}

    E8= {n8, n9, 3, 9}

    E9= {n9, n10, 4, 8} `

    E10= {n10, n11, 2, 3}

    E11= {n11, n12, 5, 3}

    E12= {n12, n13, 6, 4}

    E13= {n13, n14, 7, 4}

    OUTPUT: Graph Adjacency Matrix

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 2 0 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 -1 4 0 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 -1 5 0 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 -1 6 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 -1 10 0 6 -1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 -1 3 0 4 -1 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 -1 8 0 2 -1 -1 -1 -1 -1 -1

    5

  • 8/6/2019 Final Copy (Record)

    6/187

    N8 -1 -1 -1 -1 -1 -1 -1 8 0 3 -1 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 -1 9 0 4 -1 -1 -1 -1

    N1

    0-1 -1 -1 -1 -1 -1 -1 -1 -1 8 0 2 -1 -1 -1

    N1

    1-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 0 5 -1 -1

    N1

    2-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 0 6 -1

    N1

    3-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0 7

    N1

    4-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0

    Graph Matrix Simulation Step 1

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 5 0 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 -1 7 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 -1 8 0 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 -1 2 0 10 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 -1 5 0 3 -1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 -1 6 0 8 -1 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 -1 4 0 8 -1 -1 -1 -1 -1 -1

    N8 -1 -1 -1 -1 -1 -1 -1 2 0 9 -1 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 -1 3 0 8 -1 -1 -1 -1

    N10 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0 3 -1 -1 -1

    N11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 0 3 -1 -1

    N12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 0 4 -1

    N13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 0 4

    N14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 0

    6

  • 8/6/2019 Final Copy (Record)

    7/187

    LINEAR TOPOLOGY:

    PATH:

    Source=N0

    Destination=N5

    7

  • 8/6/2019 Final Copy (Record)

    8/187

    Distance=N0N1N2N3N4N5=5+7+8+2+5=27

    Graph Matrix Simulation Step 5

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 6 11 17 27 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 5 0 4 9 15 25 28 -1 -1 -1 -1 -1 -1 -1 -1

    N2 12 7 0 5 11 21 24 32 -1 -1 -1 -1 -1 -1 -1

    N3 20 15 8 0 6 16 19 27 35 -1 -1 -1 -1 -1 -1

    N4 22 17 10 2 0 10 13 21 29 38 -1 -1 -1 -1 -1

    N5 27 22 15 7 5 0 3 11 19 28 36 -1 -1 -1 -1

    N6 -1 28 21 13 11 6 0 8 16 25 33 36 -1 -1 -1

    N7 -1 -1 25 17 15 10 4 0 8 17 25 28 31 -1 -1

    N8 -1 -1 -1 19 17 12 6 2 0 9 17 20 23 27 -1

    N9 -1 -1 -1 -1 20 15 9 5 3 0 8 11 14 18 22

    N1

    0-1 -1 -1 -1 -1 19 13 9 7 4 0 3 6 10 14

    N1

    1-1 -1 -1 -1 -1 -1 15 11 9 6 2 0 3 7 11

    N1

    2-1 -1 -1 -1 -1 -1 -1 16 14 11 7 5 0 4 8

    N1

    3

    -1 -1 -1 -1 -1 -1 -1 -1 20 17 13 11 6 0 4

    N1

    4-1 -1 -1 -1 -1 -1 -1 -1 -1 24 20 18 13 7 0

    Graph Matrix Simulation Step 15

    8

  • 8/6/2019 Final Copy (Record)

    9/187

  • 8/6/2019 Final Copy (Record)

    10/187

    10

  • 8/6/2019 Final Copy (Record)

    11/187

    RESULT:

    Thus the program for calculating shortest distance between two nodes using distance

    vector algorithm for linear topology in LAN-T network routing protocol simulator was

    successfully executed and the output was verified.

    LINEAR TOPOLOGY:

    11

  • 8/6/2019 Final Copy (Record)

    12/187

    12

  • 8/6/2019 Final Copy (Record)

    13/187

    AIM:

    To write a program to find the shortest distance between two nodes using link state

    routing algorithm for linear topology in LAN-T network routing protocol simulator.

    APPARATUS REQUIRED:

    1. LAN-T network routing protocol simulator.

    2. Personal computer.

    PROCEDURE :

    1. In step 1, open the LAN-T Routing protocol simulator version 3.1.

    2. Create the linear network model and assign number of nodes and edges in the

    program.

    3. Then assign the co-ordinates for each defined nodes in the program.

    4. In this step, declare the distance between each node.

    5. Open the linear network model by using the path File-> load configuration.

    6. Apply link state routing algorithm mechanism using the path simulator-> configure->

    link

    vector.

    7. Observe the values of graph adjacency matrix, which is displayed in the screen.

    8. Preceding the above step, finally record the values.

    9. Update the step value for each node by n based on the prescribed design using the

    path.

    13

    EX NO: 1b

    DATE: 17.09.10IMPLEMENTATION OF LINK STATE ROUTING

    ALGORITHM IN LINEAR TOPOLOGY

  • 8/6/2019 Final Copy (Record)

    14/187

    10. Finally, stop updating the step size where distance variant becomes constant in the

    step values.

    PROGRAM:

    # Any line begining with '#' is a comment

    #Number of nodes

    N=15

    #Number of Edges

    E=14

    # Give the coordinates for nodes N1, N2, N3 etc in order

    N0= {25,175}

    N1= {100,300}

    N2= {150,100}

    N3= {200,300}

    N4= {250,100}

    N5= {300,300}

    N6= {350,100}

    N7= {400,300}

    N8= {450,100}

    N9= {500,300}

    N10= {550,100}

    N11= {600,300}

    N12= {650,100}

    N13= {700,300}

    N14= {825,175}

    14

  • 8/6/2019 Final Copy (Record)

    15/187

    THEORY:

    Link-State Routing

    Routing protocols discover routes on interconnected networks and build routing tables

    that provide routers with packet-forwarding information. Dynamic routing protocols (as opposed

    to manually configured static routing) automatically discover routes and create routing tableswithout operator intervention. Since network topologies are subject to change at any time (a link

    may fail), dynamic protocols are essential for routing around failed links in large internetworks.

    Routing protocol may use distance vector routing or link state routing algorithms (also

    called shortest path first or SPF algorithms). Distance vector routing can best be described as

    forwarding packets by getting directions along the way. Link state routing is a better technique

    for larger networks. Routers use it to build a topological database that describes routes on the

    entire internetworks. This information is used to build routing tables with more accurate routing

    information. Link state routing also responds faster to changes in the network. Link state routing

    is now the preferred routing method for most organizations and internet service providers.

    The most important concept for link state routing is that routers gather information about

    routes over the entire network. Link state routers gather this information from neighbors and

    pass it on to other neighbors. Eventually, all the routers have information about all the links on

    the network. Then, each router runs the Dijkstra shortest path algorithm to calculate the best path

    to each network and create routing tables.

    Problem

    15

  • 8/6/2019 Final Copy (Record)

    16/187

    As mentioned, link-state routing responds faster to broken links or the addition of links.

    Routes can be based on the avoidance of congested area, the speed of a line, the cost of using a

    line, or various priorities. OSPF (Open Shortest Path First) is the most common routing protocol

    to use the link state algorithm. Refer to the OSPF topic for more details about the operation of

    link state routing.

    # Give the details for each edge (node1, node2, w_f, w_r)

    E0= {n0, n1, 5, 2}

    E1= {n1, n2, 7, 4}

    E2= {n2, n3, 8, 5}

    E3= {n3, n4, 2, 6}

    E4= {n4, n5, 5, 10}

    E5= {n5, n6, 6, 3}

    E6= {n6, n7, 4, 8}

    E7= {n7, n8, 2, 8}

    E8= {n8, n9, 3, 9}

    E9= {n9, n10, 4, 8}

    E10= {n10, n11, 2, 3}

    E11= {n11, n12, 5, 3}

    E12= {n12, n13, 6, 4}

    E13= {n13, n14, 7, 4}

    16

  • 8/6/2019 Final Copy (Record)

    17/187

    OUTPUT:

    Graph Adjacency Matrix

    N

    0

    N

    1

    N

    2

    N

    3

    N

    4

    N

    5

    N

    6

    N

    7

    N

    8

    N

    9

    N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 2 0 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 -1 4 0 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 -1 5 0 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 -1 6 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 -1 10 0 6 -1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 -1 3 0 4 -1 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 -1 8 0 2 -1 -1 -1 -1 -1 -1

    N8 -1 -1 -1 -1 -1 -1 -1 8 0 3 -1 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 -1 9 0 4 -1 -1 -1 -1

    N1

    0-1 -1 -1 -1 -1 -1 -1 -1 -1 8 0 2 -1 -1 -1

    N1

    1-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 0 5 -1 -1

    N1

    2-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 0 6 -1

    17

  • 8/6/2019 Final Copy (Record)

    18/187

    N1

    3-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0 7

    N1

    4-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0

    Graph Matrix Simulation Step 1

    N

    0

    N

    1

    N

    2

    N

    3

    N

    4

    N

    5

    N

    6

    N

    7

    N

    8

    N

    9

    N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 5 0 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 -1 7 0 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 -1 8 0 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 -1 2 0 10 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 -1 5 0 3 -1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 -1 6 0 8 -1 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 -1 4 0 8 -1 -1 -1 -1 -1 -1

    N8 -1 -1 -1 -1 -1 -1 -1 2 0 9 -1 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 -1 3 0 8 -1 -1 -1 -1

    N10

    -1 -1 -1 -1 -1 -1 -1 -1 -1 4 0 3 -1 -1 -1

    N1

    1-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 0 3 -1 -1

    N1

    2-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 0 4 -1

    N1

    3-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 0 4

    N14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 0

    18

  • 8/6/2019 Final Copy (Record)

    19/187

  • 8/6/2019 Final Copy (Record)

    20/187

  • 8/6/2019 Final Copy (Record)

    21/187

    N2 12 7 0 5 11 21 24 32 40 49 57 60 63 67 71

    N3 20 15 8 0 6 16 19 27 35 44 52 55 58 62 66

    N4 22 17 10 2 0 10 13 21 29 38 46 49 52 56 60

    N5 27 22 15 7 5 0 3 18 19 28 36 39 42 46 50

    N6 33 28 21 13 11 6 0 8 16 25 33 36 39 43 47

    N7 37 32 25 17 15 10 4 0 8 17 25 28 31 35 39

    N8 39 34 27 19 17 12 6 2 0 9 17 20 23 27 31

    N9 42 37 30 22 20 15 9 5 3 0 8 11 14 18 22

    N1

    046 41 34 26 24 19 13 9 7 4 0 3 6 10 14

    N1

    148 43 36 28 26 21 15 11 9 6 2 0 3 7 11

    N1

    253 48 41 33 31 26 20 16 14 11 7 5 0 4 8

    N1

    359 54 47 39 37 32 26 22 20 17 13 11 6 0 4

    N1

    466 61 54 46 44 39 33 29 27 24 20 18 13 7 0

    21

  • 8/6/2019 Final Copy (Record)

    22/187

    22

  • 8/6/2019 Final Copy (Record)

    23/187

    RESULT:

    Thus the program for calculating shortest distance between two nodes using link state

    routing algorithm for linear topology in LAN-T network routing protocol simulator was

    successfully executed and the output was verified.

    MESH TOPOLOGY:

    23

  • 8/6/2019 Final Copy (Record)

    24/187

    AIM:

    24

    EX NO: 1c

    DATE: 24.09.10

    IMPLEMENTATION OF DISTANCE VECTOR ROUTING ALGORITHM IN

    MESH TOPOLOGY

  • 8/6/2019 Final Copy (Record)

    25/187

    To write a program to find the shortest distance between two nodes using distance vector

    routing algorithm for mesh topology in LAN-T network routing protocol simulator.

    APPARATUS REQUIRED:

    1. LAN-T network routing protocol simulator

    2. Personal computer

    PROCEDURE:

    1. In step 1, open the LAN-T Routing protocol simulator version 3.1.

    2. Create the linear network model and assign number of nodes and edges in the

    program.

    3. Then assign the co-ordinates for each defined nodes in the program.

    4. In this step, declare the distance between each node.5. Open the linear network model by using the path File-> load configuration.

    6. Apply distance vector routing algorithm mechanism using the path simulator->

    configure->Distance vector.

    7. Observe the values of graph adjacency matrix, which is displayed in the screen.

    8. Preceding the above step, finally record the values.

    9. Update the step value for each node by n based on the prescribed design using the

    path.

    10.Finally, stop updating the step size where distance variant becomes constant in the

    step values.

    PROGRAM:

    # any line beginning with '#' is a comment#Number of nodesN=15#Number of Edges

    25

  • 8/6/2019 Final Copy (Record)

    26/187

    E=27# Give the coordinates for nodes N1, N2, N3 etc in orderN0= {25,175}N1= {100,300}N2= {150,100}N3= {200,300}N4= {250,100}N5= {300,300}N6= {350,100}N7= {400,300}N8= {450,100}N9= {500,300}N10= {550,100}N11= {600,300}N12= {650,100}N13= {700,300}N14= {825,175}

    THEORY:

    Distance Vector Routing

    26

  • 8/6/2019 Final Copy (Record)

    27/187

    Modern computer networks generally use dynamic routing algorithms rather than static

    ones described above. Two dynamic algorithm in particular distance vector and link state

    routing are the most popular.

    Distance routing algorithms operate by having each router maintain a table giving the

    best known distance to each destination and which line to use to get there. These tables are

    updated by exchanging information with the neighbors.

    The distance vector routing algorithm is sometimes called by Bellman-Ford or Ford-

    Fulkerson. It was the original ARPANET routing algorithm and was also used in the internet

    under the name RIP and early version of DECNET and NOVELLS IPX. Apple talk and CISCO

    router use improved distance vector protocol.

    In that algorithm each router maintains a routing table indexed and containing one entry

    for each router in the subnet. This entry contains 2 parts: the preferred outgoing line to use for

    that destination and an estimate of the time or distance to that destination. The metric used to be

    number of hops, time delay in milliseconds & total number of packets queued along the path or

    something similar.

    Problem

    No router ever has a value more than one higher than the minimum of all its neighbors.

    Gradually, all the router work their way up to infinite, but the number of exchanges required

    depends on the numerical value used for infinite. One of the solution to this problem is split

    horizon algorithm that defines the distance to the X router is reported as infinity on the line that

    packets for X are send on. Under that behavior bad news propagate also at linear speed through

    the subnet.

    27

  • 8/6/2019 Final Copy (Record)

    28/187

  • 8/6/2019 Final Copy (Record)

    29/187

    OUTPUT:

    Graph Adjacency Matrix

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9

    N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 1 0 6 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 3 5 0 12 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 9 11 0 3 2 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 7 11 0 5 6 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 13 12 0 12 1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 12 6 0 4 13 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 15 15 0 12 2 -1 -1 -1 -1 -1

    N8 -1 -1 -1 -1 -1 -1 7 8 0 2 6 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 16 15 0 8 7 -1 -1 -1

    N1

    0-1 -1 -1 -1 -1 -1 -1 -1 7 15 0 2 9 -1 -1

    N1

    1-1 -1 -1 -1 -1 -1 -1 -1 -1 12 12 0 9 8 -1

    N1

    2-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 5 0 12 1

    N1

    3-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 9 0 2

    N1

    4-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9 8 0

    29

  • 8/6/2019 Final Copy (Record)

    30/187

    MESH TOPOLOGY:

    PATH:

    Source=N0

    Destination=N5

    Forward Distance=N0N2N4N5=22

    Reverse Distance=N5N4N2N0=17

    30

  • 8/6/2019 Final Copy (Record)

    31/187

    ALTERNATIVE PATH:

    Forward Distance=N0N1N2N3N5=30

    Reverse Distance=N5N3N2N1N0=32

    Graph Matrix Simulation Step 1

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 4 12 12 14 18 15 27 17 37 -1 -1 -1 -1

    N1 1 0 5 10 13 12 19 13 25 15 23 22 -1 -1 -1

    N2 3 5 0 12 8 13 14 14 26 16 24 23 42 -1 -1

    N3 10 9 10 0 3 2 9 3 15 5 13 12 21 20 -1

    N4 10 12 7 11 0 5 6 6 18 8 16 15 24 23 35

    N5 22 22 19 13 12 0 12 1 13 3 11 10 19 18 20

    N6 22 24 19 19 12 6 0 4 13 6 14 13 22 21 23

    N7 37 37 34 28 27 15 15 0 12 2 10 9 18 17 19

    N8 29 31 26 26 19 13 7 8 0 2 6 8 15 16 16

    N9 44 46 41 41 34 28 22 16 15 0 8 7 16 15 17

    N1

    036 38 33 33 26 20 14 15 7 9 0 2 9 10 10

    N1

    1-1 -1 45 45 36 30 24 25 17 12 10 0 9 8 10

    N1

    2-1 -1 34 34 27 21 15 16 8 10 1 3 0 9 1

    N1

    3-1 -1 -1 39 36 30 24 25 17 15 10 3 9 0 2

    N1

    4 -1 -1 -1 -1 36 30 24 25 17 19 10 11 9 8 0

    Graph Matrix Simulation Step 5

    31

  • 8/6/2019 Final Copy (Record)

    32/187

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9N1

    0

    N1

    1

    N1

    2

    N1

    3

    N1

    4

    N0 0 2 4 12 12 14 18 15 27 17 25 24 33 32 34

    N1 1 0 5 10 13 12 19 13 25 15 23 22 31 30 32

    N2 3 5 0 12 8 13 14 14 26 16 24 23 32 31 33

    N3 10 9 10 0 3 2 9 3 15 5 13 12 21 20 22

    N4 10 12 7 11 0 5 6 6 18 8 16 15 24 23 25

    N5 22 22 19 13 12 0 12 1 13 3 11 10 19 18 20

    N6 22 24 19 19 12 6 0 4 13 6 14 13 22 21 23

    N7 37 37 34 28 27 15 15 0 12 2 10 9 18 17 19

    N8 29 31 26 26 19 13 7 8 0 2 6 8 15 16 16

    N9 44 46 41 41 34 28 22 16 15 0 8 7 16 15 17

    N10 36 38 33 33 26 20 14 15 7 9 0 2 9 10 10

    N11 46 48 43 43 36 30 24 25 17 12 10 0 9 8 10

    N12 37 39 34 34 27 21 15 16 8 10 1 3 0 9 1

    N13 46 48 43 43 36 30 24 25 17 15 10 3 9 0 2

    N14 46 48 43 43 36 30 24 25 17 19 10 11 9 8 0

    32

  • 8/6/2019 Final Copy (Record)

    33/187

    33

  • 8/6/2019 Final Copy (Record)

    34/187

    RESULT:

    Thus the program for calculating shortest distance between two nodes using distance

    vector algorithm for mesh topology in LAN-T network routing protocol simulator was

    successfully executed and the output was verified.

    MESH TOPOLOGY:

    34

  • 8/6/2019 Final Copy (Record)

    35/187

    35

  • 8/6/2019 Final Copy (Record)

    36/187

    AIM:

    To write a program to find the shortest distance between two nodes using link state

    routing algorithm for mesh topology in LAN-T network routing protocol simulator.

    APPARATUS REQUIRED:

    1. LAN-T network routing protocol simulator

    2. Personal computer

    PROCEDURE:

    1. In step 1, open the LAN-T Routing protocol simulator version 3.1.

    2. Create the linear network model and assign number of nodes and edges in the program.

    3. Then assign the co-ordinates for each defined nodes in the program.

    4. In this step, declare the distance between each node.

    5. Open the linear network model by using the path File-> load configuration.

    6. Apply link state routing algorithm mechanism using the path simulator-> configure->

    link vector.

    7. Observe the values of graph adjacency matrix, which is displayed in the screen.

    8. Preceding the above step, finally record the values.

    9. Update the step value for each node by n based on the prescribed design using the path.

    10.Finally, stop updating the step size where distance variant becomes constant in the step

    values.

    36

    EX NO: 1d

    DATE: 24.09.10IMPLEMENTATION OF LINK STATE ROUTING

    ALGORITHM IN MESH TOPOLOGY

  • 8/6/2019 Final Copy (Record)

    37/187

  • 8/6/2019 Final Copy (Record)

    38/187

    THEORY:

    Link-State Routing

    Routing protocols discover routes on interconnected networks and build routing tables

    that provide routers with packet-forwarding information. Dynamic routing protocols (as opposed

    to manually configured static routing) automatically discover routes and create routing tables

    without operator intervention. Since network topologies are subject to change at any time (a link

    may fail), dynamic protocols are essential for routing around failed links in large internetworks.

    Routing protocol may use distance vector routing or link state routing algorithms (also

    called shortest path first or SPF algorithms). Distance vector routing can best be described as

    forwarding packets by getting directions along the way. Link state routing is a better technique

    for larger networks. Routers use it to build a topological database that describes routes on the

    entire internetworks. This information is used to build routing tables with more accurate routing

    information. Link state routing also responds faster to changes in the network. Link state routing

    is now the preferred routing method for most organizations and internet service providers.

    The most important concept for link state routing is that routers gather information about

    routes over the entire network. Link state routers gather this information from neighbors and

    pass it on to other neighbors. Eventually, all the routers have information about all the links on

    the network. Then, each router runs the Dijkstra shortest path algorithm to calculate the best path

    to each network and create routing tables.

    Problem

    38

  • 8/6/2019 Final Copy (Record)

    39/187

  • 8/6/2019 Final Copy (Record)

    40/187

  • 8/6/2019 Final Copy (Record)

    41/187

    Graph Matrix Simulation Step 1

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 N12 N13 N14

    N0 0 2 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N1 1 0 6 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N2 3 5 0 12 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N3 -1 9 11 0 3 2 -1 -1 -1 -1 -1 -1 -1 -1 -1

    N4 -1 -1 7 11 0 5 6 -1 -1 -1 -1 -1 -1 -1 -1

    N5 -1 -1 -1 13 12 0 12 1 -1 -1 -1 -1 -1 -1 -1

    N6 -1 -1 -1 -1 12 6 0 4 13 -1 -1 -1 -1 -1 -1

    N7 -1 -1 -1 -1 -1 15 15 0 12 2 -1 -1 -1 -1 -1

    N8 -1 -1 -1 -1 -1 -1 7 8 0 2 6 -1 -1 -1 -1

    N9 -1 -1 -1 -1 -1 -1 -1 16 15 0 8 7 -1 -1 -1

    N10 -1 -1 -1 -1 -1 -1 -1 -1 7 15 0 2 9 -1 -1

    N11 -1 -1 -1 -1 -1 -1 -1 -1 -1 12 12 0 9 8 -1

    N12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 5 0 12 1

    N13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 9 0 2

    N14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9 8 0

    MESH TOPOLOGY:

    41

  • 8/6/2019 Final Copy (Record)

    42/187

    PATH:

    Source=N0

    Destination=N5

    Forward Distance=N0N2N4N5=22

    Reverse Distance=N5N4N2N0=17

    ALTERNATIVE PATH:

    Forward Distance=N0N1N2N3N5=30

    Reverse Distance=N5N3N2N1N0=32

    Graph Matrix Simulation Step 5

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 N12 N13 N14

    N0 0 2 4 12 12 14 18 15 27 17 25 24 33 32 34

    N1 1 0 5 10 13 12 19 13 25 15 23 22 31 30 32

    42

  • 8/6/2019 Final Copy (Record)

    43/187

    N2 3 5 0 12 8 13 14 14 26 16 24 23 32 31 33

    N3 10 9 10 0 3 2 9 3 15 5 13 12 21 20 22

    N4 10 12 7 11 0 5 6 6 18 8 16 15 24 23 25

    N5 22 22 19 13 12 0 12 1 13 3 11 10 19 18 20

    N6 22 24 19 19 12 6 0 4 13 6 14 13 22 21 23

    N7 37 37 34 28 27 15 15 0 12 2 10 9 18 17 19

    N8 29 31 26 26 19 13 7 8 0 2 6 8 15 16 16

    N9 44 46 41 41 34 28 22 16 15 0 8 7 16 15 17

    N10 36 38 33 33 26 20 14 15 7 9 0 2 9 10 10

    N11 46 48 43 43 36 30 24 25 17 12 10 0 9 8 10

    N12 37 39 34 44 27 21 15 16 8 10 1 3 0 9 1

    N13 46 48 43 43 36 30 24 25 17 15 10 3 9 0 2

    N14 46 48 43 43 36 30 24 25 17 19 10 11 9 8 0

    Graph Matrix Simulation Step 10

    N0 N1 N2 N3 N4 N5 N6 N7 N8 N9 N10 N11 N12 N13 N14

    N0 0 2 4 12 12 14 18 15 27 17 25 24 33 32 34

    N1 1 0 5 10 13 12 19 13 25 15 23 22 31 30 32

    N2 3 5 0 12 8 13 14 14 26 16 24 23 32 31 33

    N3 10 9 10 0 3 2 9 3 15 5 13 12 21 20 22

    N4 10 12 7 11 0 5 6 6 18 8 16 15 24 23 25

    N5 22 22 19 13 12 0 12 1 13 3 11 10 19 18 20

    N6 22 24 19 19 12 6 0 4 13 6 14 13 22 21 23

    N7 37 37 34 28 27 15 15 0 12 2 10 9 18 17 19

    N8 29 31 26 26 19 13 7 8 0 2 6 8 15 16 16

    N9 44 46 41 41 34 28 22 16 15 0 8 7 16 15 17

    N10 36 38 33 33 26 20 14 15 7 9 0 2 9 10 10

    N11 46 48 43 43 36 30 24 25 17 12 10 0 9 8 10

    43

  • 8/6/2019 Final Copy (Record)

    44/187

    N12 37 39 34 44 27 21 15 16 8 10 1 3 0 9 1

    N13 46 48 43 43 36 30 24 25 17 15 10 3 9 0 2

    N14 46 48 43 43 36 30 24 25 17 19 10 11 9 8 0

    44

  • 8/6/2019 Final Copy (Record)

    45/187

    45

  • 8/6/2019 Final Copy (Record)

    46/187

    RESULT:

    Thus the program for calculating shortest distance between two nodes using link state

    routing algorithm for mesh topology in LAN-T network routing protocol simulator was

    successfully executed and the output was verified.

    46

  • 8/6/2019 Final Copy (Record)

    47/187

    AIM:

    To write a MATLAB program for simulating the convolution code in an AWGN

    communication channel using MATLAB simulation package.

    APPARATUS REQUIRED :

    1. MATLAB package.

    2. Personal computer.

    ALGORITHM:

    1. Select start menu and choose the option MATLAB-> MATLAB R2009a.

    2. Open File->new->blank m_file.

    3. Create the size for pseudo random matrix as 1*tlen where tlen=10000

    4. Again create a size of matrix as 1*len (xtr) with zero as values.

    47

    EX NO: 2a

    DATE: 01.10.10SIMULATION OF MODULATION AND CONVOLUTIONAL CODE

    IN A AWGN COMMUNICATION CHANNELS USING MATLAB

  • 8/6/2019 Final Copy (Record)

    48/187

    5. After assign the values, to check the condition i.e., xtr (i)>0.

    6. Compare x and xtr matrix and calculate the bit error rate.

    7. Using this representation i.e., [num, ratio] =biterr(x, xrr) to convert the normal

    Polynomial representation to trellis form.

    8. Encode the binary xxt to trellis as xxt=encode (xxm, n, k,'Hamming').

    9. Create a zero matrix, add AWGN to it and compare, then form xxr matrix.

    10.Decode, using the viterbi algorithm i.e. xxdec=decode (xxr, n, k,'Hamming').

    11. Draw the graph between signals to noise ratio bit error rate.

    12. Finally encode and decode is done using the hamming code concept.

    13. Repeating the above steps and record the values, a graph is drawn for the values that

    is represented between SNR and BER.

    PROGRAM:

    % Convolution Code

    Clear all;

    clc;

    tlen=10000;

    x=round(rand(1,tlen));

    xt=2*x-1;

    snrr=-4:2:12;

    berr=zeros(1,length(snrr));

    for snri=1:length(snrr)

    xtr=awgn(xt,snrr(snri),'measured',123);

    xrr=zeros(1,length(xtr));

    for i=1:length(xtr)

    if(xtr(i)>0)

    xrr(i)=1;

    end

    48

  • 8/6/2019 Final Copy (Record)

    49/187

    end

    [num,ratio]=biterr(x,xrr);

    berr(snri)=ratio;

    end

    t=poly2trellis(3,[4 5 7]);

    n=4;k=2;

    xx=x;

    cc=convenc(xx,t);

    cc=2*cc-1;

    tb=100;

    snrr=-4:2:12;

    berrh=zeros(1,length(snrr));

    THEORY:

    Convolutional codes are fundamental different from block codes in that information

    sequence are not grouped into different distinct blocks and encoded. This mapping is highly

    structural enabling a decoding method considerably different form that of block codes to be

    employed. An l bit message sequence produces a coded output sequence of length n (l + m) bits.

    49

  • 8/6/2019 Final Copy (Record)

    50/187

    for snri=1:length(snrr)

    xxtn=awgn(cc,snrr(snri),'measured',123);

    xxrr=zeros(1,length(xxtn));

    for i=1:length(xxtn)

    if(xxtn(i)>0)

    xxrr(i)=1;

    end

    end

    yy=vitdec(xxrr,t,tb,'trunc','hard');

    [num,ratio]=biterr(xx,yy);

    berrh(snri)=ratio;

    end

    figure(1);

    semilogy(snrr,berr,'-k',snrr,berrh,'*-k');

    50

  • 8/6/2019 Final Copy (Record)

    51/187

    axis([-4 12 0.0001 1])

    xlabel('SNR in db');

    ylabel('BER');

    title('Performance of convolution codes');

    OUTPUT:

    51

  • 8/6/2019 Final Copy (Record)

    52/187

  • 8/6/2019 Final Copy (Record)

    53/187

  • 8/6/2019 Final Copy (Record)

    54/187

    AIM:

    To write a program for simulating the hamming code in an AWGN communication

    channel using MATLAB simulation package.

    APPARATUS REQUIRED:

    1. MATLAB package.

    2. Personal Computer.

    ALGORITHM:

    1. Select start menu and choose the option MATLAB-> MATLAB R2009a.

    2. Open File->new->blank m_file.

    3. Create the size for pseudo random matrix as 1*tlen where tlen=10000

    4. Again create a size of matrix as 1*len (xtr) with zero as values.5. After assign the values, to check the condition i.e, xtr (i)>0.

    6. Compare x and xtr matrix and calculate the bit error rate.

    7. Using this representation i.e, [num, ratio] =biterr(x, xrr) to convert the normal

    Polynomial representation to trellis form.

    8. Encode the binary xxt to trellis as xxt=encode (xxm, n, k,'Hamming').

    9. Create a zero matrix, add AWGN to it and compare, then form xxr matrix.

    10.Decode, using the viterbi algorithm i.e xxdec=decode (xxr, n, k,'Hamming').

    11. Draw the graph between signals to noise ratio bit error rate.

    12. Finally encode and decode is done using the hamming code concept.

    13.Repeating the above steps and record the values, a graph is drawn for the values that

    is represented between SNR and BER.

    54

    EX NO: 2b

    DATE: 01.10.10SIMULATION OF MODULATION AND HAMMING CODE

    IN A AWGN COMMUNICATION CHANNELS USING MATLAB

  • 8/6/2019 Final Copy (Record)

    55/187

    PROGRAM:

    clear all;clc;tlen=1000;x=round(rand(1,tlen));xt=2*x-1;snrr=-4:2:12;ber=zeros(1,length(snrr));for snri=1:length(snrr)

    xtr=awgn(xt,snrr(snri),'measured',123);xrr=zeros(1,length(xtr));for i=1:length(xtr)

    if(xtr(i)>0)

    xrr(i)=1;end

    end[num,ratio]=biterr(x,xrr);berr(snri)=ratio;

    end

    % Hamming Coden=7;k=4;m=n-k;r=rem(tlen,k);xx=x;if r

    xx=[xzeros(k-r)];endp=length(xx)/k;genpoly=cyclpoly(n,k,'max');xxm=reshape(xx,k,p)';xxt=encode(xxm,n,k,'hamming')';xxtx=reshape(xxt,1,p*n);xxtr=2*xxtx-1;snrr=-4:2:12;berrh=zeros(1,length(snrr));for snri=1:length(snrr)

    xxtn=awgn(xxtr,snrr(snri),'measured',123);xxrr=zeros(1,length(xxtn));

    for i=1:length(xxtn)if(xxtn(i)>0)

    xxrr(i)=1;end

    55

  • 8/6/2019 Final Copy (Record)

    56/187

  • 8/6/2019 Final Copy (Record)

    57/187

    berh(snri)=ratio;endfigure(1);semilogy(snrr,berr,'-k',snrr,berrh,'*-k');axis([-4 12 0.0001 1])title('PERFORMANCE OF HAMMING CODE')xlabel('snr in db');ylabel('BER');

    57

  • 8/6/2019 Final Copy (Record)

    58/187

    OUTPUT:

    58

  • 8/6/2019 Final Copy (Record)

    59/187

    RESULT:

    Thus the MATLAB program for simulating the hamming code in an AWGN

    communication channel was successfully executed and the output was verified.

    59

  • 8/6/2019 Final Copy (Record)

    60/187

  • 8/6/2019 Final Copy (Record)

    61/187

    6. Then create an array of length 1 to xtr variable.

    7. Dividing tlen by k to obtain remainder.

    8. Calculate xx, where xx=[x zeros (k-r)].

    9. Create a polynomial for cyclic code based on length n and message length k.

    10. Calculate and encode k*p matrix using hamming code method.

    11. A graph is plotted between SNR and BER.

    12. Finally a matrix is generated with random integers, and the scatter plot is generated

    with x decimation factor N.

    PROGRAM:

    clear all;clc;tlen=10000;x=round(rand(1,tlen));xt=2*x-1;snrr=-4:2:12;berr=zeros(1,length(snrr));for snri=1:length(snrr)

    xtr=awgn(xt,snrr(snri),'measured',123);xrr=zeros(1,length(xtr));for i=1:length(xtr)

    if(xtr(i)>0)xrr(i)=1;

    endend[num,ratio]=biterr(x,xrr);berr(snri)=ratio;

    end%hamming coden=7;k=4;m=n-k;r=rem(tlen,k);

    xx=x;if r

    xx=[x zeros(k-r)];endp=length(xx)/k;genpoly=cyclpoly(n,k,'max');

    61

  • 8/6/2019 Final Copy (Record)

    62/187

    xxm=reshape(xx,k,p)';xxt=encode(xxm,n,k,'cyclic',genpoly)';xxtx=reshape(xxt,1,p*n);xxtr=2*xxtx-1;snrr=-4:2:12;berrh=zeros(1,length(snrr));for snri=1:length(snrr)

    xxtn=awgn(xxtr,snrr(snri),'measured',123);xxrr=zeros(1,length(xxtn));for i=1:length(xxtn)

    if(xxtn(i)>0)xxrr(i)=1;

    endendxxr=reshape(xxrr,n,p)';xxdec=decode(xxr,n,k,'cyclic',genpoly)';yy=reshape(xxdec,1,k*p);[num,ratio]=biterr(xx,yy);

    berrh(snri)=ratio;THEORY:

    Convolutional codes are fundamental different from block codes in that information

    sequence are not grouped into different distinct blocks and encoded. This mapping is highly

    structural enabling a decoding method considerably different form that of block codes to be

    employed. An l bit message sequence produces a coded output sequence of length n (l + m) bits.

    Hamming code form a sub class of linear block codes. Consider a (n, k) block code in

    which the first position of K bits is always identical to the message sequence to be transmitted.

    Accordingly these (m, k) bits are rejected to be generalized parity bits. Block codes in which the

    message bits are transmitted in an unaltered form are called systematic codes. The syndrome lies

    in the fact that it depends only upon the error pattern.

    Block length N=2m-1

    Number of parity check symbols m= Nc - K = r

    Number of information symbols Kc=2m (n+1)

    Error correcting capability t = 1

    Minimum distance Dmin = 3

    62

  • 8/6/2019 Final Copy (Record)

    63/187

    endfigure(1);semilogy(snrr,berr,'-k',snrr,berrh,'*-k');axis([-4 12 0.0001 1]);xlabel('snr in db');ylabel('bit error rate');title('PERFORMANCE OF CYCLIC CODE');m=4;msg=randi(1500,1,m);modmsg=pskmod(msg,m);trainlen=1000;chan=[0.986;0.845;0237;0.123+31i];filtmsg=filter(chan,1,modmsg);eql=lineareq(8,adaptive.lms(0,01));eql.sigconst=pskmod([0:m-1],m);[symbolest,yd]=equlize(eql,filtmsg,modmsg(1:trainlen));h=scatterplot(filtmsg,1,trainlen,'bx');hold on;scatterplot(symbolest,1,trainlen,'g.',h);scatterplot(eql.sigconst,1,0,'k*',h);legend('filtered singal','equalized singal','ideal singal constellation');hold off;demodmsg_noeq=pskdemod(filtmsg,m);

    demodmsg=pskdemod(yd,m);[nnoeq,rnoeq]=symerr(demodmsg_noeq(trainlen+1:end),....

    msg(trainlen+1:end));[neq,req]=symerr(demodmsg(trainlen_1:end),msg(trainlen_1:end));disp('symbol error rates with & without equalizer:');disp([req rnoeq]);

    63

  • 8/6/2019 Final Copy (Record)

    64/187

    OUTPUT:

    64

  • 8/6/2019 Final Copy (Record)

    65/187

    RESULT:

    Thus the MATLAB program for implementing adaptive filter was successfully executed

    and the output was verified.

    65

  • 8/6/2019 Final Copy (Record)

    66/187

    66

  • 8/6/2019 Final Copy (Record)

    67/187

    AIM:

    To write a MATLAB program to implement the concept of various spectrum methods

    such as Periodogram, modified Periodogram, Bartlett and Welch method.

    APPARATUS REQUIRED:

    1. MATLAB package.

    2. Personal Computer.

    ALGORITHM:

    1. Click the start menu-> MATLAB->MATLAB R2009a.

    2. Select File->new->blank m_file.

    3. Assigning the values for fs, t, a,f.

    4. Evaluate the value of x i.e x=a* sin(2*pi*f*t)+0.1*randn(size(t)).

    5. The spectrum estimator hs is returned in specific type with different window names .

    6. A power spectral density is defined with basic parameters such as hs, x, fs, NFFT.

    7. The above steps can be followed for different windows for the particular spectrum

    with axis. i.e sp=spectrum. Methodname(window name).

    where sp=spectrum estimator

    i. Methodname can be Periodogram, Welch, and Bartlett.

    ii.Window name may be rectangular, hanning,hamming with or without

    axis.1. After executing, the various types of figures are obtained.

    67

    EX:NO:3.b

    DATE: 15.10.10IMPLEMENTATION OF PERIODOGRAM USING MATLAB

  • 8/6/2019 Final Copy (Record)

    68/187

    PROGRAM:

    clear all;clc;randn('state',0);fs=3000;t=(0:fs)/fs;a=[1 5];f=[300;30];x=a*sin(2*pi*f*t)+0.1*randn(size(t));figure(1);hs=spectrum.periodogram('rectangular');psd(hs,x,'fs',fs,'nfft',1024);title('power spectral estimation via Periodogram');%modified periodogram for hanning windowclc;randn('state',0);fs=3000;t=(0:fs)/fs;a=[1 5];f=[300;30];x=a*sin(2*pi*f*t)+0.1*randn(size(t));figure(2);

    hs=spectrum.periodogram('hann');psd(hs,x,'fs',fs,'nfft',1024);title('power spectral estimation via periodogram(hanning)');%modified periodogram for hamming windowclc;randn('state',0);fs=3000;t=(0:fs)/fs;a=[1 5];f=[300;30];x=a*sin(2*pi*f*t)+0.1*randn(size(t));figure(3);hs=spectrum.periodogram('hamming');psd(hs,x,'fs',fs,'nfft',1024);title('power spectral estimation via periodogram(hamming)');%welch method using the hamming windowclc;

    68

  • 8/6/2019 Final Copy (Record)

    69/187

    randn('state',1);fs=3000;t=(0:0.3*fs)/fs;a=[8 8];f=[300;250];x=a*sin(2*pi*f*t)+5*randn(size(t));figure(4);hs=spectrum.welch('hamming',150,50);THEORY:

    [Pxx, w] =Periodogram (x) returns the PSD estimate Pxx of the sequence x using a

    Periodogram. The PSD is calculated using in units of power per radians per samples. The

    corresponding vector of frequencies is computed in radian per sample and has sample length on

    Pxx.

    A real valued input vector x produces a full power one sided PSD while a complex

    valued produces a two sided PSD. In general the length N of the FFT and the values of input x

    determine the length of Pxx and the range of the corresponding normalized frequencies.

    [Pxx, f]= Periodogram (x, window, nfft, fs)

    The frequency range for f depends on nfft, fs and the values of the input x. the length of

    Pxx is the input x.

    PSD and frequency vector characteristics:

    The power spectral density of WSS random process is FT of auto correlation sequence is

    a non parametric method to estimate PSD

    p(ejw)=k=0nrke-jwkThe discrete time Fourier transform of r(k) leads to an estimate of PSD is known as

    Periodogram.

    Modified Periodogram

    The Periodogram of a process that is windowed with a general window w (n) is called as

    a modified Periodogram N tends to length of window.

    Bartletts method (Periodogram averaging)

    Here x (n) is partitioned into overlapping sequence of length l where n =KL

    Welch method

    Averaging modified Periodogram, two modified modification from barlett window method.

    1. To allow the data sequence x (n) to overlap.

    2. To allow the data window w (n) to be applied to each sequence.

    69

  • 8/6/2019 Final Copy (Record)

    70/187

    3. Thus the amount of overlap between x(n) and xl + l (n) is C to D points n sequence cover

    the entire data

    Points N = (L + D (K-N))

    psd(hs,x,'fs',fs,'nfft',1024)title('power spectral estimation via welch method for hamming window');t=[0:0.3*fs]/fs;a=[8 8];f=[300;250];x=a*sin(2*pi*f*t)+5*randn(size(t));figure(5);hs=spectrum.welch('hann',150,50);psd(hs,x,'fs',fs,'nfft',1024)title('power spectral estimation via welch method for hanning window');%berlett's method using the hamming windowclc;

    randn('state',1);fs=3000;t=(0:0.3*fs)/fs;a=[8 8];f=[300;350];x=a*sin(2*pi*f*t)+5*randn(size(t));figure(6);hs=spectrum.welch('hamming',150,50);psd(hs,x,'fs',fs,'nfft',1024)title('power spectral estimation via welch method for bertlett window');

    70

  • 8/6/2019 Final Copy (Record)

    71/187

    OUTPUT:

    71

  • 8/6/2019 Final Copy (Record)

    72/187

    72

  • 8/6/2019 Final Copy (Record)

    73/187

    73

  • 8/6/2019 Final Copy (Record)

    74/187

    74

  • 8/6/2019 Final Copy (Record)

    75/187

    75

  • 8/6/2019 Final Copy (Record)

    76/187

    76

  • 8/6/2019 Final Copy (Record)

    77/187

    77

  • 8/6/2019 Final Copy (Record)

    78/187

    78

  • 8/6/2019 Final Copy (Record)

    79/187

    79

  • 8/6/2019 Final Copy (Record)

    80/187

    RESULT:

    Thus the MATLAB program to implement the concept of various spectrum

    methods such as periodogram, modified periodogram, Bartlett and Welch method was estimated

    and verified.

    80

  • 8/6/2019 Final Copy (Record)

    81/187

    AIM:

    To write a MATLAB program to simulate the concept of down sampling and up

    sampling.

    APPARATUS REQUIRED :

    1. MATLAB package.

    81

    EX:NO:3c

    DATE: 22.10.10

    IMPLEMENTATION OF MULTISTATE MULTIRATE FILTER USINGMATLAB

  • 8/6/2019 Final Copy (Record)

    82/187

    2. Personal Computer.

    ALGORITHM:

    1. Click the start menu-> MATLAB->MATLAB R2009a.

    2. Select File->new->blank m_file.

    3. Draw a sine signal with theta as 60 degree and combine with time signal assign it to x.

    4. In figure (1), declare Subplot (2, 1, 2), plots outgo on the bottom half of the window.

    5. Stem(x(1:150))- this function is used to plot the data sequence Y as stems from the x

    axis with circles for the data value.

    6. In figure (2), declare Subplot (2, 1, 1), plots income on the top half of the window.

    5. Stem(y(1:120))- this function is used to plot the data sequence Y as stems from the x

    axis with circles for the data value.

    PROGRAM:

    t=0:0.001:1;

    x=sin(2*pi*30*t)+sin(2*pi*60*t);

    figure(1);

    y=decimate(x,5);

    subplot(2,1,1);

    stem(x(1:50));%axis([0 120 -2 2]);

    title('sine signal');

    82

  • 8/6/2019 Final Copy (Record)

    83/187

  • 8/6/2019 Final Copy (Record)

    84/187

    Xu (n) = x (n/L) n=0, L, 2L

    1 otherwise

    L is the integer factor by which sampling rate is increased.

    Decimation

    The process of decreasing sampling rate by an integer factor M is called down sampling,

    the process is known as decimation.

    Y (n) = M x (n) =x (M n)

    84

  • 8/6/2019 Final Copy (Record)

    85/187

    OUTPUT:

    85

  • 8/6/2019 Final Copy (Record)

    86/187

    86

  • 8/6/2019 Final Copy (Record)

    87/187

    87

  • 8/6/2019 Final Copy (Record)

    88/187

    RESULT:

    Thus the MATLAB program to simulate the concept of multistage multi rate filter using

    down sampling and up sampling was successfully executed and the output was verified.

    88

  • 8/6/2019 Final Copy (Record)

    89/187

    89

    EX:NO:4

    DATE: 25.10.10SIMULATION OF QMF USING SIMULATION PACKAGES USING

    MATLAB

  • 8/6/2019 Final Copy (Record)

    90/187

    AIM:

    To simulate the frequency response of Quadrature mirror filter in MATLAB.

    APPARATUS REQUIRED:

    1. MATLAB Package.

    2. Personal Computer.

    ALGORITHM:

    1. Click the start menu-> MATLAB->MATLAB R2009a.

    2. Select File->new->blank m_file.

    3. In generation of low pass filter, first assign b1 value i.e. b1=fir1(100,0.5).

    4. Next to generate High pass filter frequency response; its based on length and k value

    i.e. b2(k)=((-1)^k)+b1(k).

    5. Compute gain and response of LPF and HPF.

    6. [H1,w]=freqz(b1,1,1024) and [H2,w]=freqz(b2,1,1024) these functions are used to

    find the linear response of the two filters.

    7. Finally, plot the gain and response of two filters using QMF filters.

    PROGRAM:

    clc;clear all;

    90

  • 8/6/2019 Final Copy (Record)

    91/187

    %Generation of LPFb1=fir1(50,.5);%Generation of HPFl=length(b1);for k=3:l;

    b2(k)=((-1)^k)*b1(k);end;%Computation of Gain & Response of @ Filters[H1,w]=freqz(b1,1,1024);g1=20*log10(abs(H1));[H2,w]=freqz(b2,1,1024);g2=20*log10(abs(H2));%Plot of Gain Response of 2 Filtersplot((w*100)/pi,g1,'-',(w*100)/pi,g2,'--');grid;title('QMF');xlabel('Normalized Frequency');ylabel('Gain in db');

    THEORY:

    91

  • 8/6/2019 Final Copy (Record)

    92/187

    Quadrature Mirror Filter is special class of half band filter and they are used in sub band

    coding. In sub band coding Quadrature Mirror Filter are to separate the frequency spectrum in

    the low band and high band. The signal is decimated to obtain minimum sample rate operation.

    At the receiver interpolation can be used to restore original number of samples. Quadrature

    Mirror Filters bands consist of two sections:-

    1. Analysis section

    2. Synthesis section

    QMF employs two decimators in the signal analysis and two interpolations in the signal

    synthesis section. The low pass and high pass filters in the analysis section have impulse

    response h0 (m) and h1 (m) respectively. Similarity LP and HP filters constrained to the

    synthesis section have impulse response g0 (m) and g1 (m) respectively.

    To reduce the aliasing the synthesis section have impulse response g0 (m) and g1(m)

    G0 (w) = G1 (w)

    G0 (w) = -G1 (w-n)

    Since H0 (w) and H1 (w) are mirror image filters

    G0 (w) = G1 (w)

    G0 (w) = -G1 (w-n)

    Due to above design effect cancels out. The transfer function of QMF is such that they are

    power completely.

    92

  • 8/6/2019 Final Copy (Record)

    93/187

    93

  • 8/6/2019 Final Copy (Record)

    94/187

    OUTPUT:

    RESULT:

    Thus the simulation of frequency response of the Quadrature Mirror Filter using

    MATLAB was successfully executed and output was verified.

    94

  • 8/6/2019 Final Copy (Record)

    95/187

    95

  • 8/6/2019 Final Copy (Record)

    96/187

  • 8/6/2019 Final Copy (Record)

    97/187

    PROGRAM:

    clear all;

    clc;

    tlen=2000;

    x=round(rand(1,tlen));

    xt=2*x-1;

    snrr=-4:2:12;

    berr=zeros(1,length(snrr));

    for snri=1:length(snrr)

    xtr=awgn(xt,snrr(snri),'measured',123);

    xrr=zeros(1,length(xtr));

    for i=1:length(xtr)

    if(xtr(i)>0)

    xrr(i)=1;

    end

    end

    [num,ratio]=biterr(x,xrr);

    berr(snri)=ratio;

    endn=7;k=4;m=n-k;

    r=rem(tlen,k);

    xx=x;

    97

  • 8/6/2019 Final Copy (Record)

    98/187

    if r

    xx=[x zeros(k-r)];

    end

    p=length(xx)/k;

    genpoly=cyclpoly(n,k,'max');

    xxm=reshape(xx,k,p)';

    THEORY

    Current digital networks are constantly pushing the envelope when it comes to

    performance and reliability. Todays engineers must employ cunning techniques to maintain

    these metrics today and surpass those of tomorrow. One such technique that is commonly used

    is block coding. Block coding refers to the type of signal transformations designed to improve

    performance over a digital communications link by enabling the transmitted signals to better

    withstand various channel impairments. Such impairments include (but not limited to) noise,

    fading, dispersion, and jamming. One reason this technique has become so popular is that it is

    implemented quite efficiently through the use of very large scale integrated (VLSI) circuits.

    Such components can be utilized to affect an 8db improvement over non coded transmissions

    without an increase in the necessary power to transmit the signal.

    Linear block codes:

    Linear block codes represent the method of inserting redundancy (overhead) into the

    original message vector so that the presence of errors can be detected and ultimately corrected.

    This redundant encoding technique is also known as parity-check codes. This technique allows

    an improvement in Pb(Probability of bit error) performance but at the expense of bandwidth also

    known as bandwidth expansion.

    With linear block codes, the source data is segmented into blocks of k data bits called

    message bits. Each segmented block can represent any one of 2k distinct messages. The encoder

    transforms each k bit data block into a larger block of n bits. The n-k bits, which are added to

    each data block by the encoder, are known as the redundant bits, parity bits, or overhead (they

    carry no pertinent information). The code is typically referred to as a (n,k) code. The ratio of

    98

  • 8/6/2019 Final Copy (Record)

    99/187

    redundant(overhead) bits of data (information) bits (n-k)/k, within a block is called the

    redundancy of the code, and the ratio of data bits to total bits(overhead and information),k/n, is

    called the code rate. Essentially the code rate can be regarded as the portion of the code that

    constitutes information.

    Parity-check codes use linear sums of te information bits (k-bits), called parity symbols

    or parity bits for error detection or correction. A single parity check code constructed by adding

    a single parity bit to a block of data bits. The parity bit takes on the value of one or zero

    depending on whether the modulo-2 summation of the information bits yields an even or odd

    result.

    xxt=encode(xxm,n,k,'cyclic',genpoly)';

    xxtx=reshape(xxt,1,p*n);

    xxtr=2*xxtx-1;

    snrr=-4:2:12;

    berrh=zeros(1,length(snrr));

    for snri=1:length(snrr)

    xxtn=awgn(xxtr,snrr(snri),'measured',123);

    xxrr=zeros(1,length(xxtn));

    for i=1:length(xxtn)

    if(xxtn(i)>0)

    xxrr(i)=1;

    end

    end

    xxr=reshape(xxrr,n,p)';

    xxdec=decode(xxr,n,k,'cyclic',genpoly)';

    yy=reshape(xxdec,1,k*p);

    [num,ratio]=biterr(xx,yy);

    berrh(snri)=ratio;

    99

  • 8/6/2019 Final Copy (Record)

    100/187

  • 8/6/2019 Final Copy (Record)

    101/187

    The polynomial function U(X) can be thought of as a Placeholder for the digits of the

    code vectorU. The presence or absence of each term in the polynomial indicates the presence of

    a 1 or0 in the corresponding location.

    Cyclic code implementation requires the implementation of polynomial division. This

    operation can be achieved with a dividing circuit comprised of feedback shift registers. Cyclic

    codes involve shifting the polynomial bit by bit to include all the parity check bits necessary for

    the predetermined code. The parity bits (parity polynomial) are calculated and then placed in the

    appropriate location alongside the message polynomial. The parity polynomial is the remainder

    after dividing by the generator polynomial. It appears in the register after n shifts through the (n-

    k) stage feedback register.

    Since the first n-k shifts through the register are merely filling the register, there cannot

    be any feedback until the rightmost stage has been filled. Loading the input data to the output ofthe last stage can shorten the shifting cycle.

    trainlen=500;

    chan=[0.986;0.845;0237;0.123+31i];

    filtmsg=filter(chan,1,modmsg);

    eql=lineareq(8,adaptive.lms(0,01));

    eql.sigconst=pskmod([0:m-1],m);

    [symbolest,yd]=equlize(eql,filtmsg,modmsg(1:trainlen));

    h=scatterplot(filtmsg,1,trainlen,'bx');hold on;

    scatterplot(symbolest,1,trainlen,'g.',h);

    scatterplot(eql.sigconst,1,0,'k*',h);

    legend('filtered singal','equalized singal','ideal singal constellation');

    hold off;

    demodmsg_noeq=pskdemod(filtmsg,m);

    demodmsg=pskdemod(yd,m);

    [nnoeq,rnoeq]=symerr(demodmsg_noeq(trainlen+1:end),....

    101

  • 8/6/2019 Final Copy (Record)

    102/187

    msg(trainlen+1:end));

    [neq,req]=symerr(demodmsg(trainlen_1:end),msg(trainlen_1:end));

    disp('symbol error rates with & without equalizer:');

    disp([req rnoeq]);

    The circuit feedback connections correspond to the coefficients of the generator

    polynomial G(x) which can be expressed by:

    G(x) = 1+g1x+g2X2+.+gn-k-1X

    n-k-1+Xn-k

    The encoder for linear consists of three basic steps:

    1. Calculating the syndrome of the received vector.

    2. Identify the correctable error pattern that corresponds to syndrome calculated in step1.

    The correspondence between the syndrome and a correctable error pattern is one-one.

    This is the error pattern that presumably has occurred.

    3. Correct the errors by taking the modulo-2 sum of the received vector and the error

    pattern found in step2.

    A general decoder for an (n, k) cyclic code is shown in figure. It consists of three major parts.

    102

  • 8/6/2019 Final Copy (Record)

    103/187

  • 8/6/2019 Final Copy (Record)

    104/187

    OUTPUT:

    104

  • 8/6/2019 Final Copy (Record)

    105/187

    RESULT:

    Thus the MATLAB program for implementing the coding techniques of linear and cyclic

    codes was successfully executed and the output was verified.

    105

  • 8/6/2019 Final Copy (Record)

    106/187

    106

  • 8/6/2019 Final Copy (Record)

    107/187

    AIM:

    To study the image processing techniques using MATLAB.

    APPARATUS REQUIRED :

    1. MATLAB Package.

    2. Personal Computer.

    107

    EX:NO:6

    DATE: 27.10.10IMAGE PROCESSING TECHNIQUES USING MATLAB

  • 8/6/2019 Final Copy (Record)

    108/187

    PROGRAM:

    clc;clf;%to read an imageI=imread('cameraman.tif');subplot(3,3,1);imshow(I);title('original image');k=imadjust(I,[0.2,.7],[]);subplot(3,3,2);

    imhist(k);title('H A I');g=imrotate(I,180);subplot(3,3,3);imshow(g);title('R I');s=imresize(I,[96 96]);subplot(3,3,4);imshow(s);title('RO I');f=imcrop(I,[75 68 700 100]);

    subplot(3,3,5);imshow(f);title('C I');y=imsubtract(I,j);subplot(3,3,6);imshow(y);title('S I');j=imread('rice.png');x=imadd(I,j);subplot(3,3,7);imshow(x);title('F I');c=imcomplement(I);subplot(3,3,8);imshow(c);title('C I');subplot(3,3,9);

    108

  • 8/6/2019 Final Copy (Record)

    109/187

    imhist(c);title('H I');

    THEORY:

    Histogram is the technique or method to determine the pixel information from the image

    using this technique. We have to rotate, add, subtract, and control the contrast of the image so

    the processing of image is very easier. But for this, we have to know about the signal statist ion

    like number pixels (usually 256 *256) type of image etc...

    Basic image type are .tif, .pig etc..,

    1. imread () : for reading the image argument is type of image.

    2. Imshow () : for displaying the image.

    3. imadust () : for adjusting the pixel values usually is (n, m ) rows and columns.

    4. inhist () : For produce the power spectral density values for each pixel values.

    5. imrotate() : for rotating the image, argument is angle by we need to rotate.

    6. imcrop () : used for cropping the image.

    7. imadd () : for adding histogram of two images.

    8. imsubtract () : for subtracting the images.

    9. incomplement () : for complementing the image.

    109

  • 8/6/2019 Final Copy (Record)

    110/187

    110

  • 8/6/2019 Final Copy (Record)

    111/187

  • 8/6/2019 Final Copy (Record)

    112/187

    RESULT:

    Thus the MATLAB program for image processing technique was successfully executed

    and the output was verified.

    112

  • 8/6/2019 Final Copy (Record)

    113/187

  • 8/6/2019 Final Copy (Record)

    114/187

    3. After executing the above step the terminal was entered into ns_allinone-2.34 i.e

    [root@localhost ns_allinone-2.34].

    4. Install ns2 using the command [root@localhost ns_allinone-2.34]# ./install(it will

    take few minutes )

    /*PATH SETTING*/

    5. After installation, will get three paths(PATH, LD-LIBIRARY-PATH, PATH-

    ENVIRONMENT).

    6. Open a new terminal in ns allione-2.34 and give command as [root@localhost

    ns_allinone-2.34] #gedit .barhrc. The execution of above command will show the

    terminal named as barhrc i.e #.barhrc.

    7. In barhrc file, copy and paste all the three paths from installed command prompt and

    save the file.

    8. Again open a new terminal->[root@localhost]# ns. Press enter to get % symbol forproper installation.

    PROGRAM:

    GRAPH1:

    TitleText: bar chart

    BarGraph: True

    BarBase: .05BarWidth: .5

    NoLines: True

    XUnitText: Marks

    YUnitText: Credit

    "AM"

    50 1.5

    52 2.5

    54 3.5

    "ADSP"

    56 1.9

    58 2.5

    60 3.5

    "WCN"

    62 2.5

    64 3.0

    114

  • 8/6/2019 Final Copy (Record)

    115/187

    66 3.5

    GRAPH2:

    TitleText: bar chart

    BarGraph: True

    BarBase: .05

    BarWidth: .5

    NoLines: True

    XUnitText: Marks

    YUnitText: Credit

    "MPC"

    51 1.5

    53 2.5

    55.5 3.5

    "MDCT"

    57 1.9

    59.5 2.5

    61.5 3.5

    "DCN"

    63.5 2.5

    65.5 3.0

    67.6 3.5

    /*GRAPH COMPARISION*/

    9. Open root-> ns_allinone-2.34-> Xgraph 12.1 and right click inside it to create a new

    empty document (Open document -> create empty folder) and name it as graph1.

    10.Write the graph codings inside the graph1 document and proceed the same steps for

    graph2.

    11. Compare the two graphs using the command [root@localhost ns_allinone-2.34

    Xgraph12.1]# Xgraph graph1 graph2

    12.Finally the output was displayed as comparison of two graphs.

    115

  • 8/6/2019 Final Copy (Record)

    116/187

    116

  • 8/6/2019 Final Copy (Record)

    117/187

    OUTPUT:

    117

  • 8/6/2019 Final Copy (Record)

    118/187

    RESULT:

    Thus the comparison of two graphs using NS2 package was successfully executed and

    the output was verified.

    118

  • 8/6/2019 Final Copy (Record)

    119/187

    119

  • 8/6/2019 Final Copy (Record)

    120/187

    AIM:

    To create a new protocol using NS2 (network simulator) package.

    APPARATUS REQUIRED:

    1. NS2 (Network Simulator) package.

    2. Personal Computer.

    ALGORITHM:

    1. To install ns2, First open the network home package and extract ns_allinone-2.34

    from it.

    2. Select application-> Accessories->open terminal, the terminal was created with

    extension as [root@localhost]# cd ns_allinone-2.34

    3. After executing the above step the terminal was entered into ns_allinone-2.34 i.e

    [root@localhost ns_allinone-2.34].

    4. Install ns2 using the command [root@localhost ns_allinone-2.34]# ./install(it will takefew minutes )

    /*PATH SETTING*/

    5. After installation, will get three paths (PATH, LD-LIBIRARY-PATH, PATH-

    ENVIRONMENT).

    6. Open a new terminal in ns allione-2.34 and give command as [root@localhost

    ns_allinone-2.34] #gedit .barhrc. The execution of above command will show the

    terminal named as barhrc i.e #.barhrc.7. In barhrc file, copy and paste all the three paths from installed command prompt and

    save the file. Again open new terminal->[root@localhost]# ns. Press enter to get %

    symbol for proper installation.

    120

    EX:NO:7b

    DATE: 15.11.10

    CREATION OF NEW PROTOCOL

    IN NETWORK SIMULATOR PACKAGE

  • 8/6/2019 Final Copy (Record)

    121/187

    121

  • 8/6/2019 Final Copy (Record)

    122/187

    /*PROTOCOL CREATION */

    8. Extract workshop file from root and open wfrp protocol from extracted file; copy all

    the files except input file.

    9. Create a new folder in ns2.34 with name wfrp. Paste all the copied files here.

    10. Open ns2.34->common->packet.h and add your new protocol (wfrp) here

    static const packet_t PT_WFRP=62 ;

    name_[PT_WFRP]=WFRP;

    11. Open ns2.34 ->trace -> cmu.trace.cc and add the header file as

    #include then addcase PT_WFRP:

    to the CMUTrace::format sctp()

    12. Open ns2.34 ->queue->prequeue.cc add the command

    prequeue : : recv()

    { case PT_WFRP }

    13.Open ns2.34 ->tcl->lib->ns_lib.tcl, add this below function in it.

    WFRP

    { set ragent [$self create_wfrp_agent $node]}

    copy and paste the function of aodv and change the name of aodv as wfrp ,save it

    14.Open ns2.34 ->tcl->lib->ns_packet.tcl ->add new protocol WFRP under AOMDV

    protocol and save it.

    15. Open ns2.34->makefile.in and add wfrp/wfrp.o \

    16. Open new terminal in ns2.34

    [root@localhost ns2.34]# ./configure

    [root@localhost ns2.34]# make clean

    [root@localhost ns2.34]# make

    122

  • 8/6/2019 Final Copy (Record)

    123/187

    17.Finally ,Object file was created in wfrp folder in ns2.34

    123

  • 8/6/2019 Final Copy (Record)

    124/187

    OUTPUT:

    RESULT:

    124

  • 8/6/2019 Final Copy (Record)

    125/187

  • 8/6/2019 Final Copy (Record)

    126/187

    AIM:

    To create a network topology using NS2 (network simulator) package.

    APPARATUS REQUIRED:

    1. NS2 (Network Simulator) package.

    2. Personal package.

    ALGORITHM:

    1. To install ns2, First open the network home package and extract ns_allinone-2.34

    from it.

    2. Select application-> Accessories->open terminal, the terminal was created with

    extension as [root@localhost]# cd ns_allinone-2.34

    3. After executing the above step the terminal was entered into ns_allinone-2.34 i.e

    [root@localhost ns_allinone-2.34].

    4. Install ns2 using the command [root@localhost ns_allinone-2.34]# ./install(it will take

    few minutes )

    /*PATH SETTING*/

    126

    EX:NO:7c

    DATE: 22.11.10

    TOPOLOGY CREATION

    IN NETWORK SIMULATOR PACKAGE

  • 8/6/2019 Final Copy (Record)

    127/187

    5. After installation, will get three paths (PATH, LD-LIBIRARY-PATH, PATH-

    ENVIRONMENT).

    6. Open a new terminal in ns allione-2.34 and give command as [root@localhost

    ns_allinone-2.34] #gedit .barhrc. The execution of above command will show the

    terminal named as barhrc i.e #.barhrc.

    7. In barhrc file, copy and paste all the three paths from installed command prompt and

    save the file.

    8. Again open new terminal->[root@localhost]# ns. Press enter to get % symbol for proper

    installation.

    127

  • 8/6/2019 Final Copy (Record)

    128/187

    . /*TOPOLOGY CREATION*/

    9. Select AODV protocol and set nn size as 10.

    i. i.e, set val(nn) 10

    10. In this step, to create a node using the command as

    i. for {set i 0} {$i < $val(nn)} {incr i} {

    ii.set node_($i) [$ns node] }

    11. To increase the node size as,

    i. $ns initial_node_pos $n($i) 2012.Click ns2.34->indep->utils->cmu-scen-gen->setdest , using these commands we will

    create a node that is named as nodes10.

    13.Click ns2.34->indep->utils->cbrgen.tcl->setdest, using these commands we will create a

    node that is named as cbr4.

    14.After finishing the above steps, choose the protocol for source and destination (TCP,

    UDP, SINK), connect the source and destination by FTP link.

    15. Execute the program by using the command,

    i. [root@localhost ns2.34]#ns aodv.tcl.

    128

  • 8/6/2019 Final Copy (Record)

    129/187

    129

  • 8/6/2019 Final Copy (Record)

    130/187

    OUTPUT:

    130

  • 8/6/2019 Final Copy (Record)

    131/187

    131

  • 8/6/2019 Final Copy (Record)

    132/187

  • 8/6/2019 Final Copy (Record)

    133/187

    RESULT:

    Thus the creation of network topology using network simulator package was successfully

    executed and the output was verified.

    133

  • 8/6/2019 Final Copy (Record)

    134/187

    134

  • 8/6/2019 Final Copy (Record)

    135/187

    AIM:

    To implement and study the ALOHA protocol for packet communication between

    number of nodes connected to a common bus.

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package.

    2. LAN-T Trainer Kit.

    3. Connecting Wires.

    .

    THEORY:

    ALOHA is the random access methods used in mobile data networks it has two groups:

    1. Pure ALOHA:The original ALOHA protocol is sometimes called pure ALOHA. In this

    protocol a mobile terminal transmits an information packet when the packet arrives from

    the upper layers of the protocol stack. Each packet is encoded with an error detection

    code. The BS checks the parity checks properly, the BS sends a short acknowledgement

    packet to the MS.

    2. Slotted ALOHA: In slotted ALOHA protocol the transmission time is divided into time slots.

    The BS transmits a beacon signal for timing and all MS synchronize their time slots to this

    beacon signal. When a user terminal generates a packet of data, the packet is buffered and

    transmitted at the start of the next time slots.

    135

    EX.No : 8.a

    DATE : 24.11.10

    IMPLEMENTATION AND STUDY OF ETHERNET LAN PROTOCOLS - ALOHA

  • 8/6/2019 Final Copy (Record)

    136/187

  • 8/6/2019 Final Copy (Record)

    137/187

    PROCEDURE:

    1. Click on the MAC Environment icon twice from the desktop on both PCs.

    2. Click the configuration button in the window in both the PCs and select the protocol as

    ALOHA.

    3. Calculate the IPD(ta) as given below

    N* PG= ----------

    C*ta

    Where,

    G is the offered load to the network, whose value ranges from 0.1 to 4.

    N is the number of nodes participating in the network. For example, let us say

    that nodes (Using 2 computers).

    P is the packet length usually it takes the value 10. C is the data rate normally set as 8kbps, which is selected in the NEU.

    So, lets assume G=1 and substitute the above mentioned parameters in the Equation A

    which leads to ta as 40 milliseconds and substitute the same in the configuration view.

    4. Select the OK button and download the driver to the NIU using the BOOT button

    command. Booting from any one of the applications is enough.

    5. Run the experiment by clicking button or RUN- Start from each application.

    6. View the statistics window for results. Only Tx packets and collision count are taken into

    account for MAC Calculation.

    7. Save or note down the readings once the experiment is completed.

    8. Repeat the above steps from 1 to 6 for a range of 'G' values and calculating ta.

    137

  • 8/6/2019 Final Copy (Record)

    138/187

    9. Plot graph between Offered load and throughput.

    10. Compare graphs of different packet length, nodes and data rate.

    GRAPH:

    CALCULATION:-

    Calculation o f Throughput(X) From the Obtained Readings:

    Successfully transmitted packet by a node= Tx packets-Collision Count

    (Sum of successfully Tx packet in all nodes * Packet Length*8)

    138

  • 8/6/2019 Final Copy (Record)

    139/187

    X= -------------------------------------------------------------------------------------

    (Duration of Experiment * 8kbps)

    Find throughput as above from the readings taken by varying the ta.

    Calculation o f Theoretical Throughput:

    X= Ge-2G

    Substitute the G value, which was used to calculate inter packet delay Ta in the

    above mentioned equation and calculate the Theoretical X and compare the same with the

    practical X.

    Calculation o f Offered Load:

    (Sum of transmitted packets in all 4 nodes * packet length *8)

    G= -----------------------------------------------------------------------------------

    (Duration of Experiment * 8 kbps)

    RESULT:

    Thus the ALOHA protocol for packet communication between a number of nodes

    connected to a common bus was studied and implemented.

    139

  • 8/6/2019 Final Copy (Record)

    140/187

    140

    EX.No : 8.b

    DATE : 26.11.10

    IMPLEMENTATION AND STUDY OF ETHERNET LAN PROTOCOLS CSMA

  • 8/6/2019 Final Copy (Record)

    141/187

    AIM:

    To implement and study the CSMA protocol for packet communication between a

    numbers of nodes connected to a common bus.

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package.

    2. LAN-T Trainer Kit.

    3. Connecting Wires.

    THEORY:

    Protocol in which stations listen for a carrier and act accordingly are called sense Protocol.

    1. Persistent CSMA: When a station has data to send, it first listens to the channel to

    see if anyone else is transmitting at that moment. If the channel is busy, the station

    waits until it becomes is idle. When the station detects an idle channel it transmits a

    frame.

    2. Non-Persistent CSMA: Before transmission a station sense the channel, if no one

    else is sending the station begins transmission. If the channel is already in use thedoes not continually sense it, instead it waits a random period of time and then it

    repeats the algorithm.

    TABULATION:

    141

  • 8/6/2019 Final Copy (Record)

    142/187

    CSMA

    IPD

    Tx

    Node1

    Tx

    Node 2

    Tx

    Node 3

    Tx

    Node 4 G - Offered Load X - Throughput

    4000 5 10 29 45 0.116 0.089

    2000 49 50 49 49 0.197 0.197

    800 68 93 99 101 0.436 0.361

    400 56 124 134 144 0.725 0.458

    200 42 156 155 165 1.076 0.518

    100 32 103 126 116 1.388 0.377

    40 12 12 7 37 1.824 0.068

    142

  • 8/6/2019 Final Copy (Record)

    143/187

  • 8/6/2019 Final Copy (Record)

    144/187

    GRAPH:

    CALCULATION:-

    Calculation o f Throughput(X) From The Obtained Readings:

    Successfully transmitted packet by a node= Tx packets-Collision Count

    (Sum of successfully Tx packet in all nodes * Packet Length*8)

    X= ----------------------------------------------------------------------------------

    (Duration of Experiment * 8kbps)

    Find throughput as above from the readings taken by varying the ta

    Calculation o f Theoretical Throughput:

    X= Ge-2G

    144

  • 8/6/2019 Final Copy (Record)

    145/187

  • 8/6/2019 Final Copy (Record)

    146/187

    AIM:

    To implement and study the CSMA/CA protocol for packet communication between a

    numbers of nodes connected to a common bus.

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package.

    2. LAN-T Trainer Kit

    146

    EX.No : 9.a

    DATE : 29.11.10

    IMPLEMENTATION AND STUDY OF ETHERNET LAN PROTOCOLS CSMA/CA

  • 8/6/2019 Final Copy (Record)

    147/187

    3. Connecting Wires

    THEORY:

    The CSMA/CA procedure differs from the CSMA/CD procedure in that there is no

    collision. The procedure avoids collision. The elements of CSMA/CA used in the IEEE 802.11

    wireless LAN standard are interframe spacing (IFS), connection window (CW), and a back-off

    counter. The CW intervals are used for contention and transmission of the packet frame.

    The IFS is used as an interval between two CW intervals. The back-off counter is used to

    organize the back-off procedure for transmission of packets.

    TABULATION1:

    CSMACA

    Packet Length=100Byte, Number ofNodes=1

    IPD G-Offered Load X-Throughput

    800 0.126 0.105

    400 0.244 0.147

    200 0.477 0.212

    147

  • 8/6/2019 Final Copy (Record)

    148/187

    100 0.941 0.264

    40 2.049 0.289

    20 3.435 0.307

    10 5.196 0.324

    5 6.401 0.355

    Packet Length=100Byte, Number ofNodes=2

    IPD G-Offered Load X-Throughput

    2000 0.104 0.085

    800 0.245 0.144

    400 0.499 0.147

    200 0.923 0.166

    410 1.799 0.188

    40 4.156 0.254

    20 6.842 0.279

    10 10.468 0.297

    Packet Length=100Byte, Number ofNodes=4

    IPD G-Offered Load X-Throughput

    4000 0.092 0.076

    2000 0.218 0.119

    800 0.485 0.116

    400 1.014 0.127

    200 1.805 0.129

    148

  • 8/6/2019 Final Copy (Record)

    149/187

    410 3.689 0.146

    40 8.235 0.165

    20 13.867 0.169

    PROCEDURE:

    1. Click on the MAC Environment icon twice from the desktop on both PCs.

    2. Click the configuration button in the window in both the PCs and select the protocol as

    CSMA/CA.

    3. Calculate the IPD(ta) as given below

    N* P

    G= -------

    C*ta

    Where,

    G is the offered load to the network, whose value ranges from 0.1 to 4.

    N is the number of nodes participating in the network. For example, let us say

    that 4 nodes (Using 2 computers).

    P is the packet length usually it takes the value 10.

    C is the data rate normally set as 8kbps, which is selected in the NEU.

    So, lets assume G=1 and substitute the above mentioned parameters in the Equation A

    which leads to ta as 40 milliseconds and substitute the same in the configuration view.

    1. Select the OK button and download the driver to the NIU using the BOOT button

    command. Booting from any one of the applications is enough.

    2. Run the experiment by clicking button or RUN- Start from each application.

    3. View the statistics window for results. Only Tx packets and collision count are taken into

    account for MAC Calculation.

    4. Save or note down the readings once the experiment is completed.

    5. Repeat the above steps from 1 to 6 for a range of 'G' values and calculating ta.

    6. Plot graph between Offered load and throughput.

    7. Compare graphs of different packet length, nodes and data rate.

    149

  • 8/6/2019 Final Copy (Record)

    150/187

    GRAPH1:

    CALCULATION:-

    Calculation o f Throughput(X) From the Obtained Readings:

    Successfully transmitted packet by a node= Tx packets-Collision Count

    (Sum of successfully Tx packet in all nodes * Packet Length*8)

    X= ----------------------------------------------------------------------------------

    (Duration of Experiment * 8kbps)

    Find throughput as above from the readings taken by varying the ta

    150

  • 8/6/2019 Final Copy (Record)

    151/187

    Calculation o f Theoretical Throughput:

    X= Ge-2G

    Substitute the G value, which was used to calculate inter packet delay Ta in the

    above mentioned equation and calculate the Theoretical X and compare the same with the

    practical X.

    Calculation o f Offered Load:

    (Sum of transmitted packets in all 4 nodes * packet length *8)

    G= -----------------------------------------------------------------------------

    (Duration of Experiment * 8 kbps)

    TABULATION2:

    CSMACA P100 8KB

    IPDTx

    Sender 2Tx

    Sender 3Tx

    Sender 4Tx

    Sender 5G-Offered Load X-Throughput

    4000 18 22 17 19 0.092 0.076

    2000 31 29 31 28 0.218 0.119

    800 47 40 18 11 0.485 0.116

    400 27 14 51 35 1.014 0.127

    200 37 60 15 17 1.805 0.129

    100 57 20 37 32 3.689 0.146

    40 19 53 20 73 8.235 0.165

    20 90 67 8 4 13.867 0.169

    151

  • 8/6/2019 Final Copy (Record)

    152/187

    GRAPH2:

    TABULATION3:

    P100 1Node

    IPD Tx Sender 2 G-Offered Load X-Throughput

    800 105 0.126 0.105

    400 147 0.244 0.147200 212 0.477 0.212

    100 264 0.941 0.264

    40 289 2.049 0.289

    20 307 3.435 0.307

    10 324 5.196 0.324

    5 355 6.401 0.355

    GRAPH3:

    TABULATION4:

    P100 2 Node s

    IPD Tx Sender 2 Tx Sender 3 G-Offered Load X-Throughput

    2000 43 42 0.104 0.085

    800 74 70 0.245 0.144

    400 70 77 0.499 0.147

    152

  • 8/6/2019 Final Copy (Record)

    153/187

    200 89 77 0.923 0.166

    100 121 67 1.797 0.188

    40 51 203 4.156 0.254

    20 209 70 6.842 0.279

    10 290 7 10.468 0.297

    GRAPH4:

    TABULATION5:

    P100 4 Node s

    IPDTx Sender

    2Tx Sender

    3Tx Sender

    4Tx Sender

    5G-Offered

    LoadX-Throughput

    4000 18 22 17 19 0.092 0.076

    2000 31 29 31 28 0.218 0.119

    800 47 40 18 11 0.485 0.116

    400 27 14 51 35 1.014 0.127

    200 37 60 15 17 1.805 0.129

    100 57 20 37 32 3.689 0.146

    40 19 53 20 73 8.235 0.165

    20 90 67 8 4 13.867 0.169

    GRAPH5:

    153

  • 8/6/2019 Final Copy (Record)

    154/187

    154

  • 8/6/2019 Final Copy (Record)

    155/187

    RESULT:

    Thus the CSMA/CA protocol for packet communication between a numbers of nodes

    connected to a common bus was studied and implemented.

    155

  • 8/6/2019 Final Copy (Record)

    156/187

  • 8/6/2019 Final Copy (Record)

    157/187

    AIM:

    To implement and study the CSMA/CD protocol for packet communication between a

    numbers of nodes connected to a common bus.

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package.

    2. LAN-T Trainer Kit.

    3. Connecting Wires.

    THEORY:

    Persistent and Non-Persistent CSMA protocols are clearly an improvement over

    ALOHA because they ensure that no station begins to transmit when it sense the channel busy.

    Another improvement is for stations to abort their transmission as soon as the detect a collision.

    In other words, if two stations send the channel to be idle and begin transmitting

    simultaneously they will both detect the collision almost immediately. Rather than finish

    transmitting their frames which are irretrievably garble anyway, they should abruptly stop

    transmitting as soon as the collision is detected.

    Quickly terminating damaged frames saves time and bandwidth this protocol known as

    CSMA/CD (CSMA with collision detection) is widely used on the LANs in the MAC sublayers.

    157

    EX.No : 9.b

    DATE : 29.11.10

    IMPLEMENTATION AND STUDY OF ETHERNET LAN PROTOCOLS

    CSMA/CD

  • 8/6/2019 Final Copy (Record)

    158/187

  • 8/6/2019 Final Copy (Record)

    159/187

  • 8/6/2019 Final Copy (Record)

    160/187

    3. View the statistics window for results. Only Tx packets and collision count are taken

    into account for MAC Calculation.

    4. Save or note down the readings once the experiment is completed.

    5. Repeat the above steps from 1 to 6 for a range of 'G' values and calculating ta.

    6. Plot graph between Offered load and throughput.

    7. Compare graphs of different packet length, nodes and data rate.

    GRAPH:

    CALCULATION:-

    Calculation o f Throughput(X) From the Obtained Readings:

    Successfully transmitted packet by a node= Tx packets-Collision Count

    (Sum of successfully Tx packet in all nodes * Packet Length*8)

    X= ----------------------------------------------------------------------------------

    (Duration of Experiment * 8kbps)

    Find throughput as above from the readings taken by varying the ta

    160

  • 8/6/2019 Final Copy (Record)

    161/187

  • 8/6/2019 Final Copy (Record)

    162/187

    AIM:

    To implement and study the reliable data transfer between two nodes over an unreliable

    network using Selective Repeat ARQ protocol.

    162

    EX.No : 9.c

    DATE : 03.12.10

    IMPLEMENTATION AND STUDY OF IMPLEMENTATION AND STUDY OF

    ARQ PROTOCOLS - SELECTIVE REPEAT

  • 8/6/2019 Final Copy (Record)

    163/187

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package

    2. LAN-T Trainer Kit

    3. Connecting Wires

    Tabulation1:

    SELECTIVE REPEAT PROTOCOL

    Data Packet Length 100

    Data Rate 'C' 8000

    Expt Duration (ms) 100

    Ack Packet Length 10

    163

  • 8/6/2019 Final Copy (Record)

    164/187

  • 8/6/2019 Final Copy (Record)

    165/187

    Tabulation2:

    X VS BER

    H (Header size in a packet) in bits = 64

    D (no of data bits per packet) = packet length H = 736

    P (no of bits per packet - D+H) = packet length = 800

    Tau (one way propogation delay) = 0I (processing time per packet) in sec = 0.039845361

    Data Packet Length 100

    Data Rate 'C' 8000

    Expt Duration (ms) 100

    Ack Packet Length 10

    Bit Delay 0

    No of bits between Tx and Rx nodes 1

    Time Out in ms 300

    BERReceived Data

    Packets by ReceiverAcknowledgementsReceived by Sender

    SuccessfullyTransmitted

    X - Throughput

    10 348 457 485 0.485

    165

  • 8/6/2019 Final Copy (Record)

    166/187

    6 456 350 442 0.442

    5 487 486 480 0.48

    4 435 440 401 0.401

    3 356 284 197 0.197

    1 7 0 0 0

    Graph2:

    166

  • 8/6/2019 Final Copy (Record)

    167/187

    RESULT:

    Thus the reliable data transfer between two nodes over an unreliable network using the

    Sliding window Selective Repeat protocol was studied.

    167

  • 8/6/2019 Final Copy (Record)

    168/187

    AIM:

    To implement and study the reliable data transfer between two nodes over an unreliable

    network using Stop-and-wait ARQ protocol.

    APPARATUS REQUIRED:

    1. Two PCs with LAN-T Simulation Package.

    2. LAN-T Trainer Kit.

    3. Connecting Wires.

    168

    EX.No : 9.d

    DATE : 01.12.10

    IMPLEMENTATION AND STUDY OF ARQ PROTOCOLS

    STOP-AND-WAIT

  • 8/6/2019 Final Copy (Record)

    169/187

    Tabulation1:

    STOP&WAIT P100

    Time Out Vs X

    Data Packet Length 100

    Data Rate 'C' 8000

    Expt Duration (ms) 100

    Ack Packet Length 10

    Time out(ms)

    Received DataPackets by Receiver

    AcknowledgementsReceived by Sender

    SuccessfullyTransmitted

    X Throughput

    100 8 6 1 0.001

    200 12 10 4 0.004

    300 387 387 386 0.386

    400 387 387 386 0.386

    500 388 388 387 0.387

    Graph1:

    169

  • 8/6/2019 Final Copy (Record)

    170/187

    PROCEDURE:

    1) Click on the Stop & Wait icon twice from the desktop on both Pc s.

    2) Click the Configuration button in the window in both the Pc`s and select the protocol

    as `CSMA/CD`.

    3) Set the Inter Packet Delay to 400msecs.

    4) Download the driver to the NIU using the BOOT button command for both Pcs.

    5) Run the experiment by clicking the RUN-Start from each application .Run the

    receiver node first & then the sender node. While you run the sender node it will ask

    for time out value.

    6) Set the Timeout value to 1500.

    7) Note down the no of successfully Transmitted Packets & Ret