unable to use Aerospace Blockset function eci2ecef

13 views (last 30 days)
Hi, I need to a function to transform acceleration data from ECI to ECEF frame and I found this function on Aerospace Blockset which does exactly what I need (https://www.mathworks.com/help/aeroblks/eci2ecef.html). However, I was unable to use it within a normal matlab script. I tried one of the example codes from the help center:
r_eci = [-2981784 5207055 3161595];
utc = [2019 1 4 12 0 0];
mjd = mjuliandate(utc);
pm = polarMotion(mjd, 'action', 'none')*180/pi;
r_ecef = eci2ecef(utc, r_eci, 'pm', pm)
And I got the following error:
Unrecognized function or variable 'eci2ecef'.
Is it possible to use this function outiside of Simulink in a normal script? Does anyone knows a good replacement for this function?
Thanks

Accepted Answer

Divya Yerraguntla
Divya Yerraguntla on 30 Mar 2020
Hi Eduardo,
The "eci2ecef" is part of the set of function in CubeSats hence the function requires the 'Aerospace Blockset CubeSat Simulation Library' Add-on support package. You could download this from the Add-ons manager.
Hope it helps!

More Answers (1)

Seth Wagenman
Seth Wagenman on 3 Sep 2020
Try importing Python's pymap3d package and using it instead as described at:
Unfortunately, you have to convert your MATLAB datetime objects to datenum and then do some math on them before passing over to Python, as described here:
The Python astropy package is the basis for the coordinate transformations and it works quite well. It is a bit slow and I recommend installing the MATLAB API for Python and using a custom Python function which returns MATLAB data objects instead of numpy arrays, which will then require extra conversion within MATLAB anyway before you can use them; see this answer for a work-around if you do not have administrative privileges:
Hope it works! I would love a comparison between what MATLAB spits out for Null Island's ECI coordinates on January 1, 2000 at noon UTC (using the leap seconds option) to compare. The python code returns (1158174.7900579234, -6272101.938428859, -143.09802467421062).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by