| Contents | Index |
plot::Matrixplot(A) visualizes the matrix
as a 3D function graph by interpolating the matrix values as a function of the matrix indices.
Calls:
plot::Matrixplot(A, Options)
plot::Matrixplot(A, x =
..
, y =
..
, <a = amin .. amax>, Options)
plot::Matrixplot(row1, row2, ..., Options)
plot::Matrixplot(row1, row2, ..., x =
..
, y =
..
, <a = amin .. amax>, Options)
plot::Matrixplot([row1, row2, ...], Options)
plot::Matrixplot([row1, row2, ...], x =
..
, y =
..
, <a = amin .. amax>, Options)
plot::Matrixplot(s, <c1, c2, ...>, Options)
plot::Matrixplot(s, <c1, c2, ...>, x =
..
, y =
..
, <a = amin .. amax>, Options)
plot::Matrixplot(s, <[c1, c2, ...]>, Options)
plot::Matrixplot(s, <[c1, c2, ...]>, x =
..
, y =
..
, <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. |
|
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. |
|
s: |
a data sample of domain type stats::sample. |
|
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 |
|
|
the range of the first coordinate: |
|
y: |
name of the second coordinate: an identifier or an indexed identifier. It is used as the title of the coordinate axis in |
|
|
the range of the second coordinate: |
See Also:
plot, plot::copy, plot::Function3d, plot::Surface
Details:
Matrixplot interprets the indices of a matrix as
and
coordinates and the corresponding matrix entry as the corresponding
coordinate. Thus, the matrix is regarded as a discretized function in
variables. The function graph is displayed as a 3D surface using interpolation between the data points.
If no ranges
,
are specified, the matrix entry A[i, j] is diplayed as the 3D point
,
,
= A[i, j] with integer positions
,
. If plot ranges are specified, the matrix indices
are used to define an equidistant mesh in the plot range.
The attribute InterpolationStyle allows to define the surface via linear or cubic spline interpolation of the data points: Choose between InterpolationStyle = Linear or InterpolationStyle = Cubic. The default is linear interpolation. With cubic interpolation, the data surface may be smoothened by setting the numbers
of plot points between the data points via the attribute Submesh =
. The numbers mx, my must be (small) non-negative integers.
With InterpolationStyle = Linear, symbolic values and complex numbers are accepted and ignored, leading to gaps in the surface. With InterpolationStyle = Cubic, symbolic values or complex numbers lead to an error. Cf. example 4.
Per default, the data points are rendered on the surface. Use PointsVisible = FALSE to make them disappear.
Animations are triggered by specifying a range
for a parameter a that is different from the variables x, y. Thus, in animations, both the ranges
,
as well as the animation range
must be specified.
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))

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)):

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)):

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))

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)

Example 4
We plot a Hilbert matrix:
A := linalg::hilbert(10):
plot(plot::Matrixplot(A), CameraDirection = [3, 2, 1])

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])

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:

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 |