g=zeros(m,4);
clear inex ub taubm taucm tauim;
g(:,1)=u10n_f';
g(:,2)=taub_f';
g(:,3)=tauc_f';
g(:,4)=taui_f';
h=sortrows(g,1);

ff=1;
j=1;
for i=1:m
   if floor(h(i,1))>ff
      inex(j)=i;
      j=j+1;
      ff=ff+1;
    	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));
   taubm(i)=median(h(kk:ll,2));
   taucm(i)=median(h(kk:ll,3));
   tauim(i)=median(h(kk:ll,4));
   kk=inex(i);
end;
	
figure;plot(ub,taucm./taubm,'x',ub,tauim./taubm,'o');axis([0 14 .8 1.5]);xlabel('Wind Speed (m/s)');ylabel('Stress Ratio to Bulk');
usc=sqrt(abs(taucm)/1.27);
usb=sqrt(abs(taubm)/1.27);
usi=sqrt(abs(tauim)/1.27);
z0=19./exp(.4*ub./usc);
z0b=19./exp(.4*ub./usb);
z0i=19./exp(.4*ub./usi);

charn=(z0-.11*1.5e-5./usc)*9.83./usc.^2;
charnb=(z0b-.11*1.5e-5./usb)*9.83./usb.^2;
charni=(z0i-.11*1.5e-5./usi)*9.83./usi.^2;


figure;plot(ub,charn./charnb*.011,'x',ub,charni./charnb*.011,'o');axis([0 14 0 0.025]);xlabel('Wind Speed (m/s)');ylabel('Charnock Constant');
