MATLAB Programming Problem Consider a planar hexapod robot with a center of gravity located at: position of the center of gravity cgX 2.5; cgY 3; and with all six legs planted on the ground at each comer of the robot's body: Case 1: Robot has legs planted at each corner legsx [2 01 5 604) legsY (0 3 8 8 30) A numerical approach to compute the static margin is to discretize the edges forming the perimeter of the support polygon into a large number of points. The static margin can then be found (approximately) as the minimum distance between the CG and a point in this set. Part A. Write a MATLAB function of the forin [minstabMarginj stabMargin( legsx, legsY, cgx, cgY that returns the static stability margin using the numerical approach described above. Verify the MAT. LAB output indicates a static margin ol or the nominal case with all legs planted on the ground. Grading will be in part on clarity of oode and quality of comments submit hardcopy of the along with the Part B. Use your script to compute the static margin in the following cases: Case i: The robot lifts its sixth leg. Case ii: The robot lifts its fifth and sixth leg. Case iii The robot lifts its fourth, fifth and sixth leg. In which cases would the robot topple over? MATLAB Programming Problem Consider a planar hexapod robot with a center of gravity located at: position of the center of gravity cgX 2.5; cgY 3; and with all six legs planted on the ground at each comer of the robot's body: Case 1: Robot has legs planted at each corner legsx [2 01 5 604) legsY (0 3 8 8 30) A numerical approach to compute the static margin is to discretize the edges forming the perimeter of the support polygon into a large number of points. The static margin can then be found (approximately) as the minimum distance between the CG and a point in this set. Part A. Write a MATLAB function of the forin [minstabMarginj stabMargin( legsx, legsY, cgx, cgY that returns the static stability margin using the numerical approach described above. Verify the MAT. LAB output indicates a static margin ol or the nominal case with all legs planted on the ground. Grading will be in part on clarity of oode and quality of comments submit hardcopy of the along with the Part B. Use your script to compute the static margin in the following cases: Case i: The robot lifts its sixth leg. Case ii: The robot lifts its fifth and sixth leg. Case iii The robot lifts its fourth, fifth and sixth leg. In which cases would the robot topple over