Question: WITH NO FOR OR IF LOOPS I NEED HELP PLEASE!!! Your current grade: 0 ( out of 1 ) Submit a new file Number of

WITH NO FOR OR IF LOOPS I NEED HELP PLEASE!!! Your current grade: 0(out of 1)
Submit a new file
Number of submissions left today: 2
Due date: 2024-05-0323:59:59. Remaining time: 2 hours 54 mins
Late Penalty: 10% per day (not prorated).
remainingbacteria_2d_noedgecase
Consider an experiment where bacteria are grown on a rectangular petri dish divided into an R- by-C grid. Let matrix M(with R rows, C columns) represent the number of bacteria in
each block of this grid. When a drop of antibiotic is delivered to a specific block at row x and column y, it kills all of the bacteria on that block and half of the bacteria in all of the
neighboring blocks. The figure below shows an example of a plate composed of a 4-by-4 grid, where the numbers represent bacteria count in each block. After the antibiotic is delivered
to the block at 2nd row and 3th column, it kills all of the 10 bacteria on that block and half of the bacteria in neighboring blocks.
Write a function remainingbacteria_2d_noedgecase (M,x,y) that returns a matrix representing the number of bacteria remaining on each block of the petri dish after the antibiotic has
killed bacteria as described above.
Assume that the antibiotic is never delivered to the grids on the edges of the petri dish.
this code did not work and gave me the errors as shown in the picture I attached...
(function M = remainingbacteria_2d_noedgecase(M,x,y)
M(x-1,y)= M(x-1,y)/2; % Upper block
M(x+1,y)= M(x+1,y)/2; % Lower block
M(x,y-1)= M(x,y-1)/2; % Left block
M(x,y+1)= M(x,y+1)/2; % Right block
M(x,y)=0; % Current block
end)) Grading details
Input/Output 1:
Input/Output 2:
Input/Output 3:
WITH NO FOR OR IF LOOPS I NEED HELP PLEASE!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!