How can I introduce dead trees into a model of a forest fire?
5 views (last 30 days)
Show older comments
I am trying to model a forest fire and have got the following code so far:
n = 50;
X = zeros(n,n);
X(n/2,n/2) = 1;
p = [n 1:n-1];
q = [2:n 1];
r = [1:5];
Pr = 1; %propability of fire spreading to neighbouring trees
Z=zeros(n,n);
for t = 1:30
Y = rand(n,n);
X = ((X(:,p) | X(:,q) | X(p,:) | X(q,:)) & (Y <= Pr)) | X;
Z=Z+X;
pause(0.5)
pcolor(Z);
colorbar;
title(num2str(t));
drawnow;
end
This doesn't account for dead/burnt trees, I want to set a tree's death to be after 3 generaions of being on fire. I have tried setting Z(Z>3) = 0 but the new 0's become 1's shortly after, which then become 3's eventually then back to 0.
Any help on this matter wil be greatly appreciated!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!