Subject Computer Science MATLAB for Computer Science

Question

See Question.pdf, data2.txt, data3.txt, data4.txt and trajectory.m

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

% This script calculates the trajectory of a ballistic projectile.
% Assumptions:
%   Projectile starts at location (0,0) in the x-y plane
%   Initial velocity is 125 m/s at a 60 degree angle to the horizontal
%   No air resistance
%   Flat surface

clc

% Ballistic projectile equations:
%   x(t) = 1/2*ax*t^2 + vx*t + x0
%   y(t) = 1/2*ay*t^2 + vy*t + y0

% Initialize variables with physical values
g = 9.81;    % m/s^2 (gravitational constant)
theta = 60; % degrees (projectile launch angle)
v0 = 125;    % m/s (projectile launch speed)

ax = 0;      % m/s^2 (assume no acceleration in x direction)
ay = -g;    % m/s^2 (assume only gravity affects projectile)

vx = v0 * cosd(theta); % m/s (component of velocity in x direction)
vy = v0 * sind(theta); % m/s (component of velocity in y direction)

x0 = 0;      % m (initial projectile x coordinate)
y0 = 0;      % m (initial projectile y coordinate)

% ***** Determine maximum projectile range *****

% Find t at which y(t) is zero.
%   0 = 1/2*ay*t^2 + vy*t + y0
%   0 = t*(1/2*ay*t+vy)...

This is only a preview of the solution. Please use the purchase button to see the entire solution

$48.00

or $1 if you
register a new account!

Related Homework Solutions

Get help from a qualified tutor
Live Chats