Matlab is a programming language that allows users to enter, manipulate plot, and analyse data in a variety of ways. Matlab also includes a graphing utility, enabling users to graph different shapes. To graph a cube in Matlab, there are a few options. One approach is to use one of Matlab's built-in functions called "patch." This function requires a few lines of code and outputs a 3D multicolour cube.

Open Matlab.

Click "File" and "New." Click "m-file."

Type "patch([0 0 1 1],[0 1 1 0],[1 1 1 1],'r')" --minus the quotation marks -- on the first line of the new m-file.

Type "patch([0 1 1 0],[0 0 0 0],[0 0 1 1],'b')" on the next line.

Type "patch([0 0 0 0],[0 1 1 0],[0 0 1 1],'y')" on the next line.

Type "view(-37.5, 30)" on the fourth line.

Type "axis square" on the last line.

Click the "Run" button with the green arrow to execute the m-file. A 3D multicolour cube should appear.

#### Tip

Another option for graphing a cube is to download a free add-on such as Matgraph Toolbox. This toolbox is available from the Matlab website for free. When you download Matgrah, place the file anywhere you want on your computer. To make Matlab recognise the toolbox, simply type "addpath('filepath')" in the command window. For example: addpath(c:/documents/matlab/myfiles). To graph a cube, type "cube(g,k)" in the command window, where "g" and "k" are the desired dimensions.