I recreated these code with my understanding as comments following the instruction in book '' Programming for Computations - MATLAB/Octave-A Gentle Introduction to Numerical Simulations with MATLAB/Octave''by Linge, Svein, Langtangen, Hans Petter.
Link of the book: https://www.springer.com/gp/book/9783319324517