VMT_VelVectMagDir

PURPOSE ^

Computes the magnitude and direction of velocity vectors given the east

SYNOPSIS ^

function [xo,yo,mag,dir] = VMT_VelVectMagDir(xi,yi,Veast,Vnorth)

DESCRIPTION ^

 Computes the magnitude and direction of velocity vectors given the east
 velocity and north velocity at specified points.  Positions x and y of
 the observations are passed through.

 P.R. Jackson, USGS, 1-15-09

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xo,yo,mag,dir] = VMT_VelVectMagDir(xi,yi,Veast,Vnorth)
0002 % Computes the magnitude and direction of velocity vectors given the east
0003 % velocity and north velocity at specified points.  Positions x and y of
0004 % the observations are passed through.
0005 %
0006 % P.R. Jackson, USGS, 1-15-09
0007 
0008 %Compute the magnitude
0009 
0010 mag = sqrt(Veast.^2 + Vnorth.^2);
0011 
0012 %Determine the quadrant
0013 indx1 = find(Veast >= 0 & Vnorth >= 0);
0014 indx2 = find(Veast >= 0 & Vnorth <= 0);
0015 indx3 = find(Veast <= 0 & Vnorth <= 0);
0016 indx4 = find(Veast <= 0 & Vnorth >= 0);
0017 
0018 %Compute the direction in degrees from north (+CW)
0019 dir = zeros(size(Veast));
0020 
0021 dir(indx1) = 90    - atand(abs(Vnorth(indx1)./Veast(indx1)));
0022 dir(indx2) = 180   - atand(abs(Veast(indx2)./Vnorth(indx2)));
0023 dir(indx3) = 270   - atand(abs(Vnorth(indx3)./Veast(indx3)));
0024 dir(indx4) = 360   - atand(abs(Veast(indx4)./Vnorth(indx4)));
0025 
0026 %Pass position through
0027 
0028 xo = xi;
0029 yo = yi;

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005