1. The problem statement, all variables and given/known data I want to reproduce the following matrix: A= [1 -1 0 0 -1 2 -1 0 0 -1 2 -1 0 0 -1 1 ] What i want is to reproduce the second and third row with the formula -x(i+1) + 2x(i) -x(i-1) = 0 This is a coupled oscillation system of N masses (hanging in a rope). The first row in the matrix is the leftmost mass m hanging from a rope and the last row is the rightmost mass m . The other two rows are the intermediate masses between mass 1 and mass 2. I want to know how i can write the correct code so that i can replicate the matrix both for 4 masses and N masses Note that i is an index and not a multiplication index. 2. Relevant equations -x(i+1) + 2x(i) -x(i-1) = 0 3. The attempt at a solution A = [1 -1 0 0]; for i = 1:1:4 for j = 2:1:4 A(i,4) = -1*(j-1) + 2*j - 1*(j+1) end end How do i shift the formula 1 step to the right ?