Rough framework of nw3 function done. Next step is to change all of the statements inside the loops to ensure that they are actually looking at different locations in the matrix.