Appendix MATLAB codes for 2D L-bracket case