Question: For the MATLAB script you write for this homework you should follow the documentation rules found in the Homework folder on BbLearn (in the Course

For the MATLAB script you write for this homework you should follow the documentation rules found in the Homework folder on BbLearn (in the Course Content tab). Use the MATLAB function publish to run your script as described below. Upload your pdf in the same place you downloaded this assignment. Click on HW 08 and upload it into the Assignment Submission box. As discussed in the lecture, general two-dimensional projectile motion including air resistance (drag) is governed by the following system of 2nd order differential equations: d2x dy dt2 -(D/m)vu, dt2 :-9-(D/m)vvy The analytic solution to this system of ODEs, to my knowledge, cannot be written down in closed form. However, you can write down the analytic solution for 10 projectile motion including air resistance. This assignment involves 2D motion with air resistance. Your job is to numerically compute the motion of a baseball in 2D including air resistance. In other words, you need to integrate the system of ODEs above. You will need to do this using the (1st order) forward Euler method and the (4th order) Runge-Kutta method. Fortunately, you do not have to write your own Runge-Kutta integrator, you may instead use MATLAB's ode45. In lecture 7. I numerically approximated the solution to the ODEs governing two-dimensional projectile motion without including air resistance. First I rewrote the two second order ODEs as a system of four first-order ODES. If, say, we call the vector of kinematic variables X, then (using the ordering that I used in the lecture) X = [x, vx, y, vy) and the time derivative of this vector is dXdt = [Vx, ax, vy, ay). Advancing the initial condition forward in time using the Forward Euler method can be expressed as the following recurrence relation: (X)x+1 = (X)X + At. (dXdt), where the subscript k indicates those quantities have the value corresponding to t = tk. Your job is to extend this to 2D projectile motion with air resistance. Have your script use an iterative loop that approximates the solution numerically using the Forward Euler method. Using a step size of 0.01 s, integrate the four-dimensional system from t = 0 to 11 s using the same ordering described above for your kinematic variables. Calculate your derivatives using a subfunction. I want you also to approximate the solution to the ODEs using ode45. You also will need to determine the drag coefficient for the baseball. The following parameters for determining D in your code are: g = 9.81 m/s?, C = 0.098, p = 1.225 kg/m), r = 3.66 cm, m = 145 g. m and rare the mass and radius of the baseball, respectively. You will also need m and g for your derivatives (dXdt). For your initial conditions, use the following: at t=0, x = 0 m and y = 0.9 m; the initial speed that the bat provides the ball is 85 m/s at an angle of 51* above the horizontal. I want you to plot two figures: figure(1); the trajectory in the physical space (y vs x) for both ode45 and your forward Euler method. Plot MATLAB's ode45 solution as a blue line with open blue circles. Plot your forward Euler solution as a red line with red stars. Label your axes with units; include a title and a legend. For figure(2); use subplot to plot the horizontal velocity as a function of time in one window and the vertical velocity as a function of time in the other. In both (v vst and Vy vs t), plot MATLAB's ode45 solution as a solid blue line with open blue circles. Plot your forward Euler solution as a solid red line with red stars. For comparison, add to your figure(1) plot: the corresponding motion of the baseball given by the analytic solution for projectile motion in the absence of air resistance. Use a solid black line with solid black dots for this curve. Label all of your axes with units; include a title and a legend in each plot. As a reminder, the analytic solution for projectile motion in 2D, ignoring air-resistance is given by: x = xo + Voxt; V: = vox ; y = yo + Voyt - gt? ; Vy = Voy-gt For the MATLAB script you write for this homework you should follow the documentation rules found in the Homework folder on BbLearn (in the Course Content tab). Use the MATLAB function publish to run your script as described below. Upload your pdf in the same place you downloaded this assignment. Click on HW 08 and upload it into the Assignment Submission box. As discussed in the lecture, general two-dimensional projectile motion including air resistance (drag) is governed by the following system of 2nd order differential equations: d2x dy dt2 -(D/m)vu, dt2 :-9-(D/m)vvy The analytic solution to this system of ODEs, to my knowledge, cannot be written down in closed form. However, you can write down the analytic solution for 10 projectile motion including air resistance. This assignment involves 2D motion with air resistance. Your job is to numerically compute the motion of a baseball in 2D including air resistance. In other words, you need to integrate the system of ODEs above. You will need to do this using the (1st order) forward Euler method and the (4th order) Runge-Kutta method. Fortunately, you do not have to write your own Runge-Kutta integrator, you may instead use MATLAB's ode45. In lecture 7. I numerically approximated the solution to the ODEs governing two-dimensional projectile motion without including air resistance. First I rewrote the two second order ODEs as a system of four first-order ODES. If, say, we call the vector of kinematic variables X, then (using the ordering that I used in the lecture) X = [x, vx, y, vy) and the time derivative of this vector is dXdt = [Vx, ax, vy, ay). Advancing the initial condition forward in time using the Forward Euler method can be expressed as the following recurrence relation: (X)x+1 = (X)X + At. (dXdt), where the subscript k indicates those quantities have the value corresponding to t = tk. Your job is to extend this to 2D projectile motion with air resistance. Have your script use an iterative loop that approximates the solution numerically using the Forward Euler method. Using a step size of 0.01 s, integrate the four-dimensional system from t = 0 to 11 s using the same ordering described above for your kinematic variables. Calculate your derivatives using a subfunction. I want you also to approximate the solution to the ODEs using ode45. You also will need to determine the drag coefficient for the baseball. The following parameters for determining D in your code are: g = 9.81 m/s?, C = 0.098, p = 1.225 kg/m), r = 3.66 cm, m = 145 g. m and rare the mass and radius of the baseball, respectively. You will also need m and g for your derivatives (dXdt). For your initial conditions, use the following: at t=0, x = 0 m and y = 0.9 m; the initial speed that the bat provides the ball is 85 m/s at an angle of 51* above the horizontal. I want you to plot two figures: figure(1); the trajectory in the physical space (y vs x) for both ode45 and your forward Euler method. Plot MATLAB's ode45 solution as a blue line with open blue circles. Plot your forward Euler solution as a red line with red stars. Label your axes with units; include a title and a legend. For figure(2); use subplot to plot the horizontal velocity as a function of time in one window and the vertical velocity as a function of time in the other. In both (v vst and Vy vs t), plot MATLAB's ode45 solution as a solid blue line with open blue circles. Plot your forward Euler solution as a solid red line with red stars. For comparison, add to your figure(1) plot: the corresponding motion of the baseball given by the analytic solution for projectile motion in the absence of air resistance. Use a solid black line with solid black dots for this curve. Label all of your axes with units; include a title and a legend in each plot. As a reminder, the analytic solution for projectile motion in 2D, ignoring air-resistance is given by: x = xo + Voxt; V: = vox ; y = yo + Voyt - gt? ; Vy = Voy-gt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
