Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Matlab : The second section should do the following: , Prompt the user for how far to move the robot in the columns and

In Matlab :
The second section should do the following:
, Prompt the user for how far to move the robot in the columns and rows
NOTE: Remember the robot is actually located in a matrix, so the position (1,1) 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 robot's position
Update the grid matrix - set the element for the previous position to 0, and the new position to 1
Display the robot's position just as in the initialization section (including title with correct robot
position location)
Determine if there is a target at the robot's new coordinates. To accomplish this, perform an
element-wise multiplication of the grid matrix by the target matrix, and take the sum of all
elements. The result will be 0 if there is not a target at the robot's location, or 1 if there is.
Set the element of the target matrix corresponding to the robot's position equal to 0.(That is,
once a target is found, remove it from the target matrix.)
, Print to the command line (using either disp or fprintf) a message [indicating whether a
target was found. Since we have not yet covered if statements, the easy way to do this is to select
one of two messages from an array using indexing. (See the example message array in the script
template above.)
Update the number of moves and number of targets found - the former always increases by 1,
while the latter increases by 1 only if a target is found.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

To find integral of sin(logx) .

Answered: 1 week ago