Question
MATLAB HELP Problem 1: Equations 1 and 2 give the horizontal and vertical position (x and y, respectively) of a projectile as a function of
MATLAB HELP
Problem 1: Equations 1 and 2 give the horizontal and vertical position (x and y, respectively) of a projectile as a function of time (t), initial velocity (Vo), initial angle (?o), and the acceleration due to gravity (g = 9.81 m/s). x(t) = tV0cos(?) (1) y(t) = tV0sin(?)-1/2 gt2 (2) Given these equations, use MATLAB to solve the following items:
1. Solve for the time at which the projectile hits the ground as a function of the initial conditions V0 and ?o
2. Suppose the projectile just described is fired at an initial velocity (V0) of 100 m/s and a launch angle (?o) of ?/4. Find the distance traveled both horizontally (x) and vertically (y) for t=0 to tmax with a spacing (step size) of 0.01 seconds. Graph horizontal distance versus time (with time on the x-axis). In a new figure window, plot vertical distance versus time (again with time on the x-axis). Clearly label the axes and add a title.
3. In yet another new figure window, use the comet() function to plot the horizontal distance (x) on the x-axis and vertical distance (y) on the y-axis. If the plot draws too quickly or too slowly on your computer, adjust the number of time values used in your calculations. Hint: Dont forget you can look the comet function up in Matlab help or by googling it.
4. Calculate three new vectors for the vertical (y1, y2, y3) and horizontal (x1, x2, x3) distances traveled, assuming launch angles of ?/2, ?/4, and ?/6. In a new figure window, graph horizontal distances on the x-axis and vertical distances on the y-axis, for all three cases (youll have three lines in one plot/figure). Make one solid, one dashed, and one dotted. Add a legend to identify which line is which.
5. create a function called 'projectile motion' that takes as arguments initial velocity and angle and then plots the vertical distance vs horizontal distance, labels the plot, and then returns the horizontal and vertical distances as time
[horizontal, vertical, time]=projectile motion(v0,theta)
also include in your code a line that includes max height using comands max(), text(), num2str()
6. create a script that a for loop and the function defined above to plot the projectile motion for velocities [100,200,300,400]m/s and theta=pi/4.
7. create a user defined function called 'derivative' that when given two vectors (x and f(x)) it returns the derivative of the function.
8. Using the functions made in problems 5 and 7 above, plot the vertical distance, vertical velocity, and vertical velocity as functions of time using theta=pi/4, and V0=400m/s,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started