2012-07-08 44 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