www.gusucode.com > Matlab精彩编程100例源码程序 > Matlab精彩编程100例源码/work/shili77.m

    h0=figure('toolbar','none',...
    'position',[198 56 450 468],...
    'name','实例77');
h1=axes('parent',h0,...
    'position',[0.3 0.45 0.5 0.5],...
    'visible','off');
load wind
b1huidiao=[...
        'cla,',...
        'xmin = min(x(:));,',...
        'xmax = max(x(:));,',...
        'ymax = max(y(:));,',...
        'zmin = min(z(:));,',...
        'wind_speed = sqrt(u.^2 + v.^2 + w.^2);,',...
        'hsurfaces = slice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin);,',...
        'set(hsurfaces,''FaceColor'',''interp'',''EdgeColor'',''none''),',...
        'hcont = contourslice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin);,',...
        'set(hcont,''EdgeColor'',[.7,.7,.7],''LineWidth'',.5),',...
        '[sx,sy,sz] = meshgrid(80,20:10:50,0:5:15);,',...
        'hlines = streamline(x,y,z,y,v,w,sx,sy,sz);,',...
        'set(hlines,''LineWidth'',2,''Color'',''r''),',...
        'view(3),',...
        'daspect([2,2,1]),',...
        'axis tight'];
b2huidiao=[...
        'cla,',...
        'wind_speed = sqrt(u.^2 + v.^2 + w.^2);,',...
        'hiso = patch(isosurface(x,y,z,wind_speed,40));,',...
        'isonormals(x,y,z,wind_speed,hiso),',...
        'set(hiso,''FaceColor'',''red'',''EdgeColor'',''none'');,',...
        'hcap = patch(isocaps(x,y,z,wind_speed,40),''FaceColor'',''interp'',''EdgeColor'',''none'');,',...
        'colormap hsv,',...
        'daspect([1,1,1]);,',...
        '[f verts] = reducepatch(isosurface(x,y,z,wind_speed,30),0.07);,',...
        'h1 = coneplot(x,y,z,u,v,w,verts(:,1),verts(:,2),verts(:,3),3);,',...
        'set(h1,''FaceColor'',''blue'',''EdgeColor'',''none'');,',...
        'xrange = linspace(min(x(:)),max(x(:)),10);,',...
        'yrange = linspace(min(y(:)),max(y(:)),10);,',...
        'zrange = 3:4:15;,',...
        '[cx,cy,cz] = meshgrid(xrange,yrange,zrange);,',...
        'h2 = coneplot(x,y,z,u,v,w,cx,cy,cz,2);,',...
        'set(h2,''FaceColor'',''green'',''EdgeColor'',''none'');,',...
        'axis tight,',...
        'box on,',...
        'camproj perspective,',...
        'camzoom(1.25),',...
        'view(65,45),',...
        'camlight(-45,45),',...
        'lighting phong,',...
        'set(hcap,''AmbientStrength'',.6)'];
b1=uicontrol('parent',h0,...
    'style','pushbutton',...
    'units','points',...
    'tag','b1',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'string','可视化',...
    'position',[50 100 60 20],...
    'callback',b1huidiao);
b2=uicontrol('parent',h0,...
    'style','pushbutton',...
    'units','points',...
    'tag','b2',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'string','锥形图',...
    'position',[200 100 60 20],...
    'callback',b2huidiao);
b3=uicontrol('parent',h0,...
    'style','pushbutton',...
    'units','points',...
    'tag','b3',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'string','关闭',...
    'position',[125 60 60 20],...
    'callback','close');