2012-07-08 41 views
0

我使用的代码下面的行来绘制:冲浪()在Matlab仅示出两种颜色,而不是多个颜色

nthTheta=1; 
gammaSurf=reshape(gamma(:,nthTheta,:),size(gamma,1),size(gamma,3)); 
figure 
[spatial_lag,temporal_lag]=meshgrid(distance,4:4:12); 
surf(gammaSurf,spatial_lag',temporal_lag') 
colorbar 
xlabel('Spatial Lag','Fontweight','Bold') 
ylabel('Temporal Lag','Fontweight','Bold') 
zlabel('\gamma (h,t)','Fontweight','Bold') 
title('Spatiotemporal Empirical Variogram','Fontweight','Bold') 

gammaSurf矩阵具有下面的值,其示出了它的值被改变:

enter image description here

我碰到下面的情节只有两种颜色,而不是多种变化的颜色:

enter image description here

我做错了什么,因为我没有得到一个我期望的多种颜色变化的情节?谢谢!

回答

1

设置shading要插补:

shading(gca,'interp'); 

应该做的伎俩。

其实,它看起来像你有错误的顺序surf的参数。如果您希望z轴适用于gammasurf值,则需要将其作为第三个参数。

surf(spatial_lag',temporal_lag',gammasurf); 

最后一个建议:如果你真的没意味着gammasurf是x值,但你想要的是什么定义颜色,使用它作为第四个参数(C):

surf(gammasurf,spatial_lag',temporal_lag',gammasurf); 

现在表面将像图像一样取向,但颜色随着x值而不是z值而变化。

+0

谢谢tmpearce!你是对的,我的理由是错误的,即γSurf应该是第三个论点。 – Pupil 2012-07-08 21:39:28