问题描述
我有一个 3 维数据要在 matlab 中绘制.数据集是通过沿y方向堆叠10条不同参数的指数曲线来构建的,例如
I have a 3-dimensional data to be plotted in matlab. The data set are built by stacking 10 exponential curves with different parameters along y directions such as
x = 0:0.01:15;
x0 = 0.5;
y = [beta1, beta2, beta3, beta4, beta5, beta6, beta7, beta8, beta9, beta10];
Z(1, :) = A*exp(-(x-x0).^2/beta1);
Z(2, :) = A*exp(-(x-x0).^2/beta2);
Z(3, :) = A*exp(-(x-x0).^2/beta3);
Z(4, :) = A*exp(-(x-x0).^2/beta4);
...
Z(10, :) = A*exp(-(x-x0).^2/beta10);
% here A could be change based on beta too (no code shown here)
我正在尝试用瀑布绘制 Z,除了我不希望高度(即垂直线)出现在边缘上.我不知道是否还有其他方法可以将数据绘制为类似瀑布的曲线但没有那些垂直线.谢谢
I am trying to plot Z with waterfall except for I don't want the height (i.e. the vertical line) appears on the edge. I don't know if there is any other way to plot the data as waterfall-like curves but without those vertical lines. Thanks
推荐答案
它是用线条绘制的,而不是用曲面绘制的".
换句话说,您希望边界线不可见.嗯,这绝非易事,因为边界线与您可以直接包含的任何配色方案都是分开的.您需要做的是在绘制后获取数据,然后进行相应的修改:
"it is plotted with lines instead of patch with surface".
In other words, you want the boundary lines to be invisible. Well that's no trivial feat as the boundary lines are separate from any color scheme you can directly include. What you need to do is get the data after it drawn then modify it accordingly:
例如
[X,Y,Z] = peaks(30);
h = waterfall (X,Y,Z);
CD = get (h, 'CData');
CD(1,:) = nan;
CD(end-2:end,:) = nan;
set (h, 'CData', CD)
注意 CD(1,:)
是上升"边界,而 CD(end-2:end-1,:)
是下降边界边界,CD(end,:)
为底部.
note that CD(1,:)
is for the "rising" boundary, while CD(end-2:end-1,:)
is for the falling boundary, and CD(end,:)
is for the bottom.
这篇关于在matlab中寻找瀑布图的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!