Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(MATLAB) Write a program that simulates the following model for fire growth. We assume that we have a rectangular grid with a fixed number of
(MATLAB)
Write a program that simulates the following model for fire growth. We assume that we have a rectangular grid with a fixed number of rows and columns. Initially, the grid is presumed to have trees that can fuel a fire. We then simulate a fire that starts at a specified cell off the grid. At each step, the fire burns out all of the fuel of its current cell, while moving to an adjacent cell that still has fuel (horizontally or vertically; not diagonally). In particular, if there is a choice of neighboring cells having fuel, it picks one of those choices uniformly at random for the next step. A trial should end when the fire either reaches a cell at the boundary of the grid, or when it reaches a location in which all meighboring squares have already been visited, in which case the fire bums out. Create a file fire.m implementing a function with the following specifications. function outcomes fire (numRows numCols start Row startcol.) simulate the spread of a fire USAGE outcomes fire nunRow numcols, start Row, startcol.) The simulation wi ill be performed on a grid with specified number of rows and columns assumed to be numbered starting at (1,1) at the top-left The fire begins at location t (StartRow startcol) within that grid A series offranues from a trial of fire(7, 7, 4, 4) The next step goes to the left exiting the grid. The final frame of a trial fire(2e, se, 1e, 1s) in which the fire reaches the bottom edge of the region Write a program that simulates the following model for fire growth. We assume that we have a rectangular grid with a fixed number of rows and columns. Initially, the grid is presumed to have trees that can fuel a fire. We then simulate a fire that starts at a specified cell off the grid. At each step, the fire burns out all of the fuel of its current cell, while moving to an adjacent cell that still has fuel (horizontally or vertically; not diagonally). In particular, if there is a choice of neighboring cells having fuel, it picks one of those choices uniformly at random for the next step. A trial should end when the fire either reaches a cell at the boundary of the grid, or when it reaches a location in which all meighboring squares have already been visited, in which case the fire bums out. Create a file fire.m implementing a function with the following specifications. function outcomes fire (numRows numCols start Row startcol.) simulate the spread of a fire USAGE outcomes fire nunRow numcols, start Row, startcol.) The simulation wi ill be performed on a grid with specified number of rows and columns assumed to be numbered starting at (1,1) at the top-left The fire begins at location t (StartRow startcol) within that grid A series offranues from a trial of fire(7, 7, 4, 4) The next step goes to the left exiting the grid. The final frame of a trial fire(2e, se, 1e, 1s) in which the fire reaches the bottom edge of the regionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started