SGCUR2CART Transform Seaglider water velocity speed and direction estimates to eastward and northward components. Syntax: [EASTWARD, NORTHWARD] = SGCUR2CART(SPEED, DIRECTION) Description: [EASTWARD, NORTHWARD] = SGCUR2CART(SPEED, DIRECTION) computes the eastward and northward components of the sea water velocity (m s-1) from magnitude and direction estimates in SPEED (m s-1) and DIRECTION (degrees) provided by Seaglider gliders. All arguments are the same size. Notes: This is just a convenience function to give a name to the conversion. It is a shortcut to the built-in polar to cartesian conversion, POL2CART, with needed angular unit conversion and order shift of output arguments. Examples: [eastward, northward] = sgcur2cart(speed, direction) See also: POL2CART Authors: Joan Pau Beltran <joanpau.beltran@socib.cat>
0001 function [eastward, northward] = sgcur2cart(speed, direction) 0002 %SGCUR2CART Transform Seaglider water velocity speed and direction estimates to eastward and northward components. 0003 % 0004 % Syntax: 0005 % [EASTWARD, NORTHWARD] = SGCUR2CART(SPEED, DIRECTION) 0006 % 0007 % Description: 0008 % [EASTWARD, NORTHWARD] = SGCUR2CART(SPEED, DIRECTION) computes the eastward 0009 % and northward components of the sea water velocity (m s-1) from magnitude 0010 % and direction estimates in SPEED (m s-1) and DIRECTION (degrees) 0011 % provided by Seaglider gliders. All arguments are the same size. 0012 % 0013 % Notes: 0014 % This is just a convenience function to give a name to the conversion. 0015 % It is a shortcut to the built-in polar to cartesian conversion, POL2CART, 0016 % with needed angular unit conversion and order shift of output arguments. 0017 % 0018 % Examples: 0019 % [eastward, northward] = sgcur2cart(speed, direction) 0020 % 0021 % See also: 0022 % POL2CART 0023 % 0024 % Authors: 0025 % Joan Pau Beltran <joanpau.beltran@socib.cat> 0026 0027 % Copyright (C) 2014-2016 0028 % ICTS SOCIB - Servei d'observacio i prediccio costaner de les Illes Balears 0029 % <http://www.socib.es> 0030 % 0031 % This program is free software: you can redistribute it and/or modify 0032 % it under the terms of the GNU General Public License as published by 0033 % the Free Software Foundation, either version 3 of the License, or 0034 % (at your option) any later version. 0035 % 0036 % This program is distributed in the hope that it will be useful, 0037 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0038 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0039 % GNU General Public License for more details. 0040 % 0041 % You should have received a copy of the GNU General Public License 0042 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0043 0044 error(nargchk(2, 2, nargin, 'struct')); 0045 0046 [northward, eastward] = pol2cart(deg2rad(direction), speed); 0047 0048 end