I am not sure if my understanding is wrong, but in the example code, it says “two rightmost vertical members \ fill-in the matrix entries”, but shouldn’t it be four rightmost vertical members? e.g., if n=4, then k=[2], and we should write 8 extra equations for joints 8,9,10,11?
Please note that 1 vertical member corresponds to 2 joints and 4 equations.
Two vertical members correspond to 4 joints and 8 equations.
For Figure 2, my loop deals with joints 4, 5, 6, 7, and the rest is outside the loop.
Nothing stops you from including 8, 9, 10, 11 in the loop, but be careful to use an appropriate if statement.