g=zeros(ix-1,6);
clear inex ub ce10m ceqm cenbm zom us2m;
g(:,1)=u;
g(:,2)=ce10;
g(:,3)=ceq;
g(:,4)=cenb';
g(:,5)=zo;
g(:,6)=us2;
h=sortrows(g,1);
%h(1750,3)=1.4;h(1750,4)=1.4;
%h(1752,3)=1.4;h(1752,4)=1.4;

ff=1;
j=1;
for i=1:ix-1
   if floor(h(i,1))>ff
      inex(j)=i;
      j=j+1;
      ff=ff+2;
    	if j==12;ff=ff+2;end;
   end;
end;
kk=1;
for i=1:j-1
   ll=inex(i)-1;
   ub(i)=median(h(kk:ll,1));
   ce10m(i)=median(h(kk:ll,2));
   ceqm(i)=median(h(kk:ll,3));
   cenbm(i)=median(h(kk:ll,4));
   zom(i)=median(h(kk:ll,5));
   us2m(i)=median(h(kk:ll,6));
   kk=inex(i);
end;

figure;plot(ub,ce10m,'x',ub,ceqm,'o',u,cenb,'.');axis([0 12 0.001 .0015]);xlabel('Wind Speed (m/s)');ylabel('C_{en}');
Title('COARE 2.6; x=CQ, o=Cq');
rr=sqrt(us2m).*zom/1.5e-5;
z0qm=10./exp(.16./ceqm./log(10./zom));

   