用matlab可视化艾克曼漂流螺旋和艾克曼螺线clc,clear%%艾克曼螺线u10=9;v10=10;fai=21;pa=1.205;ro=1024;Az=0.01;w=7.29*10^(-5);z=linspace(-50,0,30);zz=-z;a=sqrt(w*sind(fai)/Az);D0=pi/a;t=pa*sqrt(u10^2+v10^2)*v10;u=t./(sqrt(2).*a.*Az.*ro).*exp(-pi/D0.*zz).*cos(pi./4-pi./D0.*zz);v=t./(sqrt(2).*a.*Az.*ro).*exp(-pi/D0.*zz).*sin(pi./4-pi./D0.*zz);w1=zeros(1,length(v));x=zeros(1,30);y=zeros(1,30);plot3(x,y,z,'red')holdon%a1=length(v),a2=length(w1)quiver3(x,y,z,u,v,w1,0);%axes('position',[0.10.20.30.4]);%axisequalholdon%z0=[-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25-25];z0=(-50).*ones(1,30);quiver3(x,y,z0,u,v,w1,0);title('Ekman螺线')%%*****************************有限深海漂流**********************************clear,clc%%有限深海漂流u10=9;v10=10;fai=21;pa=1.205;u=zeros(1,30);v=zeros(1,30);ro=1024;Az=0.01;w=7.29*10^(-5);a=sqrt(w*sind(fai)/Az);D0=pi/a;hd=[0.1,0.25,0.5,1.25];%hd=h/D0h=D0.*hd;%zz=linspace(-30,0,30);%z=-zz;%深度为0到-50米z1=linspace(0,6,30);z2=linspace(0,15,30);z3=linspace(0,30,30);z4=linspace(0,76,30);z=[z1;z2;z3;z4];t=pa*sqrt(u10^2+v10^2)*v10;%t代表tao;fori=1:4;A=(t./(a.*Az.*ro)).*(cosh(a.*h(i)).*cos(a.*h(i))+sinh(a.*h(i)).*sin(a.*h(i)))./...(cosh(2.*a.*h(i))+cos(2.*a.*h(i)));B=(t./(a.*Az.*ro)).*(cosh(a.*h(i)).*cos(a.*h(i))-sinh(a.*h(i)).*sin(a.*h(i)))./...(cosh(2.*a.*h(i))+cos(2.*a.*h(i)));%A0=t./(a.*Az.*ro);A1=cosh(a.*h(i)).*cos(a.*h(i));%A2=sinh(a.*h(i)).*sin(a.*h(i));A3=cosh(2.*a.*h(i))+cos(2.*a.*h(i));%A=A0.*(A1+A2)./A3%B=A0.*(A1-A2)./A3u=A.*sinh(a.*(h(i)-z(i,:))).*cos(a.*(h(i)-z(i,:)))-B.*cosh(a.*(h(i)-z(i,:))).*sin(a.*(h(i)-z(i,:)));v=A.*cosh(a.*(h(i)-z(i,:))).*sin(a.*(h(i)-z(i,:)))+B.*sinh(a.*(h(i)-z(i,:))).*cos(a.*(h(i)-z(i,:)));plot(u,v);holdon;endtitle('有限深海漂流')