Question: The goal of this assignment is to plot the trajectory of a projectile given an initial launch velocity and angle. It will require user inputs
The goal of this assignment is to plot the trajectory of a projectile given an initial launch velocity and angle.
It will require user inputs for initial velocity ms and angle degrees time step definition, and plotting of
projectile path vertical distance vs horizontal distance Additionally, identify the maximum altitude and
horizontal distance traveled. You will write code for this assignment in Python and Matlab.
Python Instructions
points Create user inputs for initial velocity and launch angle and set equal to variables V
and angle Define a variable g for gravity constant g ms
points Define time step using numpy.linspaceex: timestep numpy.linspace This will
create a time step array for the present problem definition. I suggest using seconds as a starting
point and adjust as needed. You will need to adjust your code to handle large velocities, so a
larger timestep will be needed. Your code should be able to accept and process such extreme
velocity and launch angles, eg ms @ deg angle, etc
points Using kinematic equations, determine the horizontal and vertical positions for the
projectile. Remember to convert from degrees to radians when using math.sin and math.cos
etc.
hPos Vcosangletimestep
vPos Vsinangletimestep gtimestep
points Determine the maximum altitude achieve using:
vMax maxvPos
points Determine the maximum horizontal distance traveled before projectile hits ground
level. Use the following equations:
time Vsinangleg
hMax Vcosangletime
points Plot the projectile path, vMax, hMax using pltplot Use linemarker styling as needed.
Add axis labels and title, adjust axis boundaries as needed.
Matlab Instructions
points Create user inputs for initial velocity and launch angle and set equal to variables V
and angleex: V inputEnter initial velocity in ms: Also define gravity by: g
points Define time step start:step:endex: timestep :: will create a timestep array
of I suggest using :: as a starting point and adjust as needed.
points Using kinematic equations, determine the horizontal and vertical positions for the
projectile.
hPos Vcosdangletimestep
vPos Vsindangletimestep gtimestep
Note: use when squaring individual values from the timestep array.
points Determine the maximum altitude achieve using:
vMax maxvPos
Note: max is a function built into Matlab.
points Determine the maximum horizontal distance traveled before projectile hits ground
level. Use the following equations:
time Vsindangleg
hMax Vcosdangletime
points Plot the projectile path, vMax, hMax using plot Use linemarker styling as needed.
Add axis labels and title, adjust axis boundaries as needed. Example:
plothPosvPos,bhMax,rXhMaxvMax,rX'LineWidth', 'MarkerSize',
xlabelHorizontal Distance, meters' ylabelAltitude meters'
titleProjectile Trajectory' axis hMax vMax
Save your program files py and m and plot images png to a single folder, zip and upload to
Blackboard by :pm on April Follow file naming convention in syllabus
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
