0
이것은 발사체 모션 그래프입니다. 그래프를 그리기 전까지 전체 계산을 포함 시켰습니다. 계산 부분 다음에 코드를 사용하여 그래프의 설정을 변경하는 방법을 알지 못합니다. this is what i've plotted using this code below은 그래프의 그래프를 그래프에 완전히 포함 할 수 없습니다. 그래프의 절반 만 보여줍니다.
time = linspace(0, t, 1000);
legends = {}; % Instantiate an empty cell for the angle legend.
counter = 1;
for A = 10: 10 : 90
% Get the components of velocity in the x and y directions for this angle.
vx = v*cosd(A);
vy = v*sind(A);
% Compute the distance along the x direction. x = x0 + x_velocity * time.
xfinal = vx * time;
% Compute the distance along the y direction. y = y0 + y_velocity_initial *
%time + (1/2)*g*time^2
yfinal = vy * time + (1/2) * 9.81 * time .^ 2;
% Clip y to zero because we assume the projectile stays on the ground when
%it hits.
% It does not penetrate and have a negative y.
yfinal(yfinal < 0) = 0;
indexHitGround = find(yfinal > 0, 1, 'last');
fontSize=10
plot(xfinal, yfinal, '-', 'LineWidth', 2);
hold on;
legends{end+1} = sprintf('Angle = %d', A);
% Calculate the range in the x direction.
xFinal(counter) = xfinal(indexHitGround);
counter = counter + 1;
end
grid on;
xlabel('X Coordinate', 'FontSize', fontSize);
ylabel('Y Coordinate', 'FontSize', fontSize);
title ('Projectile Trajectory', 'FontSize', fontSize)
legend(legends);
% Find the max xFinal and set the range of the graph to be that.
xlim([0, max(xFinal)]);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0.2, 0.3, 0.8, 0.7]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Projectile Trajectory Demo Part 2', 'NumberTitle', 'Off')
난 당신이 내 코드에서 오류를 지적하거나 나에게 줄 것인지 정말 감사하겠습니다 그래서 MATLAB에에 내가 초보자이야이 projectile trajectory
같은 것을 그릴려고 반면, 몇 가지 제안. 감사!