See also deployment-of-sensor-nodes-randomly-in-a-matrix. You two should get together and solve this on your own.
As in this other question, there's not enough information for us to answer.
Also, since it appears to be homework, perhaps you should attempt to solve your own homework. That's the only way you'll learn how to use matlab.