function bvalue %BVALUE: MATLAB script M-file that uses bvp4c %to find the air resistance coefficient b %for a ballistic object modeled by physical %(quadratic) air resistance. %Author: Peter Howard b0=0; %b0 is an initial guess at the air resistance fzero(@height,b0) % function val=height(b) %NONHEIGHT: Solves ODE for nonlinear air resistance g = 9.81; rhs = @(t,y) [y(2);-g+b*y(2)^2]; tspan = [0 .95]; y0 = [4.06 0]; [t,y]=ode45(rhs, tspan, y0); val = y(end,1);