www.gusucode.com > images 案例代码 matlab源码程序 > images/Filter3DFluidFlowVolumeDataExample.m

    %% Use Median Filtering to Remove Outliers in 3-D Data
% 
%%
% Create a noisy 3-D surface.
[x,y,z,V] = flow(50);
noisyV = V + 0.1*double(rand(size(V))>0.95) - 0.1*double(rand(size(V))<0.05);
%%
% Apply median filtering.
filteredV = medfilt3(noisyV);
%%
% Diplay the noisy and filtered surfaces together.
subplot(1,2,1)
hpatch1 = patch(isosurface(x,y,z,noisyV,0));
isonormals(x,y,z,noisyV,hpatch1)
set(hpatch1,'FaceColor','red','EdgeColor','none')
daspect([1,4,4])
view([-65,20]) 
axis tight off
camlight left
lighting phong

subplot(1,2,2)
hpatch2 = patch(isosurface(x,y,z,filteredV,0));
isonormals(x,y,z,filteredV,hpatch2)
set(hpatch2,'FaceColor','red','EdgeColor','none')
daspect([1,4,4])
view([-65,20])
axis tight off
camlight left 
lighting phong