Replace the call to sd() in your ``sch.m'' script file with lm(), and
run. If you have implemented steepest descents correctly, you should
find that the energy always decreases and that the angle cosine test
gives nearly zero, indicating that the new gradient is orthogonal to
the previous search direction. Note that at the start, when you are
far from the minimum and the function is not very quadratic, the
approximate minimization is not perfect and you may see angle cosines
near 0.1. However, after about 20 iterations, the algorithm begins to
approach the minimum, and the angle cosines will become much smaller
(
) and continue to improve as the minimization
proceeds.