%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y=vectavg(speed,dir),
	fact=180./pi;
	u=sin(dir.*1/fact).*speed;
	v=cos(dir.*1/fact).*speed;
	mu=mean(u);
	mv=mean(v);
	msp=sqrt(mu*mu+mv*mv);
	mdr=fact.*atan2(mv,mu);
	if mdr < 0,
		mdr=mdr+360;
	end
y=[msp mdr];
