ENU2UVW convert from ENU to UVW coordinates

Contents

Inputs

outputs

function [u,v,w] = enu2uvw(east,north,up,lat0,lon0,angleUnit)
arguments
  east {mustBeReal}
  north {mustBeReal}
  up {mustBeReal}
  lat0 {mustBeReal}
  lon0 {mustBeReal}
  angleUnit (1,1) string = "d"
end

if startsWith(angleUnit, 'd')
  lat0 = deg2rad(lat0);
  lon0 = deg2rad(lon0);
end

t = cos(lat0) * up - sin(lat0) * north;
w = sin(lat0) * up + cos(lat0) * north;

u = cos(lon0) * t - sin(lon0) * east;
v = sin(lon0) * t + cos(lon0) * east;

end