I am using Aerospace toolbox function lambertMR but I'm unable to run this code.
Show older comments
% Define given parameters
R1 = 6378.137 + 300; % Radius of OTV circular orbit (km)
i1 = deg2rad(30); % Inclination of OTV orbit (rad)
omega1 = deg2rad(20); % Argument of periapsis of OTV orbit (rad)
R2 = 6378.137 + 1500; % Radius of Super Station circular orbit (km)
i2 = deg2rad(60); % Inclination of Super Station orbit (rad)
omega2 = deg2rad(40); % Argument of periapsis of Super Station orbit (rad)
t_transfer = 20*60; % Transfer time (s)
uss = deg2rad(76); % Longitude of ascending node of Super Station at transfer time (rad)
mu = 398600.4418; % Earth's gravitational parameter (km^3/s^2)
% Calculate the required Delta-V
[~,~,~,~,v1,v2] = lambertMR(R1,R2,t_transfer,mu,0,0,0,0);
% Calculate the radial and tangential components of Delta-V at transfer initiation and completion
V1_radial = -v1*sin(i1)*cos(omega1);
V1_tangential = v1*(sin(omega1)*cos(i1)*cos(uss) + cos(omega1)*sin(uss));
V2_radial = -v2*sin(i2)*cos(omega2);
V2_tangential = v2*(sin(omega2)*cos(i2)*cos(uss) + cos(omega2)*sin(uss));
% Print the results
fprintf('Delta-V at transfer initiation:\n');
fprintf('Radial component: %.2f km/s\n', V1_radial);
fprintf('Tangential component: %.2f km/s\n\n', V1_tangential);
fprintf('Delta-V at transfer completion:\n');
fprintf('Radial component: %.2f km/s\n', V2_radial);
fprintf('Tangential component: %.2f km/s\n', V2_tangential);
% Calculate the initial, final, and total Delta-V
V1 = norm([V1_radial, V1_tangential]);
V2 = norm([V2_radial, V2_tangential]);
DeltaV = V2 - V1;
% Print the results
fprintf('Initial Delta-V: %.2f km/s\n', V1);
fprintf('Final Delta-V: %.2f km/s\n', V2);
fprintf('Total Delta-V: %.2f km/s\n', DeltaV);
% Plot the transfer orbit
figure();
hold on;
plot3(r1(:,1), r1(:,2), r1(:,3), 'b', 'LineWidth', 2);
plot3(r2(:,1), r2(:,2), r2(:,3), 'r', 'LineWidth', 2);
axis equal;
grid on;
xlabel('x (km)');
ylabel('y (km)');
zlabel('z (km)');
legend('Transfer Orbit', 'Super Station Orbit', 'Location', 'northwest');
Answers (1)
Walter Roberson
on 13 Mar 2023
0 votes
That does not appear to be part of MATLAB.
It looks like possibly it is inside SMAD-Main.zip available from https://download.csdn.net/download/weixin_42133452/16257437 . However I would caution that csdn.net and the older pudn.net should not be blindly used; they have a reputation for malware hidden in the uploads, and an even worse reputation for the files having been uploaded without proper permission.
Categories
Find more on Automotive in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!