mirror of
https://gitlab.com/lander-team/lander-sim.git
synced 2025-08-02 19:31:28 +00:00
added plot generation for readme
This commit is contained in:
BIN
outputs/Acceleration vs Time.png
Normal file
BIN
outputs/Acceleration vs Time.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
outputs/Altitude vs Time.png
Normal file
BIN
outputs/Altitude vs Time.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
outputs/Altitude.gif
Normal file
BIN
outputs/Altitude.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 516 KiB |
BIN
outputs/Velocity vs Time.png
Normal file
BIN
outputs/Velocity vs Time.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@@ -1,5 +1,12 @@
|
||||
# Lander Landing Simulation
|
||||
|
||||
## Results
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
- Aerospace Toolbox
|
||||
|
@@ -36,6 +36,8 @@ plot(simOut.a)
|
||||
title('Acceleration vs Time')
|
||||
xlabel('Time (s)')
|
||||
ylabel('Acceleration (g''s)')
|
||||
legend('X','Y')
|
||||
saveas(gcf,'outputs/Acceleration vs Time.png')
|
||||
|
||||
% Velocity
|
||||
figure(2)
|
||||
@@ -43,27 +45,58 @@ plot(simOut.v)
|
||||
title('Velocity vs Time')
|
||||
xlabel('Time (s)')
|
||||
ylabel('Velocity (m/s)')
|
||||
legend('X','Y')
|
||||
saveas(gcf,'outputs/Velocity vs Time.png')
|
||||
|
||||
% Altitude
|
||||
figure(3)%k)
|
||||
plot(simOut.h)
|
||||
plot(sqrt(simOut.h.Data(:,2).^2 + simOut.h.Data(:,1).^2), simOut.h.Time)
|
||||
title('Altitude vs Time')
|
||||
% title(['burnStart = ',num2str(burnStart),' s'])
|
||||
xlabel('Time (s)')
|
||||
ylabel('Altitude (m)')
|
||||
saveas(gcf,'outputs/Altitude vs Time.png')
|
||||
|
||||
% Animation
|
||||
figure(4)
|
||||
h = figure(4);
|
||||
K = animatedline('Marker', 'o');
|
||||
axis([0, 2, 0, h_0])
|
||||
title('2-D Animation')
|
||||
xlabel('X-Position (m)')
|
||||
ylabel('Altitde (m)')
|
||||
ylabel('Altitude (m)')
|
||||
title('Altitude')
|
||||
grid on
|
||||
|
||||
|
||||
for i = 1 : length(simOut.h.Data)
|
||||
clearpoints(K);
|
||||
addpoints(K, 1, simOut.h.Data(i, 2));
|
||||
title(sprintf('Altitude at T = %f', simOut.h.Time(i)))
|
||||
drawnow limitrate
|
||||
|
||||
|
||||
% Write Animation to gif, set to zero when testing since its slow to render.
|
||||
outframes = 0;
|
||||
if outframes
|
||||
% Write to the GIF File
|
||||
if i == 1
|
||||
|
||||
% Capture the plot as an image
|
||||
frame = getframe(h);
|
||||
im = frame2im(frame);
|
||||
[imind,cm] = rgb2ind(im,256);
|
||||
|
||||
%initalize plot
|
||||
imwrite(imind,cm,'outputs/Altitude.gif','gif', 'Loopcount',inf);
|
||||
|
||||
elseif mod(i,floor(length(simOut.h.Data)/outframes)) == 0
|
||||
% Capture the plot as an image
|
||||
frame = getframe(h);
|
||||
im = frame2im(frame);
|
||||
[imind,cm] = rgb2ind(im,256);
|
||||
|
||||
% Append to plot
|
||||
imwrite(imind,cm,'outputs/Altitude.gif','gif','WriteMode','append', 'DelayTime', .2);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user