can anyone help me to write a matlap script please for this

can anyone help me to write a matlap script please for this project?
if you can, give me the whole script please
1. INTRODUCTION During a throw, a baseball player has to consider and calculate many variables to make sure maximum distance to reach its intended target (nitial velocity, initial height, initial height, distance to bag, and angle at which to throw the ball). Using what we have learned in Dynamics class we can accomplish this and calculate the angle distribution of the ball thrown for maximum distance so that the baseball player knows just how to throw the baseball next time the ball is hit to him. Impact Therefore, the student\'s goal in this project is to use MATLAB to calculate the range that a baseball would travel when it is thrown with an initial velocity to at an initial angle Origin Fig. 1. When a baseball is thrown upwards, it follows a Using the MATLAB generated code, the students can then parabolic trajectory use the code to determine the angle that will result in a the maximum range for the baseball. 3. DESIGNING THE SYSTEM AND CALCULATIONS 2. INSTRUCTION AND ORGANIZATION Students will need to write a MATLAB program to calculate the of two range that a baseball would travel when it is thrown with an at an initial angle . Students should use the or three (you can not exceed three, so don\'t ask). If you do itial velocity Do at an initial angle 8. Students should use the 1. This project may be done individually or in groups following procedure to do this: the project in a group, each group member must provide an evaluation of the performance of their team-mate on the 1. If we assume negligible air friction and i gnore the curvature project. of the Earth, a baseball that is thrown into the air from any point on the Earth\'s surface will follow a parabolic flight path (See figure 1). The height of the baseball at any time t 2. To complete this project the student(s) must: (a) write up a lab report with introduction, methods, re- after it is thrown can be given by the equation sults, discussion, individual contributions, and conclu- sion sections (vou much have all sections to obtain full credit); (b) submit a copy of the MATLAB code that was used to where yo is the initial height of the object above the ground, Dyo is the initial vertical velocity of the object, and g is the acceleration due to the Earth\'s gravity. do the design calculations with the report; (c) if in a group, each group member needs to write out group an evaluation of their the back of the report. members and staple it to

Solution

%% Name of team, date, etc. Always give program author.
%% Purpose of program.
%% Be sure to comment well.
close all; clear all; clc; format long e;
%% Work in SI units.
%% My catapult launches from a height of 3/4 meters (see y_0 below).
%% Remember that 10 m/s is about 20 miles per hour.
%% One tenth second time steps is most likely too large.
x_0 = 0; % 1) the initial x-position,
y_0 = .75; % 2) the initial y-position,
v_x_0 = 20; % 3) the initial x-velocity, you have to estimate
v_y_0 = 10; % 4) the initial y-velocity, you have to estimate
dt = 0.1; % 5) the time interval between calculation steps
mass = 0.042; % 6) the mass of the projectile. Found online for
racquetball.
Area = 1.02e-2; % a) the projectile’s cross sectional area, A,
rho = 1.2; % b) the density of air
C_drag = 0.5; % c) the projectile’s drag/aerodynamic coefficient, Cdrag,
g = 9.8; % 8) gravity,
%% How many iterations will you run?
N_steps = 100; % Make large enough for projectile to strike ground.
%% Now define arrays that will hold data.
x = zeros(1,N_steps + 1); % 1) x-position,
x(1) = x_0; % Make sure initial value is correct.
y = zeros(1,N_steps + 1); % 2) y-position,
y(1) = y_0; % Make sure initial value is correct.
v_x = zeros(1,N_steps + 1); % 3) x-velocity,
v_x(1) = v_x_0; % Make sure initial value is correct.
v_y = zeros(1,N_steps + 1); % 4) y-velocity,
v_y(1) = v_y_0; % Make sure initial value is correct.
%% Use formulas for acceleration later, just define as 0 for now.
a_x = 0; % 5) x-acceleration,
a_y = 0; % 6) y-acceleration.
angle = tan(v_y_0 / v_x_0); % Defining the trajectory angle will save on
thinking.
%{
Note that a_drag has x and y components, and that a_drag is given by
a_drag_x = -C_drag*.5*rho*Area*(v_x^2 + v_y^2)/mass*cos(angle) and
a_drag_y = -C_drag*.5*rho*Area*(v_x^2 + v_y^2)/mass*sin(angle).
%}
%% Now make loop to calculate the data based upon the forces.
i_loop = 1;
n_loop = 1;
while i_loop < N_steps, % Skip the initial values.
angle = tan(v_y(i_loop) / v_x(i_loop))
a_x = -C_drag*.5*rho*Area*(v_x(i_loop)^2 +
v_y(i_loop)^2)/mass*cos(angle);
v_x(i_loop+1) = v_x(i_loop) + a_x*dt; % Remember: v = v_o + a*t
x(i_loop + 1) = x(i_loop) + v_x(i_loop)*dt + .5*a_x*dt^2; % Rem:
x=x_o+v_o*t+.5a*t^2
a_y = -g - C_drag*.5*rho*Area*(v_x(i_loop)^2 +
v_y(i_loop)^2)/mass*sin(angle);
v_y(i_loop +1) = v_y(i_loop) + a_y*dt; % Remember: v = v_o + a*t
y(i_loop + 1) = y(i_loop) + v_y(i_loop)*dt + .5*a_y*dt^2; % Rem:
y=y_o+v_o*t+.5a*t^2

%% If the projectile passes below the ground, we want to stop.
if y(i_loop+1) < 0,
i_loop = N_steps;
n_loop = n_loop+1;
else,
i_loop = i_loop+1;
n_loop = n_loop+1;
end;
end;
%{
If we leave the loop early because the ball is lower than the ground,
we want to delete the extra data that is still stored as zeros.
%}
if n_loop < N_steps,
x(n_loop:end) = [ ]; % Empties out rest of array.
y(n_loop:end) = [ ];
end;

can anyone help me to write a matlap script please for this project? if you can, give me the whole script please 1. INTRODUCTION During a throw, a baseball play
can anyone help me to write a matlap script please for this project? if you can, give me the whole script please 1. INTRODUCTION During a throw, a baseball play

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site