Azzera filtri
Azzera filtri

help me fix the Error

4 visualizzazioni (ultimi 30 giorni)
Jagrut Alpeshbhai
Jagrut Alpeshbhai il 27 Feb 2023
Risposto: John D'Errico il 27 Feb 2023
% Physical constants
mu = 398600.4418; % km^3/s^2
R_E = 6378.137; % km
omega_E = 7.2921158553e-5; % rad/s
% Satellite parameters
e = 0; % Eccentricity
i = 30; % Inclination [deg]
RAAN = 20; % RAAN [deg]
n = sqrt(mu/R_E^3); % Mean motion [rad/s]
h = R_E*sqrt(1-e^2); % Specific angular momentum
a = h^2/mu; % Semi-major axis
% Sensor parameters
nadir_angle = 4; % [deg]
nadir_angle_rad = deg2rad(nadir_angle);
distance_to_earth = R_E + (a*sin(nadir_angle_rad)); % Distance to the point where the sensor line of sight intersects the earth
% NMW Inertial coordinate system
x_NMW = [cosd(RAAN), sind(RAAN), 0]; % x-axis
z_NMW = [0, 0, 1]; % z-axis
y_NMW = cross(z_NMW, x_NMW); % y-axis
% Line-of-sight point of intersection with the Earth as the satellite makes one orbit revolution
theta = linspace(0, 2*pi, 1000);
x = distance_to_earthcos(theta);
y = (acosd(i) + distance_to_earthsin(nadir_angle_rad))*sin(theta);
z = (asind(i))*sin(theta);
% Earth Centered Inertial (ECI) frame
t = linspace(0, 2*pi/n, 1000);
r = [x', y', z'];
v = cross([0, 0, n], r);
eci_states = [r, v];
ECI_path = eci_states(:, 1:3);
plot3(ECI_path(:, 1), ECI_path(:, 2), ECI_path(:, 3))
xlabel('x (km)')
ylabel('y (km)')
zlabel('z (km)')
title('Path of the satellite in ECI frame')
grid on
% Argument of Latitude
lat_30 = 30;
u = atan2d(tand(lat_30), cosd(RAAN));
fprintf('Argument of latitude: %.2f degrees\n', u);
% Earth Centered Earth Fixed (ECEF) frame
GMST = @(t) mod(omega_Et, 2*pi);
ecef_states = zeros(size(eci_states));
for i = 1:size(eci_states, 1)
T = [cos(GMST(t(i))), sin(GMST(t(i))), 0;
-sin(GMST(t(i))), cos(GMST(t(i))), 0;
0, 0, 1];
ecef_states(i, :) = Teci_states(i, :)';
end
ECEF_path = ecef_states(:, 1:3);
figure
plot(ECEF_path(:, 2), ECEF_path(:, 1))
xlabel('Longitude (deg)')
ylabel('Latitude (deg)')
title('Ground track of the satellite in ECEF frame')
hold on
plot(u, lat_30, 'r')
hold off
legend('Ground track', 'Spot beam')
grid on
% Part of the world where the spot beam is hitting
fprintf('The spot beam is hitting the part of the world near %.2f degrees N, %.2f degrees E.\n', lat_30, u);
  3 Commenti
Jagrut Alpeshbhai
Jagrut Alpeshbhai il 27 Feb 2023
Undefined function 'distance_to_earthcos' for input arguments of type
'double'. I'm getting this error
Walter Roberson
Walter Roberson il 27 Feb 2023
distance_to_earthcos and distance_to_earthsin are not function provided by MATLAB. Indeed, I cannot find them anywhere on the internet.

Accedi per commentare.

Risposte (1)

John D'Errico
John D'Errico il 27 Feb 2023
which distance_to_earthcos -all
'distance_to_earthcos' not found.
This function is not a MATLAB function. It is not found in any toolbox either. For that matter, distance_to_earthsin is also not a function in MATLAB.
These functions may have been written by you, or perhaps by someone you know.

Categorie

Scopri di più su Satellite Mission Analysis in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by