Averaging Algorithms in Matlab Report
Description
*Please answer Part B in full (3+ sentences for each question) and add code if asked for
*included details instructions in Networks Part B
*Included key from Part A if it helps with understanding, refer to matlabcode or adjacency matrices.m from part A if necessary
*included module 11 code and notes that will be used in later problems
Part B: Averaging Algorithms
4.1 Averaging over static networks
We will first explore consensus through averaging algorithms where the interaction networks are static
in time, which is consistent with the equations we wrote the equations in Section 2.
4.1.1 Discrete and continuous time models
As we saw in Section 2, the discrete time averaging algorithm for the interaction networks we built in
Section 3 is the system of linear difference equations
x(k + 1) = (I4 − εL)x(k)
when time is discrete and is the system of linear differential equations
when time is continuous.
4.1.2 Equilibria
x ̇ = − L x
Equilibria for averaging algorithms, as for all dynamical systems, are states from which the system
does not deviate if it begins there. The models should be designed so that the consensus state is an
equilibrium, meaning that coordination between individuals persists once it’s achieved.
Problem 4.1. Explain why the vector α14 is an equilibrium for the discrete and continuous models
above when any of the three adjacency matrices are considered, for a scalar α. Are there any other
equilibria for any of the three networks: A1, A2, and A3? If so, why?
4.1.3 Eigenvalues and stability
For the continuous-time model, convergence to consensus can depend on the interaction network and
initial conditions. However, the discrete-time model also has the averaging weight ε which controls the
stability of the equilibrium at α14.
Problem 4.2. First, write a general relationship between the eigenvalues of the graph Laplacian and
those of I4 − εL, and then write an inequality showing the values of ε (depending on the eigenvalues of
L) that will allow the system to reach consensus. For each of the three networks, compute bounds for ε
that ensure the system reaches consensus.
4.1.4 Simulations
Now that we have an expectation of what networks and what values of ε may enable the networked
individuals to reach consensus, we can demonstrate the behavior of the system through numerical sim-
ulations.
Problem 4.3. Use Matlab to simulate the averaging algorithms to demonstrate the effect of the inter-
action network on consensus.
-
Randomly generate or manually define initial conditions that you will use for your simulations.
This should be a 4×1 vector of real numbers. Save this vector in a file named initial conditions.mat. -
Write a Matlab script to simulate the discrete time model for 20 time steps for each of the inter-
action networks A1 and A2. For each network, select two values of ε: one that allows consensus
and one that is too large to allow consensus. Plot the 4 elements of the vector x with time on the
horizontal axis for each simulation. Clearly label all plots and discuss your observations.
7
3.
4.
4.2
Use this Matlab script to simulate the discrete time algorithm with A3 with two values of ε of
your choosing. Discuss the behavior of the system. How does consensus depend on the interaction
network and ε? Can you relate this back to the network properties encoded in the graph Laplacian?
Use the Runge Kutta method script developed in Module 11 to simulate the continuous time model
for 20 units of time with a time step of 0.5. Simulate the system for each of the parameter sets (ε
and interaction network) you selected above and compare the results between the continuous and
discrete time models.
Averaging over switching networks
Now, we will allow the interaction network to change in time using the random networks we constructed
in Section 3.
Problem 4.4. Use Matlab to simulate the discrete time averaging algorithm to demonstrate the effect
of switching interaction networks.
-
Write a Matlab script to perform the discrete time algorithm where the interaction network is an
independent realization of a random network that switches at each time step. -
Simulate the algorithm with a switching network using parameter values of N = 4, ε = 0.4 and
p = {0.1, 0.9} for 20 time steps. (You will notice that individual simulations will vary due to the
stochastic nature of the switching network.) -
Compute the disagreement ∥ξ∥ for the two simulations above (the one with p = 0.1 versus the
one with p = 0.9) and for a static network that uses A2 and ε = 0.4 for 20 time steps. Plot the
disagreement for each simulation with time on the horizontal axis. Describe your observations.
What is the effect of interaction networks that switch in time?
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."