數據不易貼,我放在了百度網盤:點擊下載數據
大概以下形式:
windows
TIP:
這裏的數據矩陣爲v(5276),能夠當作一本27頁紙,每頁繪製了5*6的網格,而後27頁紙疊在一塊兒。當你理解本圖繪製後,數據能夠隨意製做。函數
NOTE:想了解每一個函數的用法能夠在matlab command windows中 輸入 doc slice便可得到slice的matlab詳解code
TIP:你能夠將代碼複製到一塊兒運行,此處我是單獨展現,分別繪圖orm
clc,clear v=csvread('vdata.txt'); v=reshape(v,5,27,6); [x,y,z]=meshgrid(1:27,1:5,1:6); h=figure(1); set(h,'name','取單切片') subplot(221) slice(x,y,z,v,[],[1],[]); shading interp set(gca,'zdir','reverse'); axis equal grid on subplot(222) slice(x,y,z,v,[],[2],[]); shading interp colormap('jet') set(gca,'zdir','reverse'); axis equal grid on subplot(223) slice(x,y,z,v,[],[3],[]); shading interp set(gca,'zdir','reverse'); axis equal grid on subplot(224) slice(x,y,z,v,[],[4],[]); shading interp set(gca,'zdir','reverse'); axis equal grid on
效果圖:
blog
h2=figure(2); set(h2,'name','全空間切片','MenuBar','none','ToolBar','none') slice(x,y,z,v,[1:2:27],[2 3 4],[2 3 4 5]) shading interp colorbar colormap('jet') set(gca,'zdir','reverse'); axis equal grid on box on
效果圖:
圖片
h3=figure(3); set(h3,'name','定值包絡立體圖','MenuBar','none','ToolBar','none') set(gcf,'InvertHardcopy','off') fw=350; %%此值爲最外層包絡面取值 fv=isosurface(x,y,z,v,fw); p=patch(fv); set(p,'facecolor','b','edgecolor','none'); patch(isocaps(x,y,z,v, fw), 'FaceColor', 'interp', 'EdgeColor', 'none'); colorbar colormap('jet') box on daspect([1,1,1]) view(3) set(gca,'zdir','reverse','color',[0.2,0.2,0.2]); camlight camproj perspective lighting phong axis equal grid on title(['最外層表面的值爲: ' , num2str(fw)]);
NOTE:上述代碼中的fw是做主要可變參數,控制最外層包絡面的值get
以下演示多個fw下不一樣的效果圖:it