matlab for matrix generation