[英]Reconstruct 3D graph with surf in matlab?
I usually use surf
function to plot 3D figures in matlab, but now the data is different, so I am using plot3
and I have the below figure. 我通常使用
surf
函数在matlab中绘制3D图形,但是现在数据有所不同,因此我使用plot3
并且具有以下图形。 Do you have any idea how I reconstruct this figure to be more understandable even if by using different function. 您有任何想法,即使使用不同的功能,我如何将这个数字重构为更易于理解。 To be more concise, I have X values, with each X value there is a value of Y and value of Z.
简而言之,我有X值,每个X值都有一个Y值和Z值。
X = [ 1 ;2 ;4; 8; 16; 32; 64];
Z = [ 1; 1.8 ; 3.46 ; 6.74 ; 13.18 ; 24.34 ; 39.33]
Y = [0 ; 56.92 ; 91 ; 109.95 ; 119 ; 123.57 ; 125.51]
fig = plot3(log(X),Y,Z,'b.-');
XLABEL=[ 1 2 4 8 16 32 64];
set(gca,'XTickLabel',XLABEL);
set(gca,'XTick',log(XLABEL));
YLABEL= [ 0 30 60 90 120 150 180];
set(gca,'YTickLabel',YLABEL);
set(gca,'YTick',YLABEL);
ZLABEL= [0 5 10 15 20 25 30 35 40 45 50 55];
set(gca,'ZTickLabel',ZLABEL);
set(gca,'ZTick',(ZLABEL));
ylim([0 180]);
zlim([0,55]);
grid on
It's difficult to say, because we don't have a context. 很难说,因为我们没有上下文。 Common options are:
常见选项有:
Code for Option 3: 选项3的代码
At the end of your code, add the following code: 在代码末尾,添加以下代码:
X2=[X';X';nan(size(X'))];
X2=X2(:);
Y2=[Y';Y';nan(size(Y'))];
Y2=Y2(:);
Z2=[Z';zeros(size(Z'));nan(size(Z'))];
Z2=Z2(:);
hold on
plot3(log(X2),Y2,Z2,'--')
To understand it, you have to know that matlab skips nans while plotting. 要了解它,您必须知道matlab在绘制时会跳过nans。 Thus the code above generates a independent line segment for each point, connecting it to the ground plane.
因此,上面的代码为每个点生成一个独立的线段,并将其连接到接地平面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.