EE580 LabAssignment1 2023
EE580 LabAssignment1 2023
Lab Assignment 1
Use C, Python, MATLAB any other language of your choice to perform the fol-
lowing computations/simulations. The plots must be legible with appropriately chosen
axes labels, ticks and legends. Typeset your answers, plots and explaination in a
LibreOffice or LATEX document, save as .pdf. Upload the pdf document and your
code in Moodle.
x+
i := average(xi , {xj , for all neighbor nodesj}). (1)
Imagine a network with 5 nodes, set the initial state as (1, −1, 1, −1, 1). For
each of the graphs showb below, answer the following questions:
Answer the above questions using the analytical results established in class,
and then verify the same through computations. Comment on the relationship
between the connectivity of the network and the number of iterations required
to reach consensus?
2. Imagine that the xi in the above network is the position of the node. In which
case, acheiving consensus would mean that all the nodes move towards a com-
mon position. Each node can communicate with nodes within a particular
distance r from itself, i.e. neighbors of node i denoted as Ni can be expressed
as
In every iteration, each node updates its position using equation (1).
Simulate the movement of 5 nodes that are uniformly distributed in a 1 unit
x 1 unit square in R2 adhereing to the conditions described above. Choose an
appropriate value for r. Plot the position of each node (within the square) in
1
every iteration. You may choose the most significant of these plots to put in
your report. Repeat this simulation to compare the time taken for the nodes to
converge to the common point for different values of r. Choose atleast 5 values
for r, and represent the comparison of convergence time graphically. Comment
on the comparison and make inferences.