source: trunk/FlightData/Navigation/GPSFASER/output/matlab/lib/ecef2enu.m @ 704

Revision 704, 801 bytes checked in by lie, 3 years ago (diff)

GPSFASER - GPS data and C-code for data parsing and MATLAB code (in output/matlab/ folder) for data processing

  • Property svn:executable set to *
Line 
1                function enu = ecef2enu(ecef,ecef_ref)
2%----------------------------------------------------------------------
3%               function enu = ecef2enu(ecef,ecef_ref)
4%
5%   converts a position vector given in ECEF coordinates to a vector in
6%   North, East Down coordinates centered at the coordinates given
7%   by ecef_ref.
8%
9%   Demoz Gebre 12/31/98
10%---------------------------------------------------------------------
11
12lla_ref = ecef2lla(ecef_ref);
13lat = lla_ref(1)*pi/180;
14lon = lla_ref(2)*pi/180;
15lla_ref(3) = 0;
16
17%decef = ecef-lla2ecef(lla_ref);
18decef = ecef;
19
20enu(3,1)= cos(lat)*cos(lon)*decef(1)+cos(lat)*sin(lon)*decef(2)+sin(lat)*decef(3);
21enu(1,1)=-sin(lon)*decef(1) + cos(lon)*decef(2);
22enu(2,1)=-sin(lat)*cos(lon)*decef(1)-sin(lat)*sin(lon)*decef(2)+cos(lat)*decef(3);
Note: See TracBrowser for help on using the repository browser.