function v = skydiver_func4 % Function to calculate skydiver falling speed % for specified parameter values and time vector % using the analytic solution. % % Inputs: mass m (kg) % gravity g (m/s^2) % drag coefficient c (kg/m) % time vector (s) % All inputs are provided interactively. % % Outputs: falling speed vector v (m/s) % Read inputs m = input('Enter mass in kg: ') g = input('Enter gravity in m/s^2: ') c = input('Enter drag coefficient in kg/m: ') t = input('Enter time vector in s: '); desc = input('Enter a description of this analysis: ','s') % Display inputs to verify that they are correct m disp(g) c disp('Size of time vector is') disp(size(t)) disp(desc) pause % Calculate falling speed v = sqrt(m*g/c)*tanh(sqrt(g*c/m)*t); % Output final time and falling speed npts = size(t,1); tf = t(npts,1); vf = v(npts,1); disp('Final falling speed in m/s:') disp(vf)