Question: ANSWER WITH MATLAB CODE PLEASE DO NOT COPY AND PASTE AN ANSWER FROM ANOTHER, SIMILAR QUESTION. Write a function diffuseants2d(m) Consider an experiment where ants
ANSWER WITH MATLAB CODE
PLEASE DO NOT COPY AND PASTE AN ANSWER FROM ANOTHER, SIMILAR QUESTION.
Write a function diffuseants2d(m)
Consider an experiment where ants are placed on a rectangular board of height R inches and width C inches and are allowed to move on the board. Let us represent the number of ants on one inch-square segments of the board by the matrix m. The figure below shows an example of a 3-by-4 board. After one minute, for any given segment, 1/4th of the ants on that segment move up, 1/4th move down, 1/4th move left, and 1/4th move right. For the ants on the segments along the edges of the board, some of the ants move off the board.
Write a function diffuseants2d(m) that takes a matrix m and returns the number of ants on the segments of the board after one minute. For simplicity, assume that the number of ants in a segment does not have to be a whole integer.
0 2 3.50 2 2.503.5 02.50 0 0 01O 0 0 0 0 0 0 0 0 2.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
