Home > utilities > naut_2_cart.m

naut_2_cart

PURPOSE ^

convert wind from nautical (speed,direction) to Cartesian (u,v)

SYNOPSIS ^

function [u,v] = naut_2_cart(speed,degT)

DESCRIPTION ^

 convert wind from nautical (speed,direction) to Cartesian (u,v)

 function [u,v] = naut_2_cart(speed,degT)

 DESCRIPTION:
  convert wind from nautical (speed,direction) to Cartesian (u,v)

 INPUT:
   speed:  Wind speed in m/s
   degT:   Wind direction in DEGREES in Nautical sense (=0, North Wind)

 OUTPUT:
    u:     x-direction (East) wind component in m/s
    v:     y-direction (North) wind component in m/s

 EXAMPLE USAGE
    [u,v] = naut_2_cart(10,0)

 Author(s):  
   

 Revision history
   
==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [u,v] = naut_2_cart(speed,degT)
0002 % convert wind from nautical (speed,direction) to Cartesian (u,v)
0003 %
0004 % function [u,v] = naut_2_cart(speed,degT)
0005 %
0006 % DESCRIPTION:
0007 %  convert wind from nautical (speed,direction) to Cartesian (u,v)
0008 %
0009 % INPUT:
0010 %   speed:  Wind speed in m/s
0011 %   degT:   Wind direction in DEGREES in Nautical sense (=0, North Wind)
0012 %
0013 % OUTPUT:
0014 %    u:     x-direction (East) wind component in m/s
0015 %    v:     y-direction (North) wind component in m/s
0016 %
0017 % EXAMPLE USAGE
0018 %    [u,v] = naut_2_cart(10,0)
0019 %
0020 % Author(s):
0021 %
0022 %
0023 % Revision history
0024 %
0025 %==============================================================================
0026 
0027 deg2rad = pi/180;
0028 
0029 angle = (360.0 - degT) + 90.0;
0030 angle = angle*deg2rad;
0031 u = -cos(angle).* speed;
0032 v = -sin(angle).* speed;

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005