Info

This question is closed. Reopen it to edit or answer.

Average Path (Bug Jump Problem)

1 view (last 30 days)
Scott
Scott on 1 Nov 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Please see Attached, I'm only having an issue on the first problem.
So in this problem they've got an irregular surface and I'm supposed to figure out the average path length before a bug falls off (square spaces on the diagram). In the attached, it describes how to do the problem step by step, but pretty obscure/broad. They have me set up a weight vector (as I understand it, number of paths branching off from a node), which I have done successfully. However, I lose it right here: "Using a for loop over the nodes set up each equation in turn. Notice that the diagonal elements of A are always 1. (Why?)"
First off, I don't know what "1" is. Are the vertical and horizontal paths not 1?
The equation they give is as follows:
I believe T_p is the variable we're looking for to find average path? W_p is the weight (number of paths) from that point T_n ... not really sure. I'd like to think it's the sum of the connected nodes.
Anybody able to help me out here?

Answers (1)

Geoff Hayes
Geoff Hayes on 1 Nov 2014
Scott - my understanding of the homework assignment is that A will be a 15x15 matrix (since there are 15 nodes), and like you, believe that you are trying to calculate Tp for all nodes. So if you were to calculate A, your system of equations would be something like
A*x = y
where x is a 15x1 vector of Tp values (for p=1,2,..,15) and y is the 15x1 vector of 0's and 1's depending upon whether node p is a square or a circle respectively.
So if we start with the first node, p=1, then because this node is a square, the equation is
T1 = 0
which is equivalent to
1*T1 = 0
In our system of equations, this means that
A(1,1) = 1; % because of 1*T1
y(1) = 0;
Now consider the second node, p=2, then because this node is a circle, the equation is
T2 - 1/W2 * (T1 + T3 + T5 + T7 + T12) = 1
since nodes 1, 3, 5, 7, and 12 are attached to node 2. Like before, the above equation is equivalent to
1*T2 - 1/W2 * (T1 + T3 + T5 + T7 + T12) = 1
In our system of equations, this means that
A(2,1) = -1/5; % since the weight of node 2 is five
A(2,3) = -1/5;
A(2,5) = -1/5;
A(2,7) = -1/5;
A(2,12) = -1/5;
A(2,2) = 1; % because of 1*T2
Like with node 1, the diagonal element A(p,p) is set to one. This pattern will continue for each of the remaining nodes, and so the diagonal elements will all be set to one.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!