Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need tbe coding for matlab this is hitTheSpot.m 3) ROOT FINDING A SOLUTION - PROJECTILE MOTION The motion of a projectile in flight is

i need tbe coding for matlab image text in transcribed
image text in transcribed this is hitTheSpot.m
3) ROOT FINDING A SOLUTION - PROJECTILE MOTION The motion of a projectile in flight is a standard topic in a physics course. This motion is typically idealized as a particle being affected only by the force of gravity. It therefore has acceleration only in the vertical direction. The equations that dictate the x (horizontal) and y (vertical) position over time are given by Ax = 1, cos(O) Ay = 0, sin(6) t - 2912 Where g is the acceleration due to gravity (9.81 m/s in standard metric units), Vis the initial speed of the projectile, is the angle the initial velocity vector makes with the horizontal direction, and t is the elapsed time since the initial time. In this problem, we will be attempting to hit a target which is Ax = 100 m, Ay = 0 m a) Find the appropriate velocity to hit the target for @ = 30' (you may solve this by hand) On canvas, you will find a file called hitTheSpot.m. This is a function m-file, and gives you access to a user-written function (written by me!). Move this file to the directory of your homework file and it will give access to the function hitTheSpot(v.). hitTheSpot is a function that returns the landing position of the ball given the initial velocity and firing angle in degrees). The difference between this file and the work you did above is that this file accounts for the effects of air resistance by numerically solving the appropriate 2d order non-linear differential equation as a part of its execution. Feel free to open the file in Matlab to examine it, if you wish. b) Use any of the 4 root finding methods that we learned this week to solve for the correct velocity to hit the target (100m away) at an angle of 30'. Choose your own initial conditions and your own tolerance. This problem will also not be auto-graded. Comment on the effects of air resistance on the required velocity to hit the target, as evidenced by the answers to part a) and part b) function y = hitTheSpot (v0, theta) cd - 0.5; dxdt - e(t, x) [X(3:4);(-1/2*1*pi. (0.12) *Cd norm(x(3:4))*x(3:4)-[0;9.81])); if size (vo) size (theta) [m, n] = size(0); Y zeros(m, n); for i = 1:m forl:n [t,x) = ode45 (dxdt, [0,2*v0(i, j)*sind(theta(i, j))/9.81), [0;0;v0(i, j) *cosd(theta(i, j));v0(i, j)*sind(theta(i, 3))); figure plot (x(:,1),(:,2)) & hold on & plot (v0*cosd(theta)*t,v0*sind(theta)*t- 1/2*9.81*t. 2) set (gca, 'ylim', [0, inf]) [-,b] - max(x(:,2)); Y(13) interpl(x(b:end, 2),x(b:end, 1), 0, 'pchip'); end end elseif size (VO) -- [1,1] (m, n) = size(theta); y = zeros (m,n); for i = 1:m for -lin [t,x] = ode 45 (dxdt, [0,2*v0*sind(theta(i, j))/9.81), [0;0;v0*cosd(theta(i, j));v0*sind(theta(i, j))]); & figure plot (x(:,1),(:,2)) hold on plot (v0*cosd(theta)*t,v0*sind(theta)t- 1/2*9.81*t. 2) set (gea, 'ylim', [0, inf]) [-,b] = max(x(:,2)); yli, j) = interpl(x(b:end, 2),x(b:end, 1),0, 'pchip'); end end elseif size(theta) == [1,1] [m, n] = size(0); y - zeros (m,n); for i=1:m for) - lin [t,x] = ode45 (dxdt, [0,2*v0(i))*sind(theta)/9.81). [0;0;v0(, 3) *cosd(theta); vo(i, j)*sind(theta)]); 8 figure 8 plot(x(:,1),(:, 2)) hold on plot (v0*cosd(theta)*t,vo sind(theta)*t- 1/2*9.81*t. 2) set (gca, 'ylim', [0, inf]) [-,b] = max(x(:,2)); yli, j) = interpl(x(b:end, 2), (b:end, 1), 0, 'pchip'); end end end 3) ROOT FINDING A SOLUTION - PROJECTILE MOTION The motion of a projectile in flight is a standard topic in a physics course. This motion is typically idealized as a particle being affected only by the force of gravity. It therefore has acceleration only in the vertical direction. The equations that dictate the x (horizontal) and y (vertical) position over time are given by Ax = 1, cos(O) Ay = 0, sin(6) t - 2912 Where g is the acceleration due to gravity (9.81 m/s in standard metric units), Vis the initial speed of the projectile, is the angle the initial velocity vector makes with the horizontal direction, and t is the elapsed time since the initial time. In this problem, we will be attempting to hit a target which is Ax = 100 m, Ay = 0 m a) Find the appropriate velocity to hit the target for @ = 30' (you may solve this by hand) On canvas, you will find a file called hitTheSpot.m. This is a function m-file, and gives you access to a user-written function (written by me!). Move this file to the directory of your homework file and it will give access to the function hitTheSpot(v.). hitTheSpot is a function that returns the landing position of the ball given the initial velocity and firing angle in degrees). The difference between this file and the work you did above is that this file accounts for the effects of air resistance by numerically solving the appropriate 2d order non-linear differential equation as a part of its execution. Feel free to open the file in Matlab to examine it, if you wish. b) Use any of the 4 root finding methods that we learned this week to solve for the correct velocity to hit the target (100m away) at an angle of 30'. Choose your own initial conditions and your own tolerance. This problem will also not be auto-graded. Comment on the effects of air resistance on the required velocity to hit the target, as evidenced by the answers to part a) and part b) function y = hitTheSpot (v0, theta) cd - 0.5; dxdt - e(t, x) [X(3:4);(-1/2*1*pi. (0.12) *Cd norm(x(3:4))*x(3:4)-[0;9.81])); if size (vo) size (theta) [m, n] = size(0); Y zeros(m, n); for i = 1:m forl:n [t,x) = ode45 (dxdt, [0,2*v0(i, j)*sind(theta(i, j))/9.81), [0;0;v0(i, j) *cosd(theta(i, j));v0(i, j)*sind(theta(i, 3))); figure plot (x(:,1),(:,2)) & hold on & plot (v0*cosd(theta)*t,v0*sind(theta)*t- 1/2*9.81*t. 2) set (gca, 'ylim', [0, inf]) [-,b] - max(x(:,2)); Y(13) interpl(x(b:end, 2),x(b:end, 1), 0, 'pchip'); end end elseif size (VO) -- [1,1] (m, n) = size(theta); y = zeros (m,n); for i = 1:m for -lin [t,x] = ode 45 (dxdt, [0,2*v0*sind(theta(i, j))/9.81), [0;0;v0*cosd(theta(i, j));v0*sind(theta(i, j))]); & figure plot (x(:,1),(:,2)) hold on plot (v0*cosd(theta)*t,v0*sind(theta)t- 1/2*9.81*t. 2) set (gea, 'ylim', [0, inf]) [-,b] = max(x(:,2)); yli, j) = interpl(x(b:end, 2),x(b:end, 1),0, 'pchip'); end end elseif size(theta) == [1,1] [m, n] = size(0); y - zeros (m,n); for i=1:m for) - lin [t,x] = ode45 (dxdt, [0,2*v0(i))*sind(theta)/9.81). [0;0;v0(, 3) *cosd(theta); vo(i, j)*sind(theta)]); 8 figure 8 plot(x(:,1),(:, 2)) hold on plot (v0*cosd(theta)*t,vo sind(theta)*t- 1/2*9.81*t. 2) set (gca, 'ylim', [0, inf]) [-,b] = max(x(:,2)); yli, j) = interpl(x(b:end, 2), (b:end, 1), 0, 'pchip'); end end end

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions