%mea2mso.m makes two rotations:
%1. Rotates around the z-axis so that the x-axis is parallel to the
%intersection line of the ecliptic and mars orbital plane.
%2. Rotation around the x-axis 1.85 degrees so that the z-axis points
%normal to Mars orbital plane.
%
%Initial version: Niklas Edberg, Swedish Institute of Space Physics, Uppsala, Oct 2005

function [moc] = mea2moc(mea)

    longascnode=49.57854*pi/180;   
    marsorbincl=1.85*pi/180;
     
    mec=ones(size(mea));
    
    T=R(longascnode); %Plus eller minus?
    for i = 1:length(mea)
        mec(:,i) = T*mea(:,i);
    end
    
    moc=ones(size(mec));
    S = P(-marsorbincl);
    for j = 1:length(mec)
        moc(:,j) = S*mec(:,j); 
    end