%Transforms meo(xyz) coordinates into mrx
%
%Initial version: Niklas Edberg, Swedish Institute of Space Physics, Uppsala, Oct 2005

function [mrx] = meo2mrx(meo,jd)

    mrx=ones(size(meo));    % declare the variabel before to speed up the loop!

    d=jd-2451454;                        % Time in julian days from J2000
    omega = 176.634 + 350.89198226.*d;    % Angle from inertial system to prime meridian
                                          %through Airy-0 (Mars answer to the Greenwich prime
                                          %median). Taken from Duxbury et al.
    for i=1:length(meo)
        T=R(-omega(i).*pi./180); %negative roatation
        mrx(:,i)=T*meo(:,i);  % rosettas coord
    end