Skip to Main Content Skip to Search
Product Documentation

plot::Matrixplotsurface plot of matrix data

plot::Matrixplot(A) visualizes the matrix A as a 3D function graph by interpolating the matrix values as a function of the matrix indices.

→ Examples

Calls:

plot::Matrixplot(A, Options)

plot::Matrixplot(A, x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`, <a = amin .. amax>, Options)

plot::Matrixplot(row1, row2, ..., Options)

plot::Matrixplot(row1, row2, ..., x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`, <a = amin .. amax>, Options)

plot::Matrixplot([row1, row2, ...], Options)

plot::Matrixplot([row1, row2, ...], x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`, <a = amin .. amax>, Options)

plot::Matrixplot(s, <c1, c2, ...>, Options)

plot::Matrixplot(s, <c1, c2, ...>, x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`, <a = amin .. amax>, Options)

plot::Matrixplot(s, <[c1, c2, ...]>, Options)

plot::Matrixplot(s, <[c1, c2, ...]>, x = `x_{min}` .. `x_{max}`, y = `y_{min}` .. `y_{max}`, <a = amin .. amax>, Options)

Parameters:

A

a matrix of category Cat::Matrix or an array containing real numerical values or expressions of the animation parameter a
A is equivalent to the attribute Data.

row1, row2, ...: 

the matrix rows: each row must be a list of real numerical values or expressions of the animation parameter a. All rows must have the same length. 
row1, row2, ... is equivalent to the attribute Data.

s

a data sample of domain type stats::sample.
s is equivalent to the attribute Data.

c1, c2, ...: 

column indices of s: positive integers. These indices, if given, indicate that only the specified columns should be used. The indexed columns must contain real numerical values or expressions of the animation parameter a, If no columns are specified, all columns of s are used.

x

name of the first coordinate: an identifier or an indexed identifier. It is used as the title of the coordinate axis in x direction. 
x is equivalent to the attribute XName.

`x_{min}` .. `x_{max}`

the range of the first coordinate: `x_{min}`, `x_{max}` must be numerical real value or expressions of the animation parameter a
`x_{min}` .. `x_{max}` is equivalent to the attributes XRange, XMin, XMax.

y

name of the second coordinate: an identifier or an indexed identifier. It is used as the title of the coordinate axis in y direction. 
y is equivalent to the attribute YName.

`y_{min}` .. `y_{max}`

the range of the second coordinate: `y_{min}`, `y_{max}` must be numerical real value or expressions of the animation parameter a
`y_{min}` .. `y_{max}` is equivalent to the attributes YRange, YMin, YMax.

See Also:

plot, plot::copy, plot::Function3d, plot::Surface

Details:

Example 1

This example demonstrates the general calling syntax. The data are passed in different ways using a list of rows, an array, and a matrix, respectively:

A := [[2, 1, 1],
      [3, 4, 3],
      [3, 5, 4],
      [2, 6, 5]]:
plot(plot::Matrixplot(A))

MuPAD graphics

With InterpolationStyle = Cubic, the matrix data are plotted as a cubic spline surface:

A := array(1..4, 1..3, A):
plot(plot::Matrixplot(A, InterpolationStyle = Cubic)):

MuPAD graphics

The spline surface can be smoothened by using the Submesh attribute to add further evaluation points:

A := matrix(A):
plot(plot::Matrixplot(A, Submesh = [6, 6],
                      InterpolationStyle = Cubic)):

MuPAD graphics

delete A:

Example 2

Various plot attributes can be specified:

plot(plot::Matrixplot(
   [[-0.5,   0.5, 0.7, 0.5, -1  ],
    [ 1.2, 1.3, 1.4, 1.4,  1  ],
    [ 1.4, 1.5, 1.6, 1.5,  1.2],
    [ 0.6, 0.8, 1,   1,    1  ],
    [-0.7, 0.5, 0.5, 0,   -1  ]],
    PointsVisible = FALSE,
    FillColor = RGB::Green,
    LineColor = RGB::Red))

MuPAD graphics

Example 3

Choosing appropriate coordinate ranges, we place two matrix plots side by side:

plot(plot::Matrixplot(matrix::random(5, 5, frandom),
                      x = 0..1, y = 0..1,
                      Color = RGB::Red),
     plot::Matrixplot(matrix::random(6, 6, frandom),
                      x = 2..3, y = 0..1,
                      Color = RGB::Green),
     Scaling = Constrained)

MuPAD graphics

Example 4

We plot a Hilbert matrix:

A := linalg::hilbert(10):
plot(plot::Matrixplot(A), CameraDirection = [3, 2, 1])

MuPAD graphics

Some of the entries are replaced by values that cannot be plotted. Consequently, the plot contains holes:

A[2, 2] := NIL:
A[4, 5] := infinity:
A[5, 5] := x:
plot(plot::Matrixplot(A), CameraDirection = [3, 2, 1])

MuPAD graphics

With InterpolationStyle = Cubic, an error is raised:

plot(plot::Matrixplot(A, InterpolationStyle = Cubic))

Error: Data contains nonreal numeric values. Use 'Style = Linear' to plot matrices containing such data. [plot::Matrixplot::doPlotStatic]

delete A:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS