Question: A robot moves in a horizontal plane starting at ( 0 , 0 ) . The robot can move UP , DOWN, LEFT and RIGHT

A robot moves in a horizontal plane starting at (0,0). The robot can move UP, DOWN, LEFT and RIGHT a given number of steps.
Write a function called robot (x,y, direction, steps) that takes inputs of the coordinates of the robot x and y, the direction it moves and the number of steps and outputs the new co-ordinates of the robot.
Use your function to move the robot 8 times where the number of steps are given by the digits of your student ID number and the direction follows the sequence UP, RIGHT, DOWN, LEFT, UP, etc. For example, if your student ID number is 24123456 the robot will make the following movements:
2 steps UP;
4 steps RIGHT;
1 step DOWN;
2 steps LEFT;
3 steps Up;
etc.
Once the robot has completed its movements, output the distance from the start point using both Manhattan and Euclidean distances only using MATLAB
A robot moves in a horizontal plane starting at (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!