Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 4 Due Monday 3/11 For the following problem, write a properly commented MATLAB script to perform the listed tasks. Al files should use the

image text in transcribed

Homework 4 Due Monday 3/11 For the following problem, write a properly commented MATLAB script to perform the listed tasks. Al files should use the naming convention FNAME LNAME_ HW4. For example, Dr. Hylton's solution should be a script named Blake_Hylton_HW4.m Upload your complete and well commented script file to Moodle by 9AM on Monday, 3/11 A robot challenge course is designed to test how long it will take for a random-walk robot (or group of robots) to capture a randomly moving target. The course is a 50 by 50 feet square grid. The bottom left corner of the grid is considered position (0,0). The top left is then (0,50), top right (50,50), and bottom right (50,0) The target is placed at a random position within this grid. (Use the randi function to generate x and y coordinates) The robot (or robots) are similarly assigned random starting positions. At each time step, all robots move a random distance (up to 5 grid spaces) in a random cardinal direction (up, down, left, or right... no diagonal motion). The target then moves in a similarly random direction but is limited to only a single grid space per movement. Movement is also restricted in that a robot or target cabnot move beyond the edge of the grid-any robot /target attempting to do so remains in its current position. This process continues until one or more of the robots are in the same position as the target. Simulate this search ten times ach for events using one, two, three, and four robots, automatically cycling through the different group sizes using a loop (you should only hit run once to execute all simulations). Track the number of times the robot(s) moved to complete the course for each simulation, separated by group (one, two, three, or four robots). Display a Set of strings in the command window similar to the one shown below; outputting the average number of movements needed to complete the challenge for that particular number of robots. For one sample run, the program output the following: For 1 robots, the average search took 3879.7 movements For 2 robots, the average search took 11439.7 movements For 3 robots, the average search took 1087.5 movements For 4 robots, the average search took 5575.4 movements. Your script should include easily adjustable variables that control the number of iterations to perform (iter-10), the maximum number of robots to allow (maxRobots-4), the maximum travel distance per time step (maxDist 5) and the size of the grid (gridDim- 50). Note: in the interest of time, include a fail-safe in your program to stop the search after 50,000 steps. Remember- in case of emergency, CTRL-C Hint: You should have a sequence of nested structures-for, for, while, and then, Inside that while loop, two separate for loops with IF structures inside them. Depending on how you check for a robot being in the same position as the target, you might have additional/different structures

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

More Books

Students also viewed these Databases questions

Question

Do Exercise 12 for the ratio of two population variances.

Answered: 1 week ago

Question

ECB is more secure than CBC . true or false

Answered: 1 week ago