clear, close all, % Constantes % escala_tiempo = 1; % Coeficiente multiplicado a las velocidades y aceleraciones, para acelerar la simulación % UN VALOR MUY ALTO PUEDE HACER QUE LA SIMULACIÓN NO FUNCIONE CORRECTAMENTE ciclos = 50000; % Duración en ciclos de la simulación G = 6.674*(10^-11); % (m^3)/(kg*(s^2)) masa_tierra = 5.974*(10^24); % kg mu_tierra = G*masa_tierra; radio_tierra = 6350000; % m sat = 1; switch sat case 1, % ISS distancia = 40000000; masa = 14000; velocidad = 1500; graf = 45000000; end % Valores iniciales del satélite elegido % SAT(1,1) = radio_tierra+distancia; % m SAT(1,2) = 0; SAT(1,3) = 0; masa_satelite = masa; % kg angulin = 65*pi/180; SAT(1,1) = radio_tierra+distancia*cos(angulin); SAT(1,2) = 0; SAT(1,3) = radio_tierra+distancia*sin(angulin); % m SAT(2,1) = 0; % m/s SAT(2,2) = velocidad; % m/s SAT(2,3) = 0; SAT(1,3) = 0; SAT(1,2) = 0; SAT(1,1) = radio_tierra+distancia; % m SAT(2,1) = 0; % m/s SAT(2,2) = velocidad; % m/s SAT(2,3) = 0; % +-------------------------------+ % % |---- Comienza el graficado ----| % % +-------------------------------+ % figure xlabel('metros'); ylabel('metros'); title(['Análisis de órbita']); % dibujo la Luna al simular el TLI %plot(-363000000,0,'O') % Dibujo la Tierra % R=radio_tierra;X0=0;Y0=0;Z0=0;[Xs,Ys,Zs]=sphere;Xs=Xs*R+X0;Ys=Ys*R+Y0;Zs=Zs*R+Z0;surf(Xs,Ys,Zs) grid off t = linspace(0,2*pi,1000); x = radio_tierra*cos(t); y = radio_tierra*sin(t); y = radio_tierra*sin(t); hold on; %fill(x,y,'c'); %text(-1000000,0,'Tierra') % Dibujo 4 puntos para hacer cuadrado al gráfico % plot3(graf,graf,graf,'.'); plot3(-graf,-graf,graf,'.'); plot3(-graf,graf,graf,'.'); plot3(-graf,-graf,-graf,'.'); plot3(graf,-graf,-graf,'.'); plot3(graf,-graf,graf,'.'); plot3(-graf,graf,-graf,'.'); plot3(graf,graf,-graf,'.'); xlabel('x [m]'); ylabel('y [m]'); zlabel('z [m]'); % Dibujo la órbita % for ciclo=0:ciclos hold on plot3(SAT(1,1),SAT(1,2),SAT(1,3),'.') % Calculo nuevas posiciones SAT(1,1) = SAT(1,1) + SAT(2,1)*escala_tiempo; SAT(1,2) = SAT(1,2) + SAT(2,2)*escala_tiempo; SAT(1,3) = SAT(1,3) + SAT(2,3)*escala_tiempo; % Calculo distancia al centro de la Tierra y verifico que no se haya estrellado distancia = sqrt((SAT(1,2)^2)+(SAT(1,1)^2)+(SAT(1,3)^2)); if (distancia