2012-02-08 71 views

回答

2

喜歡的東西griddata可以幫助您進行插值:

x = vector(:,1); 
y = vector(:,2); 
z = vector(:,3); 

% Settings 
xres = 800; % Resolution, the higher, the smoother 
yres = 800;   
cm = 'default'; % Colormap 

% Axes Limits 
xmin = min(x); 
ymin = min(y); 
xmax = max(x); 
ymax = max(y); 
xi = linspace(xmin, xmax, xres); 
yi = linspace(ymin, ymax, yres); 

% Figure 
myfig = figure('Position', [200 200 800 600]); 

rotate3d off 
[XI, YI] = meshgrid(xi, yi); 
ZI = griddata(x, y, z, XI, YI, 'cubic'); 
mesh(XI,YI,ZI); 

比你只需要它的視圖更改爲只爲z

2

除了一個固定值顯示某個plane @ Alexandrew answer你可以使用更新,更快的TriScatteredInterp類而不是GRIDDATA。對於您的檢查,您可以使用2D IMAGESC而不是3D MESH。

%# insert the code from @Alexandrew answer to generate meshgrid 
[XI, YI] = meshgrid(xi, yi); 
TSI = TriScatteredInterp(x,y,z); 
ZI = TSI(XI,YI); 
imagesc(ZI) 
colorbar 

如果輸入矩陣是一個單元陣列,可以將其轉換爲數值矩陣a = cell2mat(a);