Hobbies And Interests
Home  >> Science & Nature >> Science

How to Graph Matrices

Scientist and engineers use matrices in all forms of work. The technique is key in extending numerical analysis to vast data arrays--calculation of which would be impossible with conventional linear number sets. Matrices reduce the complexity of the high-level math involved, allowing mathematical operations to be applied to the matrix as a whole rather than tediously working through element by element. Matrices are hindered by their simplicity however. They are not suitable as a form of presentable information to another person, and require tools such as MATLAB to transform the raw data into an understandable context.

Things You'll Need

  • Mathematical computational software such as MATLAB
Show More

Instructions

    • 1

      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.

    • 2

      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.

    • 3

      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.

    • 4

      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...'.


https://www.htfbw.com © Hobbies And Interests