function f = usingfzero1_Fun(x)
% -----------------------------------------------------
% usingfzero1_fun.m
% -----------------------------------------------------
% The function f(x)=0, problem seeks root x. 
% -----------------------------------------------------
% Syntax: f = usingfzero1_fun(x)
% Input: x = estimates of root, drag coefficient
% Output: f = function value evaluated at x
% -----------------------------------------------------
% Notes: any required parameters defined as 
% global variables
% -----------------------------------------------------
% Copyright and license details available at matlabmarina.com
%-------------------------------------------------------

% Declare global variables
global mass grav vel time

% Define the function for velocity
f = (mass * grav / x) *(1 - exp(-(x * time / mass))) - vel;

end


