Question
Use a while loop in MATLAB to complete it. A cannonball is fired from a cannon elevated at an angle . If air friction and
Use a while loop in MATLAB to complete it. A cannonball is fired from a cannon elevated at an angle . If air friction and the rotation of the earth are neglected, and gravity is assumed constant, the x and y position of the cannonball at time t are given by: x = x0 + v0x t and y = y0 + v0y t - 0.5 g t^2. Where x0 and y0 are the initial coordinates of the cannonball at t = 0, v0x and v0y are the x and y components of the initial velocity, and g is the acceleration due to gravity (9.81 m/s2), pointing in the -y direction. Choose an initial speed v0 of 100 m/s, an elevation angle of 30, and an initial position at the origin. The artillery piece is positioned at advantageous ground, and fires in the downhill direction where the ground is inclined 6 degrees. Calculate the x-position and y-position of the projectile every 0.05 seconds until the time step just before the projectile hits the ground, and store these values in an array with three columns column 1 will contain the time, column 2 will contain the x-position, and column 3 will contain the y-position. Then output the table to the screen in the following format. Continues until the cannonball hits the ground.
0.0000 10.0000 20.0000 0.0500 14.3301 22.4877 0.1000 18.6603 24.9509
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