unable to use Aerospace Blockset function eci2ecef

조회 수: 8 (최근 30일)
Eduardo Rodrigues Silva Filho
Eduardo Rodrigues Silva Filho 2020년 3월 27일
댓글: lai 2023년 8월 24일
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

채택된 답변

Divya Yerraguntla
Divya Yerraguntla 2020년 3월 30일
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!

추가 답변 (1개)

Seth Wagenman
Seth Wagenman 2020년 9월 3일
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).

카테고리

Help CenterFile Exchange에서 Unit Conversions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by