clc
clear 
close all
load_kernels

X = [8e3,4e3,-3e3,3,1,1]';
dV1 = circolarizzazione(X);

state1 = [X(1:3);X(4:6)+dV1];
kep = state2kep(state1);
inc1 = kep(3)*180/pi;
[s,T] = kep2state(kep);

[tt,Y] = int_eqmoto(state1,0,T,1,4);

dV2 = circolarizzazione(X,1,0,40);

state2 = [X(1:3);X(4:6)+dV2];
kep2 = state2kep(state2);
inc2 = kep(3)*180/pi;
[s,T] = kep2state(kep2);

[tt2,Y2] = int_eqmoto(state2,0,T,1,4);

figure
plot3(Y(:,1),Y(:,2),Y(:,3))
hold on
grid on
plot_earth_moon(1);
quiver3(state1(1),state1(2),state1(3),state1(4)*1e3,state1(5)*1e3,state1(6)*1e3)
quiver3(state1(1),state1(2),state1(3),state2(4)*1e3,state2(5)*1e3,state2(6)*1e3)
plot3(X(1),X(2),X(3),'Marker','o')
plot3(Y2(:,1),Y2(:,2),Y2(:,3))
axis equal

