• 大小: 67KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: Matlab
  • 标签: matlab  cellular  aut  

资源简介

用matlab实现的元胞自动机疏散程序,有GUI界面以及说明

资源截图

代码片段和文件信息

function [Dst_S]=Dststspread(Dst_SZAMrowcolp)
%Dst_S灾害因素矩阵;p扩散概率;
Dst_S1=Dst_S;
[I1 I2]=find(Dst_S==1);
for i=1:length(I1)
    a=[I1(i)I2(i)-1;I1(i)I2(i)+1;...
        I1(i)-1I2(i);I1(i)+1I2(i);...
        I1(i)+1I2(i)-1;I1(i)+1I2(i)+1;...
        I1(i)-1I2(i)-1;I1(i)-1I2(i)+1];
    %     b=ones(81);
    for j=1:8
        if a(j1)>0&&a(j1)<=row&&a(j2)>0&&a(j2)<=col&&ZAM(a(j1)a(j2))==0
            if rand                Dst_S1(a(j1)a(j2))=1;
            end
        end
    end
end
% for i=1:row
%     for j=1:col
%         if Dst_S(ij)==1||
[I1 I2]=find(Dst_S==1);
for i=1:length(I1)
     a=[I1(i)I2(i)-1;I1(i)I2(i)+1;...
        I1(i)-1I2(i);I1(i)+1I2(i);...
        I1(i)+1I2(i)-1;I1(i)+1I2(i)+1;...
        I1(i)-1I2(i)-1;I1(i)-1I2(i)+1;...
        I1(i)+2I2(i)-2;I1(i)+2I2(i)-1;I1(i)+2I2(i);I1(i)+2I2(i)+1;I1(i)+2I2(i)+2;...
        I1(i)-2I2(i)-2;I1(i)-2I2(i)-1;I1(i)-2I2(i);I1(i)-2I2(i)+1;I1(i)-2I2(i)+2;...
        I1(i)-1I2(i)-2;I1(i)-1I2(i)-1;I1(i)-1I2(i);I1(i)-1I2(i)+1;...
        I1(i)+1I2(i)-2;I1(i)+1I2(i)-1;I1(i)+1I2(i);I1(i)+1I2(i)+1];
    for j=1:8
        if a(j1)>0&&a(j1)<=row&&a(j2)>0&&a(j2)<=col
        Dst_S1(a(j1)a(j2))=max(0.5 Dst_S1(a(j1)a(j2)));
        end
    end
    for j=9:24
        if a(j1)>0&&a(j1)<=row&&a(j2)>0&&a(j2)<=col
        Dst_S1(a(j1)a(j2))=max(0.4 Dst_S1(a(j1)a(j2)));
        end
    end
end
Dst_S=Dst_S1;






 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-25 22:54  1、Matlab 2009a 源程序\
     文件        1499  2010-06-18 18:11  1、Matlab 2009a 源程序\Dststspread.m
     文件        2251  2010-06-19 09:55  1、Matlab 2009a 源程序\PopSn.m
     文件       61341  2019-01-25 22:33  1、Matlab 2009a 源程序\renyuanshusan.fig
     文件       35278  2019-01-25 22:53  1、Matlab 2009a 源程序\renyuanshusan.m
     文件         553  2010-06-19 09:55  1、Matlab 2009a 源程序\ShuSanDieDai.m
     文件         224  2010-06-21 07:48  1、Matlab 2009a 源程序\源程序说明.txt

评论

共有 条评论