%Regner ut midlere hastighte fra Toricellis lov
function[] = Tori(tf)
  data=load(tf);
  lengder=size(data);n=lengder(1);
  if n < 3;
      'feil'
       return;
  end      
  
  tsum=0.0;
  for i=3:n;
    tsum=tsum+data(i);
  end  
  
  t=tsum/(n-2); h1=data(1);h2=data(2);
  D=0.17;d=0.01;f=D*D/(d*d);
  g=9.81;
  vobs=f*(h1-h2)/t;
  v1=sqrt(2*g*h1);v2=sqrt(2*g*h2);
  vmid=0.5*(v1+v2);avvik=100*(vobs-vmid)/vobs;
  sprintf('%s%.3f%s%.3f%s%.3f%s%.3f%s%.3f%s','t=',t,',  vobs=',vobs,', v1=',v1,', v2=',v2,', avvik(%)=',avvik)