程序如下(其中xyz是一个588行的EXCEL文件):
A=xlsread('E:\yz.xls');
for i=1:6
for j=1:7
for k=1:14
U(i,k,j)=A(98*(i-1)+7*(j-1)+k,4);
V(i,k,j)=A(98*(i-1)+7*(j-1)+k,7);
W(i,k,j)=A(98*(i-1)+7*(j-1)+k,10);
end
end
end
[X,Y,Z]=meshgrid(1:14,1:6,1:7);
xmin=min(X(:));
xmax=max(X(:));
ymin=min(Y(:));
ymax=max(Y(:));
zmin=min(Z(:));
zmax=max(Z(:));
daspect([1,1,1]);
xrange=linspace(xmin,xmax,1);
yrange=linspace(ymin,ymax,1);
zrange=linspace(zmin,zmax,1);
[cx,cy,cz]=meshgrid(1:xrange,1:yrange,1:zrange);
hcones=coneplot(X,Y,Z,U,V,W,cx,cy,cz,1.8);
set(hcones,'FaceColor','red','EdgeColor','none');
hold on;
wind_speed=sqrt(U.^2+V.^2+W.^2);
hsurfaces=slice(X,Y,Z,wind_speed,[xmin,xmax],ymax,zmin);
hold off;
axis tight;view(30,40);axis off;
camproj perspective;camzoom(1.5);
camlight right;lighting phong;
set(hsurfaces,'AmbientStrength',.6);
set(hcones,'DiffuseStrength',.8);
grid on;
[ 本帖最后由 lxq 于 2006-10-13 15:51 编辑 ] |