The following code plots the ground coverage of an satellite orbiting the earth. Can you give me the code to figure out how much time does the building have coverage from the satellite everyday? Please make sure the code gives a reasonable answer % At the initial time, the true anomaly is equal to zero, % and the Greenwich meridian points to the Aries point. % Initial conditions omega_earth = rad2deg(7.2921151467e-5); % deg/s semi_major_axis = 3096.7363; % km eccentricity = 0.74; inclination = 63.4349; % degrees RAAN = -86.915798; % degrees argument_of_perigee = 270; % degrees n_points = 100; % number of points cone_angle = 10; % degrees % Building coordinates building_latitude = 40.43094; % degrees building_longitude = -86.915798; % degrees % Calculate time vector over one orbital period orbital_period = 360 / omega_earth; time_vector = linspace(0, orbital_period, n_points); % Preallocate arrays for orbital elements true_anomaly = zeros(1, n_points); longitude = zeros(1, n_points); latitude = zeros(1, n_points); % Calculate orbital elements at each time step for i = 1:n_points true_anomaly(i) = 2 * atand(sqrt((1 + eccentricity) / (1 - eccentricity)) * tand(0.5 * sqrt(1 - eccentricity) * omega_earth * time_vector(i))); radius = semi_major_axis * (1 - eccentricity^2) / (1 + eccentricity * cosd(true_anomaly(i))); x_orbital_plane = radius * cosd(true_anomaly(i)); y_orbital_plane = radius * sind(true_anomaly(i)); % Transformation to ECI coordinates x_eci = x_orbital_plane * cosd(argument_of_perigee) - y_orbital_plane * sind(argument_of_perigee); y_eci = x_orbital_plane * sind(argument_of_perigee) + y_orbital_plane * cosd(argument_of_perigee); z_eci = y_orbital_plane * sind(inclination); % Calculate longitude and latitude longitude(i) = atan2d(y_eci, x_eci); latitude(i) = asind(z_eci / radius); end % Plot the ground-track figure; plot(longitude, latitude, 'b-', 'LineWidth', 1.5); hold on; % Plot the building location plot(building_longitude, building_latitude, 'ro', 'MarkerSize', 10, 'MarkerFaceColor', 'r'); % Set axis labels and title xlabel('Longitude (degrees)'); ylabel('Latitude (degrees)'); title('Ground-Track of the Orbit'); % Display legend legend('Ground-Track', 'Building Location'); % Set grid grid on; % Show the plot hold off;
The following code plots the ground coverage of an satellite orbiting the earth. Can you give me the code to figure out how much time does the building have coverage from the satellite everyday? Please make sure the code gives a reasonable answer
% At the initial time, the true anomaly is equal to zero,
% and the Greenwich meridian points to the Aries point.
% Initial conditions
omega_earth = rad2deg(7.2921151467e-5); % deg/s
semi_major_axis = 3096.7363; % km
eccentricity = 0.74;
inclination = 63.4349; % degrees
RAAN = -86.915798; % degrees
argument_of_perigee = 270; % degrees
n_points = 100; % number of points
cone_angle = 10; % degrees
% Building coordinates
building_latitude = 40.43094; % degrees
building_longitude = -86.915798; % degrees
% Calculate time
orbital_period = 360 / omega_earth;
time_vector = linspace(0, orbital_period, n_points);
% Preallocate arrays for orbital elements
true_anomaly = zeros(1, n_points);
longitude = zeros(1, n_points);
latitude = zeros(1, n_points);
% Calculate orbital elements at each time step
for i = 1:n_points
true_anomaly(i) = 2 * atand(sqrt((1 + eccentricity) / (1 - eccentricity)) * tand(0.5 * sqrt(1 - eccentricity) * omega_earth * time_vector(i)));
radius = semi_major_axis * (1 - eccentricity^2) / (1 + eccentricity * cosd(true_anomaly(i)));
x_orbital_plane = radius * cosd(true_anomaly(i));
y_orbital_plane = radius * sind(true_anomaly(i));
% Transformation to ECI coordinates
x_eci = x_orbital_plane * cosd(argument_of_perigee) - y_orbital_plane * sind(argument_of_perigee);
y_eci = x_orbital_plane * sind(argument_of_perigee) + y_orbital_plane * cosd(argument_of_perigee);
z_eci = y_orbital_plane * sind(inclination);
% Calculate longitude and latitude
longitude(i) = atan2d(y_eci, x_eci);
latitude(i) = asind(z_eci / radius);
end
% Plot the ground-track
figure;
plot(longitude, latitude, 'b-', 'LineWidth', 1.5);
hold on;
% Plot the building location
plot(building_longitude, building_latitude, 'ro', 'MarkerSize', 10, 'MarkerFaceColor', 'r');
% Set axis labels and title
xlabel('Longitude (degrees)');
ylabel('Latitude (degrees)');
title('Ground-Track of the Orbit');
% Display legend
legend('Ground-Track', 'Building Location');
% Set grid
grid on;
% Show the plot
hold off;
Trending now
This is a popular solution!
Step by step
Solved in 4 steps