Question
Create a program that plots the trajectory, from the initial height to the ground, of a projectile accelerating both in the horizontal and vertical directions.

-Matlab Code

PROBLEM 4: In your physics class, projectile motion has two components: constant-velocity motion in the horizontal direction
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Problem 4:

MATLAB CODE:

% User input
h0 = input('Enter initial height (in meters): ');
u = input('Enter initial velocity (in m/s): ');
theta = input('Enter angle (in degrees): ');
theta = theta*pi/180;
ax = input('Enter x-component of acceleration (in m/s^2): ');
ay = input('Enter y-component of acceleration (in m/s^2): ');
x = [0];
y = [h0];
t = 0;
disp_x = u*cos(theta)*t + ax*t^2/2;
disp_y = h0 + u*sin(theta)*t + ay*t^2/2;
% Keep looping till displacement in y direction is > 0
while disp_y >= 0
    x = [x disp_x];
    y = [y disp_y];
    t = t + 0.1;
    disp_x = u*cos(theta)*t + ax*t^2/2;
    disp_y = h0 + u*sin(theta)*t + ay*t^2/2;
end
x = [x disp_x];
y = [y disp_y];
% Plot the trajectory
plot(x, y);
title('Trajectory');
xlabel('x');
ylabel('y');
ylim([0 inf]);

SAMPLE OUTPUT:

Enter initial height (in meters): Enter initial velocity (in m/s): 45 Enter angle (in degrees): 30 Enter x-component of accel

Trajectory 30 25 20 > 15 10 50 100 150 200 250

FOR ANY HELP JUST DROP A COMMENT

Add a comment
Know the answer?
Add Answer to:
Create a program that plots the trajectory, from the initial height to the ground, of a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A ball is thrown from the ground onto a roof of height yroof 16 m from...

    A ball is thrown from the ground onto a roof of height yroof 16 m from a distance of x 7 meters away as shown in the diagram to the left. The maximum height of the ball's trajectory is ymax 3.2 meters above the top of the roof. Standard Exercise Roof Toss Standard Exercse Cliff Toss 1) Find the required initial vertical component of the velocity, V vy 0 m/s Submit Help 2) Find the time for the ball to...

  • With steps please A projectile is fired from ground level with an initial speed of 55.6...

    With steps please A projectile is fired from ground level with an initial speed of 55.6 m/s at an angle of 41.2 above the horizontal. (a) Determine the time necessary for the projectile to reach its maximum height. (b) Determine the maximum height reached by the projectile. (c) Determine the horizontal and vertical components of the velocity vector at the maximum height. (d) Determine the horizontal and vertical components of the acceleration vector at the maximum height.

  • An M-16 is fired from level ground at an upwards angle of 10 degrees with respect...

    An M-16 is fired from level ground at an upwards angle of 10 degrees with respect to the horizontal. The initial velocity of the bullet is 948 m/s, but because it is fired at a 10 degree angle, the vertical component of the initial velocity is 165 m/s and the horizontal component is 934 m/s. Ignore air resistance and the curvature of the earth in this problem. (Hint: See the videos Projectile Motion Parts 9-13. For questions 9-14 and 17,...

  • A projectile is launched from a platform of height h and lands on the ground below....

    A projectile is launched from a platform of height h and lands on the ground below. a) Find the launch angle that maximizes the horizontal range of the projectile. b) Now suppose the projectile is subject to a strong headwind such that it has a horizontal acceleration of 1.00 m/s2 , pointing against its motion. If it is launched at 30∘ above the horizontal with initial speed of 30 m/s, and the platform is 5.00 m tall, how far does...

  • 9. The figure below shows the trajectory of a ball undergoing projectile motion. The time t-0s...

    9. The figure below shows the trajectory of a ball undergoing projectile motion. The time t-0s corresponds . Its launch velocity, also called are also indicated in the figure which are X0m and y- 0 m. to the moment just as the ball is launched from position the initial velocity, is g. The other two points along the trajectory corresponding the velocity of the ball at the peak ) it strikes the ground (2) at t How do the speeds...

  • (20 points) The horizontal and vertical components of the initial velocity of a golf ball are...

    (20 points) The horizontal and vertical components of the initial velocity of a golf ball are 60.4 m/s and 72.0 m/s respectively. A) Sketch the motion of the ball and draw a motion diagram for the vertical and horizontal components of the motion. B) List all known variable and their values. C) If there is no air resistance, how long does it take the ball to reach the top of its trajectory? D) Whatisthemaximumheightiftheballstartedatgroundlevel? E) How far down the field...

  • A projectile is launched from a platform of height h and lands on the ground below....

    A projectile is launched from a platform of height h and lands on the ground below. a) Find the launch angle that maximizes the horizontal range of the projectile. b) Now suppose the projectile is subject to a strong headwind such that it has a horizontal acceleration of 1.00 m/s2, pointing against its motion. If it is launched at 30∘ above the horizontal with initial speed of 30 m/s, and the platform is 5.00 m tall, how far does the...

  • Problem 4: A projectile is fired with an initial velocity of 54.1 m/s, at an initial...

    Problem 4: A projectile is fired with an initial velocity of 54.1 m/s, at an initial inclination of 33.7 degrees with the horizontal r-axis. All initial variables (displacement and time) start at 0. You are asked to consider two cases of motion for the projectile, one without drag, and one with drag, with both the cases including effects of gravity. a) For motion with no drag, acceleration vector is given as а -g, where g 9.8 m/s. b) For motion...

  • At a height h = 44.0 m above the ground a rocket is fired at an...

    At a height h = 44.0 m above the ground a rocket is fired at an initial speed v0 = 168.0 m/s at an angle θ = 27 degrees above the horizontal. Ignore air resistance. The magnitude of the gravitational acceleration is 9.8 m/s2. Choose the RIGHT as positive x-direction. Choose UPWARD as psotitive y-direction. Keep 2 decimal places in all answers (a) Find v0x, the x component of the initial velocity (in m/s) (b) Find v0y, the y component...

  • Plot the Trajectory of a Projectile (by hand) from launch to maximum height • Launch angle...

    Plot the Trajectory of a Projectile (by hand) from launch to maximum height • Launch angle is 35 degrees • Launch height (y0) = 3 m • Initial velocity (V0) = 25 m/s • Acceleration ... ax = 0 , ay = -9.8 m/s2 Part 2 • Make a data table for x(t) and y(t) and plot the trajectory of the projectile (y vs. x) on graph paper • stop the plot when the maximum height is achieved • use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT