#include <iostream>
#include <cmath>
#include <iomanip>
// Constants
const double PI = 3.141592653589793;
const double ORBIT_RADIUS = 1000.0; // Radius of the orbit in kilometers
const double ORBIT_PERIOD = 3600.0; // Orbit period in seconds (e.g., 1 hour)
// Function to calculate the satellite's position based on time
void calculatePosition(double time, double& x, double& y) {
double angularVelocity = 2 * PI / ORBIT_PERIOD;
double angle = angularVelocity * time;
x = ORBIT_RADIUS * std::cos(angle);
y = ORBIT_RADIUS * std::sin(angle);
}
int main() {
// Simulation parameters
double startTime = 0.0; // Start time in seconds
double endTime = 7200.0; // End time in seconds (e.g., 2 hours)
double timeStep = 600.0; // Time step in seconds (e.g., 10 minutes)
std::cout << "Time (s)\tX Position (km)\tY Position (km)\n";
std::cout << "----------------------------------------------\n";
// Run the simulation
for (double time = startTime; time <= endTime; time += timeStep) {
double x, y;
calculatePosition(time, x, y);
std::cout << std::fixed << std::setprecision(2) << time << "\t\t"
<< std::fixed << std::setprecision(2) << x << "\t\t"
<< std::fixed << std::setprecision(2) << y << "\n";
}
return 0;
}