# Where is the mistake in this solution

1. Apr 20, 2015

### bksree

This is a solved example in the book 'Applied numerical methods with MATLAB by Chapra'

A bungee jumper jumps off a cliff 200 m high with an upward velocity of 20 m/s. Detemine when he hits the ground and plot dist vs time and velocity vs time.

The problem is solved in the book using MATLAB as below :
Assuming DOWNWARD direction is positive (i.e. distance (y), velocity (v) and force are positive downards, and x = 0 at ground levele. the boundary conditions are : x(0) = -200 m/s, v(0) = -20 m/s

The diff eqn being solved is : md2y/dt2 = Fdown - F up = mg - cd / m * v^2

The following functions are written

1. Function for derivative --- Here
function dydt=freefall(t,y,cd,m)
% y(1) = x and y(2) = v
grav=9.81;
dydt=[y(2);grav-cd/m*y(2)*abs(y(2))];

2. Function to detect event of hitting the ground
function [detect,stopint,direction]=endevent(t,y,varargin)
% Locate the time when height passes through zero
% and stop integration.
detect=y(1); % Detect height = 0
stopint=1; % Stop the integration
direction=0; % Direction does not matter

3. Script file to run the problem
opts=odeset('events',@endevent);
y0=[-200 -20];
[t,y,te,ye]=ode45(@freefall,[0 inf],y0,opts,0.25,68.1);
te,ye
plot(t,y(:,1),'-',t,y(:,2),'--','LineWidth',2)
legend('Height (m)','Velocity (m/s)')
xlabel('time (s)');
ylabel('x (m) and v (m/s)')

The answer for this is : jumper hits the ground after 9.5475 s at 46.2454 m/s (downward)

====================================================================================
I am trying to solve THE SAME problem using the following convention :

Assuming UPWARD direction is positive (i.e. distance (y), velocity (v) and force are positive downards, and x = 0 at ground levele. the boundary conditions are : x(0) = 200 m, v(0) = 20 m/s

The diff eqn being solved is : md2y/dt2 = -Fdown + F up = -mg + cd / m * v^2

The following functions are written

1. Function for derivative
function dydt=freefall(t,y,cd,m)
% y(1) = x and y(2) = v
grav=9.81;
dydt=[y(2);-grav + cd/m*y(2)*abs(y(2))];

2. Function to detect event of hitting the ground
function [detect,stopint,direction]=endevent(t,y,varargin)
% Locate the time when height passes through zero
% and stop integration.
detect=y(1); % Detect height = 0
stopint=1; % Stop the integration
direction=0; % Direction does not matter

3. Script file to run the problem
opts=odeset('events',@endevent);
y0=[200 20];
[t,y,te,ye]=ode45(@freefall,[0 inf],y0,opts,0.25,68.1);
te,ye
plot(t,y(:,1),'-',t,y(:,2),'--','LineWidth',2)
legend('Height (m)','Velocity (m/s)')
xlabel('time (s)');
ylabel('x (m) and v (m/s)')

The answer for this is : jumper hits the ground after 8.0142 s at -104.8502 m/s (downward)

I am unable to spot the error. Will someone please explain where the mistake is ?

TIA

2. Apr 20, 2015

### jbriggs444

I assume that "cd" is the coefficient of drag. Why would this contribution to force be divided by mass?

Certainly if you cast the equation in terms of acceleration, you would want to divide by mass. But you are casting this as a force equation.

3. Apr 21, 2015

### bksree

Thanks for the reply. As you have pointed out there is a typo in the eqn.
The eqn being solved is d2y/dt2 = 1/m (Fdown - F up) = g - cd / m * v^2
This is the eqn that is coded.

TIA