Things You'll Need
Instructions
Define a set or sets of numbers representing a matrix, of width U and length V. Set V to define the total number of data points within the matrix, and assign U as the number of dimensions per data point. Note: since MATLAB cannot graphically represent an object with more than three dimensions, it is suggested that U be kept within the range of one and three. On the contrary, as the resolution of the curve/surface is dependant on the number of data points within the matrix, using large data sets with high values of V is required to produce graphs of a presentable standard.
Program the matrix into MATLAB using the command window. First you must give the matrix a name in the form:
_name = ...
Omit the quotation marks and replace _name with your own identifier. It is good practice to identify the matrix with a meaningful name, especially if you are using multiple matrices per session.
Enter in the matrix data row by row using square bracket notation, in the form
M = [value1, value2, ... valueN].
It is possible to enter in multiple rows at once, by separating each row with a semi-colon inside the brackets. To enter 3D matrices you must use the form matrix(:,:,Z) = [...], where Z is equal to the required z-depth. For example:
M = [ 1, 2, 3; 4, 5, 6; ]
Would create a 2x3 2D matrix named M, following with the command
M(:,:,Z) = [ 5, 6, 7; 8, 9 10; ]
Turns matrix M into a 2x3x2 3D Matrix.
Plot the matrix onto a graph. Two-dimensional matrices are drawn using the command 'plot(M);' three-dimensional matrices can be parsed in two different ways, 'mesh(M);' o 'surf(M);' to produce a 3D mesh (also known as a wire-frame) or solid surface render respectively. MATLAB will also apply a default presentation setting for your graph, however you can customize this to your specifications via the property editor, accessed through right-clicking the object and selecting 'Properties...'.