瀑布函数绘制的网格与meshz函数相等, 但是不会从矩阵的列生成线。
句法
waterfall(Z) // It creates a waterfall plot using x = 1:size(Z, 1) and y = 1:size(Z, 1). Z determines the color, so the color is proportional to surface height.waterfall(X, Y, Z) // It generates a waterfall plot using the values specified in X, Y, and Z. Z also defining the color, so the color is proportional to the surface height. If X and Y are vector, X corresponds to the columns of Z, and Y correspond to the rows, where the length(x) = n, length(y) = m, and [m, n] = size(Z). waterfall(..., C) // It uses scaled color values to obtain colors from a current colormap. Color scaling is defined by the range of C, which must be the same size as Z. h = waterfall(...) // It returns the handle of the patch graphics object used to draw the plot.
例子
z=-5/(1+x^2+y^2 )|x|≤3, |y|≤3x=linspace (-3, 3, 50);
y=x;
[x, y] = meshgrid(x, y);
z=-5. / (1+x. ^2+y. ^2);
waterfall(z)hidden off
【MATLAB 3D函数Waterfall()】输出
文章图片
推荐阅读
- MATLAB 3D函数mesh()
- MATLAB 3D函数meshz()
- MATLAB函数stairs()
- MATLAB 3D函数surf()
- MATLAB 3D绘图
- MATLAB 3D函数contour3()
- MATLAB 3D函数fill3()
- MATLAB函数plot3()
- MATLAB函数pcolor()