MATLAB code from CIVE 121 programming course