The matlab scripts do not follow the matlab programming style,and many of the buildin functions of matlab should be used for simplicity and efficiency,such as ode45.There is a possible error in the 2nd chapter .On page 13.The closing velocity is defined asVc = -d(Rtm)/dtThe author says that" In other words,from calculus we know that the closing velocity will be zero when Rtm is a minimum(i.e.the function is either minimum or maximum when its derivative is zero)."But the function must be contineous and *differentiable*.Just think a case with target and missile both on x axis,and missile fly with a constant speed.You will see that the Rtm function is not differentiable at x=0.