元胞自動機之沙堆問題.doc

(2頁)

'元胞自動機之沙堆問題.doc'
?沙堆問題:%sands pileclear allclfnx=52; %must be divisible by 4ny=100;Pbridge = .05; z=zeros(nx,ny);o=ones(nx,ny);sand = z ;sandNew = z;gnd = z ;gnd(1:nx,ny-3)=1 ; % the ground linegnd(nx/4:nx/2+4,ny-15)=1; %the hole linegnd(nx/2+6:nx,ny-15)=1; %the hole linegnd(nx/4, ny-15:ny) = 1; %side linegnd(3*nx/4, 1:ny) = 1 ;imh = image(cat(3,z',sand',gnd'));set(imh, 'erasemode', 'none')axis equalaxis tightfor i=1:1000 p=mod(i,2); %margolis neighborhood sand(nx/2,ny/2) = 1; %add a grain at the top %upper left cell update xind = [1+p:2:nx-2+p]; yind = [1+p:2:ny-2+p]; vary = rand(nx,ny)<.95 ; vary1 = 1-vary; sandNew(xind,yind) = ... gnd(xind,yind).*sand(xind,yind) + ... (1-gnd(xind,yind)).*sand(xind,yind).*sand(xind,yind+1) .* ... (sand(xind+1,yind+1)+(1-sand(xind+1,yind+1)).*sand(xind+1,yind)); sandNew(xind+1,yind) = ... gnd(xind+1,yind).*sand(xind+1,yind) + ... (1-gnd(xind+1,yind)).*sand(xind+1,yind).*sand(xind+1,yind+1) .* ... (sand(xind,yind+1)+(1-sand(xind,yind+1)).*sand(xind,yind)); sandNew(xind,yind+1) = ... sand(xind,yind+1) + ... (1-sand(xind,yind+1)) .* ... ( sand(xind,yind).*(1-gnd(xind,yind)) + ... (1-sand(xind,yind)).*sand(xind+1,yind).*(1-gnd(xind+1,yind)).*sand(xind+1,yind+1)); sandNew(xind+1,yind+1) = ... sand(xind+1,yind+1) + ... (1-sand(xind+1,yind+1)) .* ... ( sand(xind+1,yind).*(1-gnd(xind+1,yind)) + ... (1-sand(xind+1,yind)).*sand(xind,yind).*(1-gnd(xind,yind)).*sand(xind,yind+1)); %scramble the sites to make it look better temp1 = sandNew(xind,yind+1).*vary(xind,yind+1) + ... sandNew(xind+1,yind+1).*vary1(xind,yind+1); temp2 = sandNew(xind+1,yind+1).*vary(xind,yind+1) + ... sandNew(xind,yind+1).*vary1(xind,yind+1); sandNew(xind,yind+1) = temp1; sandNew(xind+1,yind+1) = temp2; sand = sandNew; set(imh, 'cdata', cat(3,z',sand',gnd') ) drawnowend
關 鍵 詞:
沙堆 問題 自動機
 天天文庫所有資源均是用戶自行上傳分享,僅供網友學習交流,未經上傳用戶書面授權,請勿作他用。
關于本文
本文標題:元胞自動機之沙堆問題.doc
鏈接地址: http://www.476824.live/p-51577887.html
關于我們 - 網站聲明 - 網站地圖 - 資源地圖 - 友情鏈接 - 網站客服點擊這里,給天天文庫發消息,QQ:1290478887 - 聯系我們

本站為“文檔C2C交易模式”,即用戶上傳的文檔直接賣給(下載)用戶,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有【成交的100%(原創)】。本站是網絡服務平臺方,若您的權利被侵害,侵權客服QQ:1290478887 歡迎舉報。

[email protected] 2017-2027 http://www.476824.live 網站版權所有

粵ICP備19057495號 

收起
展開
球探网即时蓝球比分 排列三杀号彩宝贝 pk10宝宝计划软件下载 彩坛至尊主二肖博二码 湖北30选5技巧 江西多乐彩11选5开奖结果 2019股票配资平台哪个最好 广西体彩十一选五前三 浙江体彩飞鱼和值 河北快3下载河北快3走势图 福利彩票深圳风采开奖