Sure enough, that code uses "h" and "g" and "rhs" and "rg" without defining them.
There must have been additional code in the book, or an indication of what those variables are intended to mean.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!