summaryrefslogtreecommitdiff
path: root/inst/ecef2aer.m
diff options
context:
space:
mode:
Diffstat (limited to 'inst/ecef2aer.m')
-rw-r--r--inst/ecef2aer.m23
1 files changed, 10 insertions, 13 deletions
diff --git a/inst/ecef2aer.m b/inst/ecef2aer.m
index 1d68623..f694ec8 100644
--- a/inst/ecef2aer.m
+++ b/inst/ecef2aer.m
@@ -1,6 +1,6 @@
-## Copyright (C) 2014-2020 Michael Hirsch, Ph.D.
-## Copyright (C) 2013-2020 Felipe Geremia Nievinski
-## Copyright (C) 2020 Philip Nienhuis
+## Copyright (C) 2014-2022 Michael Hirsch, Ph.D.
+## Copyright (C) 2013-2022 Felipe Geremia Nievinski
+## Copyright (C) 2020-2022 Philip Nienhuis
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
@@ -114,6 +114,9 @@ function [az, el, slantRange] = ecef2aer (varargin)
spheroid = varargin{7};
angleUnit = varargin{8};
endif
+ if (isnumeric (spheroid))
+ spheroid = num2str (spheroid);
+ endif
x = varargin{1};
y = varargin{2};
@@ -137,8 +140,8 @@ function [az, el, slantRange] = ecef2aer (varargin)
if (! all (size (lat0) == size (x)) || ...
! all (size (lon0) == size (y)) || ...
! all (size (alt0) == size (z)))
- error ("ecef2aer: non-matching dimensions of observer points and \
-target points");
+ error (["ecef2aer: non-matching dimensions of observer points and ", ...
+ "target points"]);
endif
endif
@@ -146,15 +149,9 @@ target points");
error ("ecef2aer: angleUnit should be one of 'degrees' or 'radians'")
endif
- if (isempty (spheroid))
- E = wgs84Ellipsoid;
- elseif (isstruct (spheroid))
- E = spheroid;
- else
- E = referenceEllipsoid (spheroid);
- endif
+ E = sph_chk (spheroid);
- [e, n, u] = ecef2enu (x, y, z, lat0, lon0, alt0, spheroid, angleUnit);
+ [e, n, u] = ecef2enu (x, y, z, lat0, lon0, alt0, E, angleUnit);
[az, el, slantRange] = enu2aer (e, n, u, angleUnit);
endfunction