%CDS301
%example of stream plots
%use Matlab build-in wind data
%combine the methods of "slice", "contourslice","streamline"

clear; clf

%load the 3-D vector data
load wind

%find the limit
xmin=min(x(:));
xmax=max(x(:));
ymax=max(y(:));
zmin=min(z(:));

%total wind speed
wind_speed=sqrt(u.^2+v.^2+w.^2);

%draw slice
hsurface=slice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin)

%add contour lines onto the slices
hcont=contourslice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin)
set(hcont,'EdgeColor',[0.7,0.7,0.7],'LineWidth',0.5)

%define the starting points for stream lines
[sx,sy,sz]=meshgrid(80,20:10:50,0:5:15);
hlines=streamline(x,y,z,u,v,w,sx,sy,sz);
set(hlines,'LineWidth',2,'Color','r')

%define the view
view(3)
daspect([2,2,1])
axis tight




