The instruction is valid for Matlab version R2007b.
First dowload and save grTheory toolobox (save it in Tools): http://www.mathworks.com/matlabcentral/fileexchange/4266. Open the Matlab and go to the File/Set Path and click on the Add Folder. Insert the path to your grTheory toolbox.
Next create working folder and store there all files prepared at the bottom of this webpage (networksDB.mat, loadAndPrintNet.m, oneRoundWSN.m).
The networkDb.mat file that contains the database of the WSN networks in the form of Matlab matrixes with the node’s X,Y coordinates.
The function “loadAndPrintNet(numberOfNodes, nodeDegree) loads a selected ad-hoc network model from the networkDB.mat structure and displays its layout into the Matlab figure. User can choose 50, 100 or 400 number of nodes and degree of node 8, 10, 12, 14, 16, 18, 20, 22, 24, 26. Database is suitable for algorithms investigation under the same network conditions. You can find more details in the file comments. You can view the printed layout in the Matlab figure window.
To simulate the energy consumption of one round of data gathering from all the nodes, download oneRoundWSN.m and follow the comments within this file.