# Forest Fire Simulation in MATLAB

In my Fall course of Math Models, I have three groups working on projects to finish up the semester.  One of the groups have an assignment to explore a model of the spread of a forest fire.  The assumptions are that the trees are on a rectangular grid, or a lattice.  The time is a discrete variable and at each time step the probability that the fire spreads from one point in the lattice to an adjacent point (up, down, left or right) is given by p.  For simplicity, the event that the fire spreads to each point is assumed to be independent of any other point.

Part of their project is to implement a numerical simulation of their forest fire.  I couldn’t let them have all the fun, so below is an example of my version of the simulation in MATLAB.  I have to hold off on posting the code until after they have handed in their project.

In the graphical representation of my simulation, green represents an unburnt tree, black is burnt and red is currently on fire.  The fire lasts for exactly one time step.  I also implemented a 3-D version, where a height of 1 is unburnt, 2 is on fire, and 0 is burnt.  I’ll confess to having way too much fun with this.

I have used a 200×200 lattice with p = 0.5.

Update (3/4/16)
I promised a LONG time ago that I would post the code.  I finally got around to it.  Here are links to the m files that were used to generate the graphical simulations above:

## 14 thoughts on “Forest Fire Simulation in MATLAB”

1. Bill says:

What’s the smallest value of p for which you can get the fire to burn out without reaching an edge?

How big does p have to be to burn the whole forest?

2. Jerod says:

Cool. Oh the neat things that we can model with math and then get really cool visual models from things like MATLAB. That’s looks like a project to work on.

3. (@Bill)
In other words, answer the next two questions on their project? In fact, their next goal is to establish an upper and lower bound for p which would lead to infinite spread (with a bit of help along the way).

This is the first time I’ve assigned this project in the Models class. I gave it to Jarrod A, Zack G. and Chris Igo. I think they are going to have fun with it.

Plus they’ll be presenting it on Friday, Dec. 5 at 1:30 in MSB 109.

4. Mads says:

I was wondering if it is possible to get the matlab script that you used for this forest-fire project?

Best regards

Mads from Denmark

5. I will post it to the blog after my students have handed in their report. Sorry for the delay but I don’t want to be giving away trade secrets, at least not before they need to write the code themselves.

6. guru says:

Saw the videos on forest fire propagation, they were awesome.

Can you please post the matlab script online?

Thanks,

Guru

7. Hao says:

Hi,
I’m wondering what function you used to plot the tree states in 3d? I am trying to do something similar, using a cellular automota inspired way to show the logistic growth of trees over time. Instead of having 0 and 1’s, I plan to go up to whatever the height of tree is.

I’m trying to do it in this way because I am also going to incorporate edge effects, that is, the height of the tree causes some amount of shade on its neighbors, which will affect the growth of other plants that I hope to model in the same way.

I’ve been playing around with drawnow and surf, but it doens’t give the desired effect.

Thanks

8. weilin Lin says:

Hello!Dr.Scott Franklin,I am a chinese college
student,I am now doing a project about spreading of
forest fire for a county govenrment,I google your article “Forest fire simulation in Matlab”.
Could you send me the Matlab code of this project,
Thank you very much!!
My email is linweilin2008@126.com

9. Johan says:

Hi, I’ve been having some courses in MATLAB, and I’m interested in seeing your script. It seems like it has been a big project, and I’d like to see the size and efford that it takes to make such an (in my opinion) advanced script.

Regards
Johan

10. Saad Arif says:

Hi,

This looks great. I’m trying to program a forest fire simulation in fortran. I was wondering if it would be possible to get your matlab code that i could try to port. Thanks in advance.

11. Lazola Booi says:

Hi, in my quest to model veld/bushfire in Bloemfontein’s grasslands, I got across your post here, and I would like to know if its possible to use Matlab to model bushfires, or is it only restricted to foret fires. Eagerly waitinf ro your response.

Thnks

12. Lux says:

Hi, this simulation is wonderful. I would like to try one too. Is it possible for you to share your codes? Thank you! My email is anushya258@gmail.com