How do I create a 201x 201 matrix with all odd rows alternating as 3,1,3 and the even rows alternating as 1,2,1,2. I tried using a random number generator, a for loop, and am thinking about using the find command. I am trying to generate a matrix, but I have recieved error messages.
Share
If I understand what you mean correctly, then the Kronecker product (
kron) is the simplest way to achieve this:The first command creates a 202×202 matrix according to your requirements, and the second command chops 1 row and 1 column off to conform to the 201×201 size specification.