Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 : Let's make a plot that shows the vector velocity of a ball undergoing projectile motion ( neglecting air resistance ) . Recall

Problem 2:
Let's make a plot that shows the vector velocity of a ball undergoing projectile motion (neglecting air resistance).
Recall the kinematic equations used to calculate the trajectory (or the x and y-positions) of a ball undergoing projectile motion are as follows:
x=x0+vx0t
y=y0+vy0t-12gt2
where x0 and y0 are the initial positions in the x and y direction, vx0 and vy0 are the initial velocities in the x and y directions, and g=9.8ms2 is the acceleration of gravity.
Write code that uses a for loop to calculate the x and y-positions from 0 to 2s with t=0.1s and store them in arrays. Set vx0=vy0=10ms. Plot the x and y positions against one another to produce a curve like the one shown at the end of this problem.
2
Copy the code from above and paste it in the code cell below. Change your program so that the magnitude of the initial speed and its angle with respect to ground can be input by the user using an input prompt. Use the speed and angle to calculate the x and y-components of the initial velocity (i.e., calculate vx0 and vy0 rather than specify them). Use a while loop to calculate how the position of the projectile changes (x and y values) until it hits the ground (or is very close to hitting the ground). Again, plot the x and y positions against one another to produce a curve like the one shown at the end of this problem.
Copy and paste your code from above into the code cell below. Add code inside your while loop that calculates and stores how the velocity in the x and y direction changes with time.
Next, use quiver to add a few velocity vectors to your plot, so it looks similar to the one below. You should read MATLAB's documentation to learn how to use quiver. You will also need to use hold on and hold off. Galleries like this MATLAB plot gallery can also be helpful for figuring out how to make a particular type of plot.
Finally, add labels to the x and y axis and use xlim and/or ylim to improve the appearance of your plot.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago