Question: The first section should do the following: Clear the workspace and command window and close any figure windows Create a 1 0 x 1 0
The first section should do the following:
Clear the workspace and command window and close any figure windows
Create a x grid matrix of all zeros this is the matrix that your robot will occupy
Initialize the robots coordinates to be near the center can be or of the grid matrix by
setting that element of the grid matrix to
Create a second x matrix to represent the targets; initialize to all zeros as well
Using the input function, prompt the user for the number of targets should be between
and
Target Locations
Application : Array Operations ENGR
Designed to test skills with: array creation and operations; commandline inputoutput
Randomly choose that number of elements of the target matrix and set them to This line will
accomplish that assuming that your target matrix is called target and that the number of
targets entered by the user is numtargets you may use whatever variable names you
like:
targetsrandinumtargets,;
o NOTE: this will not necessarily give unique target positions, so there is a chance that the
number of targets placed in the matrix will be less than the number entered by the user
this is okay
Display the robots location using the provided showimage function.
Set the title of the figure window so that it indicates the robots position. You can do this using
string concatenation with the operator
Movement Section
The second section should do the following:
Prompt the user for how far to move the robot in the columns and rows
o NOTE: Remember the robot is actually located in a matrix, so the position is located
near the TOP left when graphed, not the BOTTOM left what we typically imagine as the
origin What we typically think of as movement in the x direction is actually movement
between columns and movement in the y direction is actually movement between rows
Update the robots position
Update the grid matrix set the element for the previous position to and the new position to
Display the rob
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
