Peaks of Matlab, mesh, and meshgrid Functions
Peaks:
MATLAB provides a peaks function to generate a concave and convex surface. It contains three local vertices and three Local Minimization points. The equation is:
I:
Peaks: 49*49 matrix (n = 49) by default)
II:
Z = peaks (N): The larger the value of N, the smaller the interval between neighboring points. Therefore, the smoother the line. The returned Z is a two-dimensional matrix.
For details, refer to the peaks function code: Open peaks
Mesh:
Draw a three-dimensional graph
I:
If () = 3, () = 4, () = 5, () = 6, soMesh (x) indicates to draw a 3D Graph with (row, column) as (x, y) and value as Z.Therefore, the four points in this example are:
(, 3), (, 4), (, 5), and (, 6)
II:
Mesh (x, y, z) indicates to draw a 3D Graph with (x, y, z)
Meshc:
Draw 3D mesh and contour map
Meshz:
Draw 3D grids and line charts
Meshgrid:
I:
[X, y] = meshgrid), Then ,. X is the same matrix for each row, and Y is the same matrix for each column.
II:
[X, y] = meshgrid), Then ,.
Example:
Z = peaks (30 );
Mesh (z );
Surf:
Use the following method to draw a 3D surface map:
I:
Surf (X)
II:
Surf (x, y, z)
Surfl:
Draw a 3D curved surface with shadow
Surfc:
Draw a 3D surface map with Contour Lines
Shading:
Shading flat
% Each area is represented in different colors.
Shading faceted% Deepen the gridline Based on shading flat
Shading interp% Shadow Smoothing
Colormap:
Set the color of a 3D image. The specific color can be:
Graph window --> edit --> colormap... --> Tools --> standerd colormaps select
For example:Colormap prism
Alphamap:
Set the transparency color of the image, specifically:
Alphamap ('Default');
Alphamap ('Rampup');
Alphamap ('Rampdown');
Alphamap ('Vup');
Alphamap ('Vdown');
Alphamap ('Increase');
Alphamap ('Decrease');
Alphamap ('Spin');
If you do not know a function, you can:
Doc xxx% Open the Help page of function xxx
Help xxx% Output the help information of function XXX directly in the Command window
When defining a function in MATLAB, you can useNarginIndicates the number of input parameters passed to the function.