% This is the function used in problems 3 -- 5  of HW 2

function f=fun4_hw2_p3(t,v)

global g a1 a2 topen

if t >= 0  &&  t < topen
    f = g - a1*v;
else
    f = g - a2*v;
end