Cody

Solution 310881

Submitted on 27 Aug 2013 by Alfonso Nieto-Castanon
  • Size: 27
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% AOE 2074 Week 1 -- Cody Example % Chapra Example 1.1 % Analytical Solution to the Bungee Jumper Problem % Initialize state variable, time (t), parameters (p), and right-side force (f) % Time, t, is a vector of values taken from the table on page 8 of Chapra's textbook. t = 0:2:12; % seconds % Parameters are the bungee jumper's mass (m) and drag coefficient (c_d) m = 68.1; % kg c_d = 0.25; % kg/m % Right-hand-side force is the gravitational force with gravitational constant (g) g = 9.81; % m/s^2 % Compute analytical solution for velocity (downward speed) at given values of time. v = Chapra_Example_1p1_velocity( t, m, c_d, g ); % Check error against textbook solution given in table on page 8. Velocity = [0 18.7292 33.1118 42.0762 46.9575 49.4214 50.6175]; assert(norm(Velocity-v(:),inf)<1e-4)
2   Pass
%% Steady-state solution v = Chapra_Example_1p1_velocity( inf, 68.1, 0.25, 9.81 ); assert(abs(v-51.6938)<1e-4)
3   Pass
%% Chapra Example 1.1 for t=30 v = Chapra_Example_1p1_velocity( 30, 68.1, 0.25, 9.81 ); assert(abs(v-51.6926)<1e-4)
4   Pass
%% Cheating check assert(isempty(regexp(fileread('Chapra_Example_1p1_velocity.m'),'assert.m','once')))