For this problem you can either edit the adaptive solver AdaptivedG0.m or you can modify your own ODE-solver BackwardEulerNewtonAdap.m from the previous session C3.