Translate to matlab

Translation of the Python lessons to Matlab. 
The function body ended with `end` keyword/clause.