Source: http://macs.citadel.edu/zhangli/Courses-Taught/Spring2018/courses/math470/Class%20Examples/Chapter%202/Module2_4/MATLABTutorial2.pdf