function Y = frame_moon_earth(Yin,t,parametro)                             % se 1 da terra a luna, 2 inv

% condizione di default
if nargin < 3
    parametro = 1;
end
if parametro == 1
    for i = 1:length(t)
    C = cspice_sxform('j2000','MOON_ME',t(i)); 
    s_moon = cspice_spkezr('moon',t(i),'j2000','none','earth');
    Y(i,:) =  (C*(Yin(i,:)'-s_moon))';
    end
else
    for i = 1:length(t)
        C = cspice_sxform('MOON_ME','j2000',t(i));
        s_moon = cspice_spkezr('moon',t(i),'j2000','none','earth');
        Y(i,:) =  (C*(Yin(i,:)')+s_moon)';
    end
end

