Question

# Modify your Free Fall program below to plot the energy vs. time for a baseball dropped...

Modify your Free Fall program below to plot the energy vs. time for a baseball dropped from a height of 1000 feet until it hits the ground. Now add in the effects of air resistance into your program. This time, on the energy plot, you will plot four quantities: KE (Red line), PE (Green line), Energy lost due to air resistance (purple line), and total Energy (blue circles). Note, you must calculate the energy lost by using the definition of work (W = F deltay). Copy and paste the y vs. time and Energy vs. time plots in the space below.

(Area = .0042, Density of Air = 1.225, Drag Coefficient = 0.47, Mass = 0.145)

clear all;
vo=4;
a=9.81;
m=0.145;
A=0.0042;
Cd=0.5;
rho=1.2;
t(1)=0;
dt=0.1;
te=14;
i=1;
t0=0;
l=1+((te-t(1))/dt);
%program starting
for i=1:l
v(i)=(vo*vo+2*a*((vo*(te-t(1))+0.5*a*(te-t(1))^2)-(vo*(te-t(i))+0.5*a*(te-t(i))^2)))^0.5;
k(i)=m*v(i)*v(i)/2; %kinetic energy
d(i)=Cd*rho*v(i)^2*A/2;%energy lost due to drag force
p(i)=m*a*(vo*(te-t(i))+0.5*a*(te-t(i))^2);%potential energy
x(i)=k(i)+p(i)+d(i); %total energy
y(i)=k(i)+p(i);
if i~=l
t(i+1)=t(i)+dt;
end
end
%Displaying kenitic,potential,drag force and total energy
disp(y(i))
disp(x(i))
disp(p(i))
disp(k(i))
disp(d(i))
%plot
figure;
plot(t,x,t,y,t,d);
title('time vs energy');
legend('Total','KE+PE','energy lost');
xlabel('Time');
ylabel('energy');

By Writing in a stepwise program form :-

1- clear all;

2- m=0.145;

3- g=9.81;

4- h=304.8; % convert 1000 feet to metre

5- Et=m*g*h; %This is total mechanical energy at any at any instant until it hits ground

6- T=sqrt(2*g*h); % Time to reach ground

7- t=0:1:T;

8- vt=g*T; %velocity at any instant t

9- Kt =0.5*m*vt.^2; Kinetic energy at any instant t

10- Pt=Et-Kt; %Potential energy at any instant t

11- plot(t,Kt,'r-');

12- hold on

13- plot (t,Pt,'g-');

14- hold on

15- Et=Kt+Pt;

16- plot(t,Et,'b-');

17- hold off;

18- y=-0.5*g*t.^2;

19- plot(t,y);

Therefore the required output as per graph is shown below.

Image:-1

Image :-2

Please comment if you have any doubts.

#### Earn Coins

Coins can be redeemed for fabulous gifts.