资源简介
基于元胞自动机的Matlab仿真程序,都可以运行,还不错哦!拿来和大家分享!

代码片段和文件信息
%Conway‘s life with GUI
clf
clear all
%=============================================
%build the GUI
%define the plot button
plotbutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Run‘ ...
‘fontsize‘12 ...
‘position‘[1004005020] ...
‘callback‘ ‘run=1;‘);
%define the stop button
erasebutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Stop‘ ...
‘fontsize‘12 ...
‘position‘[2004005020] ...
‘callback‘‘freeze=1;‘);
%define the Quit button
quitbutton=uicontrol(‘style‘‘pushbutton‘...
‘string‘‘Quit‘ ...
‘fontsize‘12 ...
‘position‘[3004005020] ...
‘callback‘‘stop=1;close;‘);
number = uicontrol(‘style‘‘text‘ ...
‘string‘‘1‘ ...
‘fontsize‘12 ...
‘position‘[204005020]);
%=============================================
%CA setup
n=128;
%initialize the arrays
z = zeros(nn);
cells = z;
sum = z;
%set a few cells to one
cells(n/2.25*n:.75*n) = 1;
cells(.25*n:.75*nn/2) = 1;
%cells(.5*n-1.5*n-1)=1;
%cells(.5*n-2.5*n-2)=1;
%cells(.5*n-3.5*n-3)=1;
cells = (rand(nn))<.5 ;
%how long for each case to stability or simple oscillators
%build an image and display it
imh = image(cat(3cellszz));
set(imh ‘erasemode‘ ‘none‘)
axis equal
axis tight
%index definition for cell update
x = 2:n-1;
y = 2:n-1;
%Main event loop
stop= 0; %wait for a quit button push
run = 0; %wait for a draw
freeze = 0; %wait for a freeze
while (stop==0)
if (run==1)
%nearest neighbor sum
sum(xy) = cells(xy-1) + cells(xy+1) + ...
cells(x-1 y) + cells(x+1y) + ...
cells(x-1y-1) + cells(x-1y+1) + ...
cells(3:ny-1) + cells(x+1y+1);
% The CA rule
cells = (sum==3) | (sum==2 & cells);
%draw the new image
set(imh ‘cdata‘ cat(3cellszz) )
%update the step number diaplay
stepnumber = 1 + str2num(get(number‘string‘));
set(number‘string‘num2str(stepnumber))
end
if (freeze==1)
run = 0;
freeze = 0;
end
drawnow %need this in the loop for controls to work
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-09-09 20:09 CA+matlab\CA matlab\
目录 0 2010-09-09 20:09 CA+matlab\CA matlab\CA.files\
文件 3101 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\Diffusion1.gif
文件 25386 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\excitable1.png
文件 35874 2006-05-15 10:47 CA+matlab\CA matlab\CA.files\percolationSmall.png
文件 19456 2010-03-14 09:50 CA+matlab\CA matlab\CA.files\Thumbs.db
文件 29081 2006-05-15 10:50 CA+matlab\CA matlab\CA.htm
文件 2226 2006-05-15 10:50 CA+matlab\CA matlab\calife.m
文件 2248 2006-05-15 10:50 CA+matlab\CA matlab\CAsurfaceT.m
文件 1210 2006-05-15 10:50 CA+matlab\CA matlab\CAvine.m
文件 1789 2006-05-15 10:49 CA+matlab\CA matlab\diffusion.m
文件 1208 2006-05-15 10:49 CA+matlab\CA matlab\excitable.m
文件 803 2006-05-15 10:49 CA+matlab\CA matlab\forest.m
文件 3196 2006-05-15 10:49 CA+matlab\CA matlab\gas2.m
文件 2153 2006-05-15 10:49 CA+matlab\CA matlab\sand.m
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论