Example codes that may be useful follow.
looporbel_to_posvel
matlab code.
ma_to_ea
matlab code.