subject

Random Walker Collisions In lecture, we saw how to model the behavior of a random walker on a 2D grid using a Monte Carlo simulation. In this problem, we will investigate collisions between two of these random walkers. Specifically, use your simulation to track the distances of the two walkers until they collide. 1. Start by writing a MATLAB script to simulate the path that the single random walker A takes on an 11 x 11 grid of tiles. Let this random walker use a random compass as shown in class. Thus, the probability p of moving in the North, East, South, and West directions is given by 0.2. The remaining probability is the one used to stay put. If the random walker tries to move "past" one of the boundaries on its turn, his position does not change (you can think of this as a particle bumping into a wall and staying still). Choose a random tile to let the random walker A start his walk. Lastly, write a function to update the position of the random walker A. The function must use exactly the function header shown below, i. e. the function name and number and ordering of inputs and outputs must be followed exactly. function (x, y) = Randwalk_2D (x0, y0, BC) Here, x0 and y0 are the initial positions of the random walker, BC is the array of boundary conditions, and x and y are the updated positions of the random walker. 2. Add the random walker B to your simulation who moves according to its own randomly generated values using the same compass as the random walker A in Part 1. Let the random walker B start his walk on the tile that is furthest away from the start tile of walker A. At each iteration, both walkers move simultaneously to an adjacent tile using the rules outlined in Part 1. Continue updating the position of both walkers until a collision occurs (or until the maximum number of iterations, which is set to 1000, is reached). More precisely, a collision occurs when both random walkers occupy the same tile after both have completed their move. Furthermore, a collision occurs when both random walkers are next to each other and move to the other one's tile. Note that in this instance, the collision appears on their way, but both random walkers will end up on tiles that are again next to each other. In other words, collision also appears when their paths cross. 3. Track the movement of each random walker by storing their positions in four 1D-arrays associated with their x- and y-positions in the grid. After the simulation, calculate for each iteration the distance between the random walkers A and B, and plot the results vs. the number of iterations to see when the two random walkers A and B came close to each other and when they were far away from each other.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:10
Assume that minutes is an int variable whose value is 0 or positive. write an expression whose value is "undercooked" or "soft-boiled" or "medium-boiled" or "hard-boiled" or "overcooked" based on the value of minutes. in particular: if the value of minutes is less than 2 the expression's value is "undercooked"; 2-4 would be a "soft-boiled", 5-7 would be "medium-boiled", 8-11 would be "hard-boiled" and 12 or more would be a "overcooked".
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
How should you specify box sizes on a web page if you want the boxes to vary according to the font size of the text they contain? a. in pixels b. in inches c. as percentages d. in em units
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
You know the right answer?
Random Walker Collisions In lecture, we saw how to model the behavior of a random walker on a 2D gri...
Questions
question
Mathematics, 11.07.2021 07:40
question
Mathematics, 11.07.2021 07:40
question
Mathematics, 11.07.2021 07:40
question
Social Studies, 11.07.2021 07:40
question
Biology, 11.07.2021 07:50